This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243137 - Git shows all files as modified
Summary: Git shows all files as modified
Status: RESOLVED INCOMPLETE
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-21 10:53 UTC by MikaelUmaN
Modified: 2017-12-20 22:12 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Claim of netbeans (16.24 KB, image/png)
2014-03-21 10:53 UTC, MikaelUmaN
Details
log file (shows nothing) (52.27 KB, application/octet-stream)
2014-03-21 13:24 UTC, MikaelUmaN
Details
Basic project example where .gitignore shows up as modified (11.51 KB, application/octet-stream)
2014-03-21 15:10 UTC, MikaelUmaN
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MikaelUmaN 2014-03-21 10:53:29 UTC
Created attachment 146217 [details]
Claim of netbeans

Hi. This seems to be related to: https://netbeans.org/bugzilla/show_bug.cgi?id=198451 which is marked as fixed.

However, using NetBeans 8.0, it seems to notice my git repo no problem and I can browse it, and view history etc; but it reports practically all my files as being "modified" though they are not.

My core.autocrlf feature is set to false.

The attachment shows a screen of netbeans. Below is the text shown upon git status:

$ git status
On branch var-feature
Your branch is up-to-date with 'origin/var-feature'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   cq/src/main/java/com/xyz/pricing/BlackScholes.java
        modified:   cq/src/main/java/com/xyz/risk/var/VaR.java
        modified:   cq/src/test/java/com/xyz/risk/var/VaRTest.java

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        cq/src/main/java/com/xyz/risk/var/FunctionalParameter.java

no changes added to commit (use "git add" and/or "git commit -a")
Comment 1 Ondrej Vrabec 2014-03-21 11:20:24 UTC
have you tried refreshing the statuses by clicking on the refresh button? Could you also attach the IDE log after you refresh the statuses (http://wiki.netbeans.org/FaqLogMessagesFile)?
Comment 2 MikaelUmaN 2014-03-21 13:24:19 UTC
Created attachment 146229 [details]
log file (shows nothing)

Log file after refreshing (shows nothing)
Comment 3 MikaelUmaN 2014-03-21 13:24:55 UTC
(In reply to Ondrej Vrabec from comment #1)
> have you tried refreshing the statuses by clicking on the refresh button?
> Could you also attach the IDE log after you refresh the statuses
> (http://wiki.netbeans.org/FaqLogMessagesFile)?

Hi. Refreshing changed nothing. I attached the log file but I don't think it shows anything of value (and was not written after I pressed refresh).
Comment 4 Ondrej Vrabec 2014-03-21 13:28:40 UTC
(In reply to MikaelUmaN from comment #3)
> Hi. Refreshing changed nothing. I attached the log file but I don't think it
> shows anything of value (and was not written after I pressed refresh).
Right, it doesn't. Can you check if it happens also for other projects? Can you make a dummy project in a local git repo where this happens and send me the whole test project (along with its .git folder)?
Comment 5 MikaelUmaN 2014-03-21 15:10:55 UTC
Created attachment 146234 [details]
Basic project example where .gitignore shows up as modified

This is a basic project with one "hello world" java file.

The project uses gradle (and the gradle plugin). I will also try without this plugin as it is just an additional source of possible error but I don't imagine it to be at fault here...?

Anyway, after one change, .gitignore shows up as "modified" in netbeans. Refresh does nothing to amend the situation.
Comment 6 MikaelUmaN 2014-03-21 15:22:49 UTC
Confirmed that dummy project without gradle gives the same result. Complete steps:

Environment:
Windows 7
Java 8
cygwin64
git version 1.8.5

Steps:
1. Create git repo on some server
2. Clone git repo
3. Add basic project (e.g. gradle project or regular netbeans project)
4. From command line: git add -A; git commit -m "Add everything"; git push
5. In netbeans, -> show changes.
6. In netbeans, -> press refresh
7. In command line: git status (shows nothing modified)
8. In netbeans -> shows several files as modified.
Comment 7 Ondrej Vrabec 2014-03-21 15:48:00 UTC
> cygwin64
?really? How does it work if you run NetBeans directly from desktop and not from cygwin?
Comment 8 MikaelUmaN 2014-03-21 15:54:33 UTC
(In reply to Ondrej Vrabec from comment #7)
> > cygwin64
> ?really? How does it work if you run NetBeans directly from desktop and not
> from cygwin?

Netbeans is run directly from desktop. I only run git commands from cygwin terminal.

Should not make a difference I imagine but better to name all details than too few...
Comment 9 Ondrej Vrabec 2014-03-21 16:04:04 UTC
opening your test project i can see that .gitingore is indeed modified. However git status in shell says that too:
Ondra@ONDRA-PC ~/Desktop/dummygit/dummygit (master)
$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   .gitignore
#
no changes added to commit (use "git add" and/or "git commit -a")
Ondra@ONDRA-PC ~/Desktop/dummygit/dummygit (master)
$ git reset --hard
HEAD is now at b012971 Ignore
Ondra@ONDRA-PC ~/Desktop/dummygit/dummygit (master)
$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   .gitignore
#
no changes added to commit (use "git add" and/or "git commit -a")
Ondra@ONDRA-PC ~/Desktop/dummygit/dummygit (master)
$

What is interesting that git status reports modified file even after git reset --hard.
git diff reports:
$ git diff
diff --git a/.gitignore b/.gitignore
old mode 100755
new mode 100644

Do you have any special setup regarding file mode, rights etc.?
Comment 10 MikaelUmaN 2014-03-24 07:56:50 UTC
Actually, permissions on my machine have been a recurring problem and I think something is broken, especially with Windows and cygwin trying to cooperate...

Probably fine to close this and blame it on my machine :(.
Comment 11 Ondrej Vrabec 2014-03-24 08:04:16 UTC
(In reply to MikaelUmaN from comment #10)
> Actually, permissions on my machine have been a recurring problem and I
> think something is broken, especially with Windows and cygwin trying to
> cooperate...
> 
> Probably fine to close this and blame it on my machine :(.
Does it help if you change "filemode" to false in your .git/config file?
> [core]
>   filemode = true
Comment 12 MikaelUmaN 2014-03-24 15:53:53 UTC
Actually it does! Thanks, that solution is perfectly acceptable to me for now.
Comment 13 Ondrej Vrabec 2014-03-28 08:51:56 UTC
> Actually it does! Thanks, that solution is perfectly acceptable to me for now.
I still wonder what the real cause is. Something related to file access rights, possibly a manual setting of umask in cygwin? I do not know. If you find the real cause (so that you do not have to change git.core.filemode to false) let me know and i may update git support so it is handled more elegantly.
Comment 14 earnie 2017-12-20 22:12:57 UTC
I know this is old but I want to state for others looking for the solutions to resolve this issue.  This has nothing to do with Cygwin that I can find.  The Cygwin version of git doesn't have an issue with the file mode.  This has to do with the way Windows returns the stat information to the calling application based on many factors.  The only means I've found is to set the filemode property to false to prevent the identified change.  Below instruction is based on version 8.2.

To change the configuration for a repository:
Right click the project->
Find the Git item and hover over it->
Hover over the Repository item->
Left click the Open Configuration item->
Find the filemode = true under the [core] tag and change true to false->
Save the file.

To set this in the global file so new projects take on the property:
Left click the Team item in the top menu->
Hover over the git item (if it exists*)->
Left click the Open Global Configuration->
Add the following and save the file.

[core]
        filemode = false



* Depending on the active file the Team menu changes so you may see the Open Global Configuration at the top level of the Team menu.  Other times you'll see a list of VCS vendors and you have to hover over the Git item to see the Open Global Configuration menu item.