Skip to content

Commit 89b9e31

Browse files
tmzullingergitster
authored andcommitted
notes: send "Automatic notes merge failed" messages to stderr
All other error messages from notes use stderr. Do the same when alerting users of an unresolved notes merge. Fix the output redirection in t3310 and t3320 as well. Previously, the tests directed output to a file, but stderr was either not captured or not sent to the file due to the order of the redirection operators. Signed-off-by: Todd Zullinger <[email protected]> Acked-by: Johan Herland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9752ad0 commit 89b9e31

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

builtin/notes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,10 +862,10 @@ static int merge(int argc, const char **argv, const char *prefix)
862862
if (create_symref("NOTES_MERGE_REF", default_notes_ref(), NULL))
863863
die(_("failed to store link to current notes ref (%s)"),
864864
default_notes_ref());
865-
printf(_("Automatic notes merge failed. Fix conflicts in %s and "
866-
"commit the result with 'git notes merge --commit', or "
867-
"abort the merge with 'git notes merge --abort'.\n"),
868-
git_path(NOTES_MERGE_WORKTREE));
865+
fprintf(stderr, _("Automatic notes merge failed. Fix conflicts in %s "
866+
"and commit the result with 'git notes merge --commit', "
867+
"or abort the merge with 'git notes merge --abort'.\n"),
868+
git_path(NOTES_MERGE_WORKTREE));
869869
}
870870

871871
free_notes(t);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ git rev-parse refs/notes/z > pre_merge_z
176176
test_expect_success 'merge z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
177177
git update-ref refs/notes/m refs/notes/y &&
178178
git config core.notesRef refs/notes/m &&
179-
test_must_fail git notes merge z >output &&
179+
test_must_fail git notes merge z >output 2>&1 &&
180180
# Output should point to where to resolve conflicts
181181
test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
182182
# Inspect merge conflicts
@@ -379,7 +379,7 @@ git rev-parse refs/notes/z > pre_merge_z
379379
test_expect_success 'redo merge of z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
380380
git update-ref refs/notes/m refs/notes/y &&
381381
git config core.notesRef refs/notes/m &&
382-
test_must_fail git notes merge z >output &&
382+
test_must_fail git notes merge z >output 2>&1 &&
383383
# Output should point to where to resolve conflicts
384384
test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
385385
# Inspect merge conflicts
@@ -413,7 +413,7 @@ git rev-parse refs/notes/y > pre_merge_y
413413
git rev-parse refs/notes/z > pre_merge_z
414414

415415
test_expect_success 'redo merge of z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
416-
test_must_fail git notes merge z >output &&
416+
test_must_fail git notes merge z >output 2>&1 &&
417417
# Output should point to where to resolve conflicts
418418
test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
419419
# Inspect merge conflicts
@@ -494,7 +494,7 @@ cp expect_log_y expect_log_m
494494

495495
test_expect_success 'redo merge of z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
496496
git update-ref refs/notes/m refs/notes/y &&
497-
test_must_fail git notes merge z >output &&
497+
test_must_fail git notes merge z >output 2>&1 &&
498498
# Output should point to where to resolve conflicts
499499
test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
500500
# Inspect merge conflicts

t/t3320-notes-merge-worktrees.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '
6161
(
6262
cd worktree2 &&
6363
git config core.notesRef refs/notes/x &&
64-
test_must_fail git notes merge z 2>&1 >out &&
64+
test_must_fail git notes merge z >out 2>&1 &&
6565
test_i18ngrep "Automatic notes merge failed" out &&
6666
grep -v "A notes merge into refs/notes/x is already in-progress in" out
6767
) &&

0 commit comments

Comments
 (0)