diff options
author | Johan Herland <johan@herland.net> | 2012-03-15 15:58:56 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-03-15 11:13:23 -0700 |
commit | dabba590aa0e94a8deb6f0e827144697895bcfe8 (patch) | |
tree | 2c98626bec1eccc7dea3de3a0d216739b861d08b /builtin/cat-file.c | |
parent | notes-merge: use opendir/readdir instead of using read_directory() (diff) | |
download | tgif-dabba590aa0e94a8deb6f0e827144697895bcfe8.tar.xz |
notes-merge: Don't remove .git/NOTES_MERGE_WORKTREE; it may be the user's cwd
When a manual notes merge is committed or aborted, we need to remove the
temporary worktree at .git/NOTES_MERGE_WORKTREE. However, removing the
entire directory is not good if the user ran the 'git notes merge
--commit/--abort' from within that directory. On Windows, the directory
removal would simply fail, while on POSIX systems, users would suddenly
find themselves in an invalid current directory.
Therefore, instead of deleting the entire directory, we delete everything
_within_ the directory, and leave the (empty) directory in place.
This would cause a subsequent notes merge to abort, complaining about a
previous - unfinished - notes merge (due to the presence of
.git/NOTES_MERGE_WORKTREE), so we also need to adjust this check to only
trigger when .git/NOTES_MERGE_WORKTREE is non-empty.
Finally, adjust the t3310 manual notes merge testcases to correctly handle
the existence of an empty .git/NOTES_MERGE_WORKTREE directory.
Inspired-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/cat-file.c')
0 files changed, 0 insertions, 0 deletions