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 <tmz@pobox.com> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Todd Zullinger committed
Nov 14, 2017 at 11:17 UTC
89b9e31dd56705af01da2a1a3dc2d466172cb016
3 files changed
+9
-9
builtin/notes.c
+4
-4
@@ -862,10 +862,10 @@ static int merge(int argc, const char **argv, const char *prefix)
862
if (create_symref("NOTES_MERGE_REF", default_notes_ref(), NULL))
863
die(_("failed to store link to current notes ref (%s)"),
864
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));
869
}
870
871
free_notes(t);
t/t3310-notes-merge-manual-resolve.sh
+4
-4
@@ -176,7 +176,7 @@ git rev-parse refs/notes/z > pre_merge_z
176
test_expect_success 'merge z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
177
git update-ref refs/notes/m refs/notes/y &&
178
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 &&
180
# Output should point to where to resolve conflicts
181
test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
182
# Inspect merge conflicts
@@ -379,7 +379,7 @@ git rev-parse refs/notes/z > pre_merge_z
379
test_expect_success 'redo merge of z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
380
git update-ref refs/notes/m refs/notes/y &&
381
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 &&
383
# Output should point to where to resolve conflicts
384
test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
385
# Inspect merge conflicts
@@ -413,7 +413,7 @@ git rev-parse refs/notes/y > pre_merge_y
413
git rev-parse refs/notes/z > pre_merge_z
414
415
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 &&
417
# Output should point to where to resolve conflicts
418
test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
419
# Inspect merge conflicts
@@ -494,7 +494,7 @@ cp expect_log_y expect_log_m
494
495
test_expect_success 'redo merge of z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
496
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 &&
498
# Output should point to where to resolve conflicts
499
test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
500
# Inspect merge conflicts
t/t3320-notes-merge-worktrees.sh
+1
-1
@@ -61,7 +61,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '
61
(
62
cd worktree2 &&
63
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 &&
65
test_i18ngrep "Automatic notes merge failed" out &&
66
grep -v "A notes merge into refs/notes/x is already in-progress in" out
67
) &&