sequencer: print autostash messages to stderr

The rebase messages are printed to stderr traditionally. However due to a bug introduced in 587947750bd (rebase: implement --[no-]autostash and rebase.autostash, 2013-05-12) which was faithfully copied when reimplementing parts of the interactive rebase in the sequencer the autostash messages are printed to stdout instead. It is time to fix that: let's print the autostash messages to stderr instead of stdout. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jun 19, 2017 at 18:56 UTC cdb866b30bd862527de597ae9c7fe7540de55bf2
2 files changed +8 -7
git-rebase.sh
+2 -2
@@ -165,14 +165,14 @@ apply_autostash () {
165 stash_sha1=$(cat "$state_dir/autostash")
166 if git stash apply $stash_sha1 2>&1 >/dev/null
167 then
168 - echo "$(gettext 'Applied autostash.')"
168 + echo "$(gettext 'Applied autostash.')" >&2
169 else
170 git stash store -m "autostash" -q $stash_sha1 ||
171 die "$(eval_gettext "Cannot store \$stash_sha1")"
172 gettext 'Applying autostash resulted in conflicts.
173 Your changes are safe in the stash.
174 You can run "git stash pop" or "git stash drop" at any time.
175 -'
175 +' >&2
176 fi
177 fi
178 }
sequencer.c
+6 -5
@@ -1904,7 +1904,7 @@ static int apply_autostash(struct replay_opts *opts)
1904 argv_array_push(&child.args, "apply");
1905 argv_array_push(&child.args, stash_sha1.buf);
1906 if (!run_command(&child))
1907 - printf(_("Applied autostash.\n"));
1907 + fprintf(stderr, _("Applied autostash.\n"));
1908 else {
1909 struct child_process store = CHILD_PROCESS_INIT;
1910
@@ -1918,10 +1918,11 @@ static int apply_autostash(struct replay_opts *opts)
1918 if (run_command(&store))
1919 ret = error(_("cannot store %s"), stash_sha1.buf);
1920 else
1921 - printf(_("Applying autostash resulted in conflicts.\n"
1922 - "Your changes are safe in the stash.\n"
1923 - "You can run \"git stash pop\" or"
1924 - " \"git stash drop\" at any time.\n"));
1921 + fprintf(stderr,
1922 + _("Applying autostash resulted in conflicts.\n"
1923 + "Your changes are safe in the stash.\n"
1924 + "You can run \"git stash pop\" or"
1925 + " \"git stash drop\" at any time.\n"));
1926 }
1927
1928 strbuf_release(&stash_sha1);