Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block paths which might be misinterpreted as alternate data streams
ref #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>
- Loading branch information