Skip to content

Commit 01bfec8

Browse files
jherlandgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Johan Herland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c844a80 commit 01bfec8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

t/t3310-notes-merge-manual-resolve.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,4 +553,23 @@ test_expect_success 'resolve situation by aborting the notes merge' '
553553
verify_notes z
554554
'
555555

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+
556575
test_done

0 commit comments

Comments
 (0)