summaryrefslogtreecommitdiff
path: root/t/t3310-notes-merge-manual-resolve.sh
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2012-03-15 14:58:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-03-15 18:13:23 (GMT)
commitdabba590aa0e94a8deb6f0e827144697895bcfe8 (patch)
tree2c98626bec1eccc7dea3de3a0d216739b861d08b /t/t3310-notes-merge-manual-resolve.sh
parenta0be62c100897573ef1575ec0d5e8b215e9dcafe (diff)
downloadgit-dabba590aa0e94a8deb6f0e827144697895bcfe8.zip
git-dabba590aa0e94a8deb6f0e827144697895bcfe8.tar.gz
git-dabba590aa0e94a8deb6f0e827144697895bcfe8.tar.bz2
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 't/t3310-notes-merge-manual-resolve.sh')
-rwxr-xr-xt/t3310-notes-merge-manual-resolve.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh
index d6d6ac6..195bb97 100755
--- a/t/t3310-notes-merge-manual-resolve.sh
+++ b/t/t3310-notes-merge-manual-resolve.sh
@@ -324,7 +324,7 @@ y and z notes on 4th commit
EOF
git notes merge --commit &&
# No .git/NOTES_MERGE_* files left
- test_must_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
+ test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
test_cmp /dev/null output &&
# Merge commit has pre-merge y and pre-merge z as parents
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
@@ -386,7 +386,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol
test_expect_success 'abort notes merge' '
git notes merge --abort &&
# No .git/NOTES_MERGE_* files left
- test_must_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
+ test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
test_cmp /dev/null output &&
# m has not moved (still == y)
test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" &&
@@ -453,7 +453,7 @@ EOF
# Finalize merge
git notes merge --commit &&
# No .git/NOTES_MERGE_* files left
- test_must_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
+ test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
test_cmp /dev/null output &&
# Merge commit has pre-merge y and pre-merge z as parents
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
@@ -542,7 +542,7 @@ EOF
test_expect_success 'resolve situation by aborting the notes merge' '
git notes merge --abort &&
# No .git/NOTES_MERGE_* files left
- test_must_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
+ test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
test_cmp /dev/null output &&
# m has not moved (still == w)
test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&