git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Bug report: can't use git add with --patch option in "_" directory

From
CFCarl Fink <cafink@gmail.com>
Date
Mar 9, 2016, 15:48 UTC
Message-ID
<CAHQDUVeqzKoxd=Us2KagXmcutpos737+Z6ZSiV4Z70LKrn4LcQ@mail.gmail.com>

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.

Message 1 of 1 in “Bug report: can't use git add with --patch option in "_" directory”
  1. Carl FinkMar 9, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.