Skip to content

Commit

Permalink
t3310: illustrate failure to "notes merge --commit" inside $GIT_DIR/
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johan Herland authored and Junio C Hamano committed Mar 15, 2012
1 parent c844a80 commit 01bfec8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions t/t3310-notes-merge-manual-resolve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 01bfec8

Please sign in to comment.