summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2012-03-12 15:57:12 +0100
committerJunio C Hamano <gitster@pobox.com>2012-03-15 11:13:23 -0700
commit01bfec8e52dcfa2da47b54b3c89c3181ae09b9a9 (patch)
treeedfc56d3fc5edf56aeb7e1d0deedc17508fbf1f7 /t
parentc844a8035617a602015d74ce329ee88f9b003bf9 (diff)
downloadgit-01bfec8e52dcfa2da47b54b3c89c3181ae09b9a9.tar.gz
t3310: illustrate failure to "notes merge --commit" inside $GIT_DIR/
The 'git notes merge' command expected to be run from the working tree of the project being annotated, and did not anticipate getting run inside $GIT_DIR/. However, because we use $GIT_DIR/NOTES_MERGE_WORKTREE as a temporary working space for the user to work on resolving conflicts, it is not unreasonable for a user to run "git notes merge --commit" there. But the command fails to do so. Found-by: David Bremner <david@tethera.net> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3310-notes-merge-manual-resolve.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh
index 4367197953..0c531c3795 100755
--- a/t/t3310-notes-merge-manual-resolve.sh
+++ b/t/t3310-notes-merge-manual-resolve.sh
@@ -553,4 +553,23 @@ test_expect_success 'resolve situation by aborting the notes merge' '
verify_notes z
'
+cat >expect_notes <<EOF
+foo
+bar
+EOF
+
+test_expect_failure 'switch cwd before committing notes merge' '
+ git notes add -m foo HEAD &&
+ git notes --ref=other add -m bar HEAD &&
+ test_must_fail git notes merge refs/notes/other &&
+ (
+ cd .git/NOTES_MERGE_WORKTREE &&
+ echo "foo" > $(git rev-parse HEAD) &&
+ echo "bar" >> $(git rev-parse HEAD) &&
+ git notes merge --commit
+ ) &&
+ git notes show HEAD > actual_notes &&
+ test_cmp expect_notes actual_notes
+'
+
test_done