Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » egit shows ">" on all files in newly cloned project
egit shows ">" on all files in newly cloned project [message #1759903] Wed, 19 April 2017 17:45 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
I just cloned a repo to my desktop containing files I just pushed to our bitbucket server. I added that as a local repo. I created a Gradle project from an existing project, pointing to the repo. The project imported and built fine, but I noticed that all the files in the Package Explorer have the ">" hint, which I believe indicates that git thinks that file has changed. I tried comparing specific files with HEAD in egit, and it showed no differences. I ran "git diff" from the shell in the project, and it showed nothing. Similarly, "git status" in the shell showed nothing of import.

Note that my laptop is Win7, and the bitbucket server is likely Linux. I have "core.autocrlf" set to "true" in my .gitconfig.
Re: egit shows ">" on all files in newly cloned project [message #1760006 is a reply to message #1759903] Fri, 21 April 2017 07:10 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
can you once try the clone and import with core.autocrlf set to false

Ciao
Chris
Re: egit shows ">" on all files in newly cloned project [message #1760064 is a reply to message #1760006] Fri, 21 April 2017 15:22 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
Before I do that, can you explain why you want me to try that? The documentation makes it pretty clear this should be set to true on Windows.
Re: egit shows ">" on all files in newly cloned project [message #1760085 is a reply to message #1760064] Sat, 22 April 2017 06:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 28978
Registered: July 2009
Senior Member
I assume the suggestion focuses on the issue of the bogus changes that aren't changes. The most common (perhaps only) reason for this is related to line endings. Two things might go wrong with line endings. Someone on a Windows machine might commit files to the repo with Window's line endings, but the files in the repo should always use Linux conventions.

An easier approach to try out is to open a given text file that shows bogus changes, and enable Window -> Preferences -> Generator -> Text Editors -> Show whitespace characters. Now you can see the line feed convention of the file, and when you open the compare editor it usually (but not always) shows the line feed conventions on the left and the right side. You can also use File -> Convert Line Delimiters To -> to convert between the two different conventions and see if of the the two makes the file not dirty.
Re: egit shows ">" on all files in newly cloned project [message #1760114 is a reply to message #1760085] Sat, 22 April 2017 23:46 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
"Generator"? What is that? There is "General", is that what you meant? In that hierarchy, there is "Editors"->"Text Editors", which has a "show whitespace characters", which I just turned on. When I did that, it definitely showed additional information in the compare view, but it still didn't indicate there were any differences, even with the additional whitespace markers. Both the local file and the repo file had line endings showing two icons, one a sort of a box with extra dots on the corners of the box, followed by a paragraph icon.

This codebase in the repo was actually pushed by me on my Win7 laptop, from a codebase originally checked out from a SVN repository.
Re: egit shows ">" on all files in newly cloned project [message #1760164 is a reply to message #1760064] Mon, 24 April 2017 07:11 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
I suggested that you try out once with core.autocrlf=false because that speeds up the search for the bug. I just want to filter out some other reasons for the sympton. I core.autocrlf=false doesn't show the bug and core.autocrlf=true shows the bug there are lot less places to debug.

Ciao
Chris
Re: egit shows ">" on all files in newly cloned project [message #1760211 is a reply to message #1760164] Mon, 24 April 2017 15:15 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
Got it. Just so it's clear, I asked for that clarification because I had no idea what your role was. I often see all sorts of random suggestions posted for issues.
Re: egit shows ">" on all files in newly cloned project [message #1760302 is a reply to message #1760211] Tue, 25 April 2017 15:48 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
I tried changing autocrlf to false, recloning, and reimporting. Same result.

Also note that when I do a "git diff" from the shell in the repo, it shows no output.
Re: egit shows ">" on all files in newly cloned project [message #1760344 is a reply to message #1760302] Wed, 26 April 2017 07:57 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
That's odd. I was sure you see a bug in JGit regardings the core.autocrlf handling. But if this happens also with core.autocrlf == false this must be a complete new problem.



Ciao
Chris
Re: egit shows ">" on all files in newly cloned project [message #1760413 is a reply to message #1760344] Wed, 26 April 2017 20:31 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
Hmm, I tried doing this again slightly differently, and now it's behaving "properly", so perhaps recloning with "autocrlf=false" made it not get confused.

The first time, I set the flag and cloned the repo outside of eclipse, then added the repo in Eclipse and imported the project. The second time I did it entirely within Eclipse.
Re: egit shows ">" on all files in newly cloned project [message #1760435 is a reply to message #1760413] Thu, 27 April 2017 07:39 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
In order to reproduce this problem I suggest we work with commandline and jgit first. You need to download jgit command line and have git for windows installed so you have a bash and can execute this script. Please replace the urls with the url of your repo. What's the output on your side?

> git clone -n https://github.com/chalstrick/test_crlf test_crlf_auto
Cloning into 'test_crlf_auto'...
remote: Counting objects: 14, done.
remote: Total 14 (delta 0), reused 0 (delta 0), pack-reused 14
Unpacking objects: 100% (14/14), done.
> git clone -n https://github.com/chalstrick/test_crlf test_crlf_noAuto
Cloning into 'test_crlf_noAuto'...
remote: Counting objects: 14, done.
remote: Total 14 (delta 0), reused 0 (delta 0), pack-reused 14
Unpacking objects: 100% (14/14), done.
> git -C test_crlf_auto config core.autocrlf true
> git -C test_crlf_noAuto config core.autocrlf false
> cd test_crlf_auto/
> jgit.sh checkout master
Already on 'master'
> jgit.sh diff
> cd ../test_crlf_noAuto/
> jgit.sh checkout master
Already on 'master'
> jgit.sh diff


Ciao
Chris
Re: egit shows ">" on all files in newly cloned project [message #1760480 is a reply to message #1760435] Thu, 27 April 2017 15:52 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
With some minor elisions, here is the same output on my box:
% git clone -n ssh://git@fqhn:7999/st_usl/estimator.git test_crlf_auto
Cloning into 'test_crlf_auto'...
remote: Counting objects: 271, done.        
remote: Compressing objects: 100% (230/230), done.        
remote: Total 271 (delta 103), reused 117 (delta 16)        
Receiving objects: 100% (271/271), 714.06 KiB | 308.00 KiB/s, done.
Resolving deltas: 100% (103/103), done.
Checking connectivity... done.
% git clone -n ssh://git@fqhn:7999/st_usl/estimator.git test_crlf_noAuto
Cloning into 'test_crlf_noAuto'...
remote: Counting objects: 271, done.        
remote: Compressing objects: 100% (230/230), done.        
remote: Total 271 (delta 103), reused 117 (delta 16)        
Receiving objects: 100% (271/271), 714.06 KiB | 342.00 KiB/s, done.
Resolving deltas: 100% (103/103), done.
Checking connectivity... done.
% git -C test_crlf_auto config core.autocrlf true
% git -C test_crlf_noAuto config core.autocrlf false
% cd test_crlf_auto/
% ~/Downloads/org.eclipse.jgit.pgm-4.7.0.201704051617-r.sh checkout master
Already on 'master'
% ~/Downloads/org.eclipse.jgit.pgm-4.7.0.201704051617-r.sh diff | cat
diff --git a/.project b/.project
old mode 100755
new mode 100644
diff --git a/EstimatingApp.xlsx b/EstimatingApp.xlsx
old mode 100755
new mode 100644
Binary files differ
diff --git a/build.gradle b/build.gradle
old mode 100755
new mode 100644
...
% cd ../test_crlf_noAuto/
% ~/Downloads/org.eclipse.jgit.pgm-4.7.0.201704051617-r.sh checkout master
Already on 'master'
% ~/Downloads/org.eclipse.jgit.pgm-4.7.0.201704051617-r.sh diff | cat
diff --git a/.project b/.project
old mode 100755
new mode 100644
diff --git a/EstimatingApp.xlsx b/EstimatingApp.xlsx
old mode 100755
new mode 100644
Binary files differ
diff --git a/build.gradle b/build.gradle
old mode 100755
new mode 100644
...
% 


The diffs with or without autocrlf show every file has had its mode changed. I've shortened the diff output, but it does appear that the same mode change was done on every file.
Re: egit shows ">" on all files in newly cloned project [message #1761223 is a reply to message #1760480] Tue, 09 May 2017 08:27 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
Why do you have diffs on the filemode? On a windows system the modes are or supported by the filesystem and usually the global git config contains core.filemode=false to express this. Can you tell me what 'git config core.filemode' tells you. What happens if you do a 'git config --global core.filemode false' and then execute the script again.

Ciao
Chris
Re: egit shows ">" on all files in newly cloned project [message #1761332 is a reply to message #1761223] Tue, 09 May 2017 18:28 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
Before I run the script, I note that on the repo that I originally had this problem with, filemode is "false". The other repo instance that I cloned from this is "true", and the project I imported from that repo doesn't have the problem. It's been a while since I've looked at this, but I'll prepare to run that script again, but it appears the disconnect is due to that "filemode" flag, not the "autocrlf" one.
Re: egit shows ">" on all files in newly cloned project [message #1761338 is a reply to message #1761332] Tue, 09 May 2017 19:24 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
David M. Karr wrote on Tue, 09 May 2017 11:28
Before I run the script, I note that on the repo that I originally had this problem with, filemode is "false". The other repo instance that I cloned from this is "true", and the project I imported from that repo doesn't have the problem. It's been a while since I've looked at this, but I'll prepare to run that script again, but it appears the disconnect is due to that "filemode" flag, not the "autocrlf" one.


Correction, I had these reversed. The original repo had filemode = true.

I've verified with the script that in the repo with filemode = true, I get the "old mode 100755 new mode 100644" on every file, and I get no differences in the repo with filemode = false.

I get the impression that filemode should be true in general, so what might be happening here that is causing this disconnect? Is our git server configured in an unconventional way?
Re: egit shows ">" on all files in newly cloned project [message #1761349 is a reply to message #1761338] Wed, 10 May 2017 06:46 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
All the configuration parameters we are talking about (core.filemode, core.autocrlf) are relevant on the client, on that machine on which you execute the clone command. Such configuration doesn't depend on how your git server is configured. This core.filemode parameter is also not affected by the content of the repository. So we are talking only about the configuration of git on your windows laptop.

I think core.filemode has to be set to false on a windows machine and filesystem (see https://git-scm.com/docs/git-config#git-config-corefileMode) at least when you work with jgit. native git and jgit should automatically probe your filesystem during a clone or init whether it supports executable bits or not and sets the core.filemode parameter in the cloned repository automatically. If this is not happening then we may have found the reason for the bug. What happens if you clone with jgit and afterwards inspect the config
git config --global core.filemode
jgit clone -n https://github.com/chalstrick/test_crlf
cat test_crlf/.git/config






Ciao
Chris
Re: egit shows ">" on all files in newly cloned project [message #1761420 is a reply to message #1761349] Wed, 10 May 2017 21:15 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
I'll try that. I do believe that my typical practice is to clone from the command line, and then add the repo in eclipse and import projects. I rarely clone from within eclipse, as I did with this repo.
Re: egit shows ">" on all files in newly cloned project [message #1761421 is a reply to message #1761420] Wed, 10 May 2017 21:26 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
Here's the output from that.
% git config --global core.filemode
% jgit clone -n ssh://git@.../estimator.git withjgit
Cloning into 'withjgit'...
remote: Counting objects: 279
remote: Compressing objects: 100% (237/237)
Receiving objects:      100% (279/279)
Resolving deltas:       100% (104/104)
Updating references:    100% (1/1)
warning: You appear to have cloned an empty repository.

% cat withjgit/.git/config 
[core]
	symlinks = false
	repositoryformatversion = 0
	filemode = false
	logallrefupdates = true
[remote "origin"]
	url = ssh://git@.../estimator.git
	fetch = +refs/heads/*:refs/remotes/origin/*


Note the result from the first command is empty. I wasn't inside a repo at that point in time, if that makes any difference.

I also ran the same script using "git" instead of "jgit", and the resulting filemode is "true". Note that my "git" is from Cygwin.
Re: egit shows ">" on all files in newly cloned project [message #1761442 is a reply to message #1761421] Thu, 11 May 2017 08:56 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
Ok, I guess we have an explanation and a fix/workaround now.

If you work on windows with native git in a cygwin environment then the git executables believe that they can support the executable bit. They probe the filesystem after cloning, think that the current filesystem supports executable bits and set filemode true.

But thats only the case when you use cygwin. When you work with the official git for windows from git-scm.com it is detected that filemodes are not supported on Windows with a windows filesystem. See this
C:\Temp>git --version
git version 2.11.0.windows.1

C:\Temp>git clone https://github.com/chalstrick/test_crlf.git
Cloning into 'test_crlf'...
remote: Counting objects: 14, done.
remote: Total 14 (delta 0), reused 0 (delta 0), pack-reused 14
Unpacking objects: 100% (14/14), done.

C:\Temp>type test_crlf\.git\config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = https://github.com/chalstrick/test_crlf.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master


Not only the official git tooling for windows but also JGit is that opinion.

That explains the problem: You clone with msysgit and then you work with native-git/JGit.

Solution:
- also clone with JGit or with git for windows.
- or set core.filemode=false in your global config.
- or set core.filemode=false once in the repo after you cloned.


Ciao
Chris
Re: egit shows ">" on all files in newly cloned project [message #1761913 is a reply to message #1761442] Thu, 11 May 2017 18:07 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 530
Registered: July 2009
Senior Member
Christian Halstrick wrote on Thu, 11 May 2017 01:56
Ok, I guess we have an explanation and a fix/workaround now.

If you work on windows with native git in a cygwin environment then the git executables believe that they can support the executable bit. They probe the filesystem after cloning, think that the current filesystem supports executable bits and set filemode true.

But thats only the case when you use cygwin. When you work with the official git for windows from git-scm.com it is detected that filemodes are not supported on Windows with a windows filesystem. See this
C:\Temp>git --version
git version 2.11.0.windows.1

C:\Temp>git clone https://github.com/chalstrick/test_crlf.git
Cloning into 'test_crlf'...
remote: Counting objects: 14, done.
remote: Total 14 (delta 0), reused 0 (delta 0), pack-reused 14
Unpacking objects: 100% (14/14), done.

C:\Temp>type test_crlf\.git\config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = https://github.com/chalstrick/test_crlf.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master


Not only the official git tooling for windows but also JGit is that opinion.

That explains the problem: You clone with msysgit and then you work with native-git/JGit.

Solution:
- also clone with JGit or with git for windows.
- or set core.filemode=false in your global config.
- or set core.filemode=false once in the repo after you cloned.


I understand the explanation and the info shown in that code sample. I'm a bit confused by your conclusion and the workarounds.

From what I can tell, my workaround at this point is always to clone with cygwin git, and not to change the filemode setting from true to false, or to clone without checkout with jgit or eclipse (can I even do that in eclipse?), then set filemode to true, and then checkout.
Re: egit shows ">" on all files in newly cloned project [message #1763122 is a reply to message #1761913] Fri, 12 May 2017 08:08 Go to previous message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
In the end filemode has to be "false". That's all we want to achieve. On a windows based filesystem file modes are not supported and we have to tell that to git. git for windows and jgit achieve this goal by setting core.filemode to false in the repo-config directly after clone or init.

My fixes/workaround tell ways how to achieve that. Either clone with Eclipse/EGit/JGit or with git for windows or set the core.filemode explicitly in the config (either global or repo config) . From all the different ways I currently see only one way which is broken: clone/init with cygwin git and later work with any non-cygwin based tool like JGit or git for windows.





Ciao
Chris
Previous Topic:Unauthorized 401 when trying to clone
Next Topic:slowness in egit after recent upgrade
Goto Forum:
  


Current Time: Fri Nov 24 09:39:57 GMT 2017

Powered by FUDForum. Page generated in 0.02446 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software