Skip to content

Commit dbe7b41

Browse files
dschogitster
authored andcommitted
t3301: fix false negative
In 6956f85 (notes: implement helpers needed for note copying during rewrite, 2010-03-12), we introduced a test case that verifies that the config setting `notes.rewriteRef` can be overridden via the environment variable `GIT_NOTES_REWRITE_REF`. Back when it was introduced, it relied on a side effect of an earlier test case that configured `core.noteRef` to point to `refs/notes/other`. In 908a320 (t3301: modernize style, 2014-11-12), this side effect was removed. The test case *still* passed, but for the wrong reason: we no longer overrode the rewrite ref, but there simply was nothing to rewrite anymore, as the overridden notes ref was "modernized" away. Let's let that test case pass for the correct reason again. To make sure of that, let's change the idea of the original test case: it configured `notes.rewriteRef` to point to the actual notes ref, forced that to be ignored and then verified that the notes were *not* rewritten. By turning that idea upside down (configure the `notes.rewriteRef` to another notes ref, override it via the environment variable to force the notes to be copied, and then verify that the notes *were* rewritten), we make it much harder for that test case to pass for the wrong reason. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aeb582a commit dbe7b41

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

t/t3301-notes.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,9 +1120,10 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
11201120
test_config notes.rewriteMode overwrite &&
11211121
test_config notes.rewriteRef refs/notes/other &&
11221122
echo $(git rev-parse HEAD^) $(git rev-parse HEAD) |
1123-
GIT_NOTES_REWRITE_REF= git notes copy --for-rewrite=foo &&
1123+
GIT_NOTES_REWRITE_REF=refs/notes/commits \
1124+
git notes copy --for-rewrite=foo &&
11241125
git log -1 >actual &&
1125-
test_cmp expect actual
1126+
grep "replacement note 3" actual
11261127
'
11271128

11281129
test_expect_success 'git notes copy diagnoses too many or too few parameters' '

0 commit comments

Comments
 (0)