-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git status returns different results when core.fscache enabled #679
Comments
@latkin gitignore is only for untracked files. Use The behavior with |
I will be on my merry way, but it does seem like something to investigate that fscache true/false changes results here. FWIW I agree the fscache=true result seems more accurate in this case. |
Poked around a bit and see where the root cause is (but not how to fix it). For whatever reason, If you look up such a file by full path with If you instead enumerate files in a directory via There is also a non-hidden file that's created, matching the filename before the |
Alright, finally have real clarity. Git for windows doesn't currently handle Alternate File Streams correctly, this issue is simply a compilcation due to that. File paths in Windows can't truly contain a As mentioned above, if you call APIs like Without being too expert on mingw or git internals, it seems to me like it would make sense for the various I'm happy to provide such a patch if this sounds right. |
We already disallow tracking such illegal file names in Git for Windows, so I do not really see why we need to care all that much: you are talking about untracked files which are completely uninteresting to Git until the time when they are staged. Please read this as my vote to close this ticket as WONTFIX. |
I think the original problem is that the 'file with colon' is already in the repo he is trying to use - see the original
However, he has an existing workaround, which isn't great but works, so it may be useful if it's possible to give @latkin a pointer as to if his line of reasoning as to a suggested 'fix' (to the particular problem of ignoring those colon-files under |
@PhilipOakley yes, that's correct - the issue is mysterious/confusing behavior for unsuspecting Windows users when working with repos of unix origin. I'm not concerned with malicious/determined Windows users who are deliberately trying to do bogus stuff. Consider this toy repo: https://github.com/latkin/filetest It contains 3 files: If you clone that repo today on Windows, the clone succeeds and no errors are reported. However there are problems:
This is very confusing and unintuitive. Expected experience is to simply report all 3 files as having invalid paths. I've sent a proposal PR which is very tiny and fixes this for the 99% case - it simply blocks checkout of files with |
----- Original Message ----- @PhilipOakley yes, that's correct - the issue is mysterious/confusing behavior for unsuspecting Windows users when working with repos of unix origin. I'm not concerned with malicious/determined Windows users who are deliberately trying to do bogus stuff. Consider this toy repo: https://github.com/latkin/filetest It contains 3 files: foo:bar1, foo:bar2, and foo:bar3. If you clone that repo today on Windows, the clone succeeds and no errors are reported. However there are problems:
This is very confusing and unintuitive. Expected experience is to simply report all 3 files as having invalid paths. I've sent a proposal PR which is very tiny and fixes this for the 99% case - it simply blocks checkout of files with : in the name. Malicious windows users can still screw with things by deliberately creating alternate streams, but that's probably not worth worrying about. I think the commit message is missing the original "why" explanation that in the wild, in mixed communities, G4W should be able to cope with repositories where files-with-colons are already present. The commit message should also cover the "how to use it" after the fix - does it still require a local gitignore to be set?, and confirm the patch fixes the core.fscache=true issue (and it still works when false). Finally, as an aside, have you considered the sparse checkout options to mark those files as --assume-unchanged, so they can be in the index, but not in the file system (most descriptions on the web get that option wrong - it's actually about personal FS 'memory' management). If you amend the commit message you can force push the commit to github and re-use the existing PR - this keeps the thread together. If some of the confirmatory points don't need to be in the main part of the commit, then stick them after a three dashes line.Philip |
ref git-for-windows#679 Windows disallows the colon `:` character in file names. However many win32 file APIs allow path specifications of the form `<file path>:<stuff>` when reading or writing files. These are interpreted as pointing to the *alternate data stream* named `<stuff>` within the `<file path>` file. Documentation on alternate data streams: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364404(v=vs.85).aspx Git for Windows, ignorant of file streams, will incorrectly map a Unix file named like `foo:bar` into the `bar` alternate stream of a file `foo`. This results in an unexpected file `foo` with size 0 in the working tree, and (depending on core.fscache setting), the expected "foo:bar" file being flagged as deleted (or maybe not). It would be preferrable if Git for Windows detected such files and issued errors, similar to how it does for various other invalid path situations. This would help reduce pain and make things less confusing for those working in a mixed Unix/Windows team. This change adds a check for ':' so that we never accidentally unpack a file into an alternate stream by accident. Any file path with a ':' is considered invalid, which is perfectly sensible for the purposes of git. If such a file is indeed detected and blocked, users can instruct git to totally ignore it via `git update-index --assume-unchanged`, just like they need to today for other invalid path situations. NB - a determined Windows user can still confuse the system in certain ways by explicitly creating alternate streams, but that requires exceptional user effort and is judged to be not worth pursuing at this time. Signed-off-by: Lincoln Atkinson <lincoln.atkinson@hotmail.com>
Thanks @PhilipOakley, I've amended the commit message and PR comment. The change doesn't fix the underlying inconsistency between standard A full fix would require changes to a bunch of |
I am experiencing a similar problem when using sparse checkout. Is it the same or should I open a new issue?
I checkout a branch. Running Does this sound like the same problem? edit: Sorry, after reading through the comments it seems obvious that this doesn't have the same root cause. Not sure why I posted this here. Opened a new issue #811 |
Same here when checking out cBioPortal on Windows. |
So in case anybody wondered why I did not do anything about this ticket yet: you can thank the people who gave me the thumbs down on a wontfix, without spending any time nor effort to work toward a real fix. That was a real demotivator. The real fix may actually be a fallout of something I try to work on, but do not get the time: it would appear that accessing paths via the The major holdup in that endeavor is that the current |
Something to keep in mind though is that even if git does successfully create "foo:bar" (using "\?" or whatever), you're still likely to have problems if the other tools in your tool chain don't support them too. I'm thinking here about your compiler, editor, make/build scripts, and etc. It may be better to spend the time educating the Mac folks. |
Right. I still want to support
I do not believe that will work. |
Just wanted to say this appears to still be an issue. I was going through my usual "I know how to solve git problems" troubleshooting (ahem rm -rf and reclone) but it persisted. I could not reproduce it on my linux vm doing the same "troubleshooting", just to make sure I wasn't crazy. Went to update git-for-windows and found a new build cut just 3 hours ago and am still encountering this. It would be nice if there is not a long term fix to add something which detects and warns users of this behavior. I realize it's not strictly gits "job" to warn users like this, but it's certainly unexpected behavior for most users. Thanks! I do really like the availability of git-for-windows, it certainly helps my workflow out. $ git --version |
@h110hawk Would you have any spare time to help with curating this issue? Even if it is just nailing down a specific aspect of the issue to allow the multiple views to be cross-compared. A 'good' solution is better than one that only resolves the issue(s) for half the users. The Windows compatibility (relative to Linux expectations) is part of the problem. |
In the meantime, I performed some testing and it seems that the performance benefits I have come to expect did not materialize. Worse, since Git for Windows typically works on relative paths, switching to longpaths=true would impact performance negatively. Coming back to the reported problem, I would tend to mark this as a "Known Issue". And the underlying issue is not that |
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses git-for-windows#679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses git-for-windows#679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses #679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses #679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In the next version, |
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses #679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses #679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses #679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses #679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This topic branch refuses to create files with reserved file names, such as `aux.c` or `nul.txt`. This addresses #679. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
or closed issue
matching what I'm seeing
Setup
Win10, x64
git version 2.6.3.windows.1
Default install as far as I recall
Problem repros in all shells
Details
foo:bar
file has invalid Windows filename. It is copied as size-0 filefoo
.foo
to gitignorecore.fscache
false, working directory is shown as clean bygit status
core.fscache
true, filefoo:bar
is flagged withdeleted
status.Expected: Working directory status is reported the same with/without
core.fscache
, in all cases.Motivation: I work on windows but most of my team is on OSX. They put files named like
foo:bar
in the repo. I can happily ignore them with a privategitignore
whencore.fscache
is turned off, but they pollute my working directory when I try to usecore.fscache true
(which I'd like to do for perf reasons).The text was updated successfully, but these errors were encountered: