Bug 568562 - Egit automatically duplicates folder names in .gitignore for symbolic links
Summary: Egit automatically duplicates folder names in .gitignore for symbolic links
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: 5.10   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-05 07:48 EST by Ralf Hauser CLA
Modified: 2020-11-27 08:57 EST (History)
3 users (show)

See Also:


Attachments
C:\Users\Ralf Hauser\Documents\20201105b568562gitIgnoreAnnoyingSelfChange.png (21.99 KB, image/png)
2020-11-05 07:54 EST, Ralf Hauser CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Hauser CLA 2020-11-05 07:48:47 EST
if you don't overwrite sometimes even 10 times or more
Comment 1 Ralf Hauser CLA 2020-11-05 07:54:50 EST
Created attachment 284683 [details]
C:\Users\Ralf Hauser\Documents\20201105b568562gitIgnoreAnnoyingSelfChange.png

BTW, the "/classes/" is a symlink
Comment 2 Thomas Wolf CLA 2020-11-05 12:45:20 EST
A bit more context would have been nice. I presume this is about duplicate entries being added to a .gitignore if the referenced path is a symlink?

Now, what is a symlink? The bug report above says this was reported against Windows 10. AFAIK Windows has no symlinks, but other things like junctions and whatnot. So what exactly is this "classes" thing?
Comment 3 Ralf Hauser CLA 2020-11-05 12:50:08 EST
thx for the follow up, it is Debian stable 10

ln -s /etc/tomcat9/common/classes classes
Comment 4 Thomas Wolf CLA 2020-11-05 18:23:51 EST
Good, so at least we don't have to get our hands dirty with Windows specifics :-)

I suspect you have the preference "Team->Git->Projects->Automatically ignore derived resources by adding them to .gitignore" set? And in Eclipse this /classes is marked as derived? (Check via ContextMenu->Properties on the /classes in Eclipse in the package or project explorer.)

Then EGit would try to add this to gitignore if it wasn't ignored already.

Can you confirm the above?

If so, the problem is that EGit treats /classes as a directory when adding it the .gitignore. But the pattern /classes/ doesn't match symlinks; it only matches directories. So the next time this occurs, the same happens again. And again. And again.

/classes/ not matching a symlink is correct; C git appears to do that, too.

I think EGit would need to add two entries, one for the symlink and one for anything underneath if the symlink points to a directory:

  /classes
  /classes/**

Is there a /classes symlink committed in the git repo? (Probably.)

If not, or if there is and you remove that committed symlink from the git repo, and then add the above two patterns: does that solve problem?

Probably EGit should also take care of such a symlink having been committed. For if it is, it will never be ignored, and since it's derived, I suspect EGit will also re-try to add a gitignore entry for it.

(As an aside: with the pattern /classes/ the files in the linked directory would be shown in the package or project explorer as committed -- even if the symlink points outside the git working tree. That's another bug, but it's a display bug only; EGit would commit only the symlink.)
Comment 5 Eclipse Genie CLA 2020-11-07 15:07:10 EST
New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/171938