I recently installed Git version 2.7.2.windows.1 (I am running Windows 7 64-bit). Since the update, I have been unable to run `git add` with the `-p` option on files within a certain directory (or its subdirectories) whose name is `_` (an underscore).
`git status` correctly reports that my file has changes:
PS C:\Users\Carl\www\dl> git status
On branch develop
Your branch is up-to-date with 'origin/develop'.
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: _/php/class.Menu.php
And I can add the entire file with a simple `git add`, or by specifying the file by name. But if I try to include the `-p` or `--patch` option (both variations produce the same results), Git reports that there are no changes:
PS C:\Users\Carl\www\dl> git add -p .\_\php\class.Menu.php
No changes.This only happens for files within the `_` directory, but it doesn't matter whether I `cd` into that directory to run the `git add` command without having to explicitly specify a path with an underscore in it; it still doesn't work:
PS C:\Users\Carl\www\dl\_\php> git add -p .\class.Menu.php
No changes.I also tried various directory names with underscores in them. This issue occurs consistently if the updated file is in directory whose name contains only underscores (or in a subdirectory of such a directory), but not if there are other characters in the directory name. I believe underscores are valid in file/directory names. Additionally, I am not the owner of the project so I cannot rename the directory or move the file. My collaborators mostly use OSX and do not have this issue with their versions of Git.
As I normally use Git Bash, I had initially thought this problem was related to Posix path conversion in MinGW, but it occurs whether I use Git Bash, Windows PowerShell, or cmd.exe.