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

git-add--interactive works only in top level

From
RBReid Barton <rwbarton@mit.edu>
Date
Dec 4, 2007, 03:19 UTC
Message-ID
<058EB5A2-1EFE-43B9-9886-7272A955CE51@mit.edu>

When the working directory is not the top of the working tree, git- add--interactive fails silently and confusingly. In this example, the working tree is rooted at ~/sandbox/foo and ~/sandbox/foo/bar/x is a file that's been edited.

rwbarton@homothety:~/sandbox/foo/bar$ git-add--interactive
            staged     unstaged path
   1:    unchanged        +1/-0 bar/x
*** Commands ***
   1: status       2: update       3: revert       4: add untracked
   5: patch        6: diff         7: quit         8: help
What now> 5
            staged     unstaged path
   1:    unchanged        +1/-0 bar/x
Patch update> 1
*** Commands ***
   1: status       2: update       3: revert       4: add untracked
   5: patch        6: diff         7: quit         8: help
What now>

Rather than returning to the main menu, git-add--interactive should have showed me a list of chunks. It seems that the list of files is relative to the working tree root (which is sensible) but when git- add--interactive invokes git-diff-files it does not take this into account. Perhaps git-diff-files should also complain when invoked as

git-diff-files -- non-existent-file-name
so it wouldn't have taken me half an hour to track this down.

Regards, Reid Barton

Next: Junio C Hamano
Message 1 of 9 in “git-add--interactive works only in top level”
  1. Reid BartonDec 4, 2007
  2. Junio C HamanoDec 4, 2007
  3. Reid BartonDec 4, 2007
  4. Junio C HamanoDec 4, 2007
  5. Wincent ColaiutaDec 4, 2007
  6. Johannes SchindelinDec 4, 2007
  7. Wincent ColaiutaDec 4, 2007
  8. Jakub NarebskiDec 4, 2007
  9. Junio C HamanoDec 4, 2007

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.