git-add--interactive works only in top level
- From
- Reid 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