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>

Johan Herland committed Mar 12, 2012 at 15:57 UTC 01bfec8e52dcfa2da47b54b3c89c3181ae09b9a9
1 file changed +19
t/t3310-notes-merge-manual-resolve.sh
+19
@@ -553,4 +553,23 @@ test_expect_success 'resolve situation by aborting the notes merge' '
553 verify_notes z
554 '
555
556 +cat >expect_notes <<EOF
557 +foo
558 +bar
559 +EOF
560 +
561 +test_expect_failure 'switch cwd before committing notes merge' '
562 + git notes add -m foo HEAD &&
563 + git notes --ref=other add -m bar HEAD &&
564 + test_must_fail git notes merge refs/notes/other &&
565 + (
566 + cd .git/NOTES_MERGE_WORKTREE &&
567 + echo "foo" > $(git rev-parse HEAD) &&
568 + echo "bar" >> $(git rev-parse HEAD) &&
569 + git notes merge --commit
570 + ) &&
571 + git notes show HEAD > actual_notes &&
572 + test_cmp expect_notes actual_notes
573 +'
574 +
575 test_done