From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Phillip Wood" <phillip.wood@talktalk.net>,
"Git Mailing List" <git@vger.kernel.org>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Phillip Wood" <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v2 0/3] Add regression tests for rectent rebase -i fixes
Date: Fri, 16 Jun 2017 15:49:49 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1.1706161527140.4200@virtualbox> (raw)
In-Reply-To: <xmqqfuf0ygmu.fsf@gitster.mtv.corp.google.com>
[-- Attachment #1: Type: text/plain, Size: 1950 bytes --]
Hi Junio,
On Thu, 15 Jun 2017, Junio C Hamano wrote:
> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
> index 325ec75353..801bce25da 100755
> --- a/t/t3420-rebase-autostash.sh
> +++ b/t/t3420-rebase-autostash.sh
> @@ -45,7 +45,7 @@ create_expected_success_am() {
> }
>
> create_expected_success_interactive() {
> - cr=$'\r' &&
> + cr=$(echo . | tr '.' '\015') &&
> cat >expected <<-EOF
> $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
> HEAD is now at $(git rev-parse --short feature-branch) third commit
This is still incorrect, as the \r\n (which $(echo . | tr \.\ '\015')
would emit) is interpreted correctly as a line break on Windows, meaning
that cr is now *empty*. Not what we want.
What I did is to replace the `cat` by `q_to_cr` (we have that lovely
function, might just as well use it), replace `${cr}` by `Q` and skip the
cr variable altogether.
Additionally, there is another huge problem: the "Applied autostash." is
printed to stdout, not stderr, in line with how things were done in the
shell version of rebase -i.
While this was just a minor bug previously, now we exercise that bug, by
redirecting stderr to stdout and redirecting stdout to the file `actual`.
Nothing says that stderr should be printed to that file before stdout, but
that is exactly what the test case tries to verify.
There is only one slight problem: in my Git for Windows SDK, stdout is
printed first.
The quick fix would be to redirect stderr and stdout independently.
However, I think it is time for that bug to be fixed: autostash messages
should really go to stderr, just like the rest of them rebase messages.
I attached the patch, together with the two fixups to Phillip's patches,
and a fixup for the autostash-messages-to-stderr patch that I think should
be squashed in but I really ran out of time testing this.
Phillip, would you mind picking those changes up as you deem appropriate?
Ciao,
Dscho
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=0001-sequencer-print-autostash-messages-to-stderr.patch, Size: 1874 bytes --]
From c5a8319f0378d93be5aea05b833bb5e23c9f0b3d Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Fri, 16 Jun 2017 15:34:50 +0200
Subject: [PATCH 1/4] sequencer: print autostash messages to stderr
The rebase messages are printed to stderr traditionally. It was a bug
introduced in 587947750bd (rebase: implement --[no-]autostash and
rebase.autostash, 2013-05-12) and that bug has been faithfully copied
when reimplementing parts of the interactive rebase in the sequencer.
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>
---
sequencer.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index a59408a23a2..8713cc8d1d5 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1923,7 +1923,7 @@ static int apply_autostash(struct replay_opts *opts)
argv_array_push(&child.args, "apply");
argv_array_push(&child.args, stash_sha1.buf);
if (!run_command(&child))
- printf(_("Applied autostash.\n"));
+ fprintf(stderr, _("Applied autostash.\n"));
else {
struct child_process store = CHILD_PROCESS_INIT;
@@ -1937,10 +1937,11 @@ static int apply_autostash(struct replay_opts *opts)
if (run_command(&store))
ret = error(_("cannot store %s"), stash_sha1.buf);
else
- printf(_("Applying autostash resulted in conflicts.\n"
- "Your changes are safe in the stash.\n"
- "You can run \"git stash pop\" or"
- " \"git stash drop\" at any time.\n"));
+ fprintf(stderr,
+ _("Applying autostash resulted in conflicts.\n"
+ "Your changes are safe in the stash.\n"
+ "You can run \"git stash pop\" or"
+ " \"git stash drop\" at any time.\n"));
}
strbuf_release(&stash_sha1);
--
2.12.2.windows.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Type: text/x-diff; name=0002-fixup-rebase-add-regression-tests-for-console-output.patch, Size: 1203 bytes --]
From 3425f7c9bfb62c3d2d4adaff41a664dd4ae2efa9 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Fri, 16 Jun 2017 15:39:20 +0200
Subject: [PATCH 2/4] fixup! rebase: add regression tests for console output
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
t/t3420-rebase-autostash.sh | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 801bce25da4..64904bef069 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -45,12 +45,11 @@ create_expected_success_am() {
}
create_expected_success_interactive() {
- cr=$(echo . | tr '.' '\015') &&
- cat >expected <<-EOF
+ q_to_cr >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
HEAD is now at $(git rev-parse --short feature-branch) third commit
- Rebasing (1/2)${cr}Rebasing (2/2)${cr}Successfully rebased and updated refs/heads/rebased-feature-branch.
- Applied autostash.
+ Rebasing (1/2)QRebasing (2/2)QApplied autostash.
+ Successfully rebased and updated refs/heads/rebased-feature-branch.
EOF
}
--
2.12.2.windows.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: Type: text/x-diff; name=0003-fixup-rebase-add-more-regression-tests-for-console-o.patch, Size: 1361 bytes --]
From e16ad989c85c55bdfcf45fe561911a699e962b44 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Fri, 16 Jun 2017 15:39:35 +0200
Subject: [PATCH 3/4] fixup! rebase: add more regression tests for console
output
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
t/t3420-rebase-autostash.sh | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 64904bef069..2c01ae6ad2a 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -102,14 +102,13 @@ create_expected_failure_am() {
}
create_expected_failure_interactive() {
- cr=$(echo . | tr '.' '\015') &&
- cat >expected <<-EOF
+ q_to_cr >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
HEAD is now at $(git rev-parse --short feature-branch) third commit
- Rebasing (1/2)${cr}Rebasing (2/2)${cr}Successfully rebased and updated refs/heads/rebased-feature-branch.
- Applying autostash resulted in conflicts.
+ Rebasing (1/2)QRebasing (2/2)QApplying autostash resulted in conflicts.
Your changes are safe in the stash.
You can run "git stash pop" or "git stash drop" at any time.
+ Successfully rebased and updated refs/heads/rebased-feature-branch.
EOF
}
--
2.12.2.windows.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: Type: text/x-diff; name=0004-fixup-sequencer-print-autostash-messages-to-stderr.patch, Size: 1246 bytes --]
From 128c4a66ab3413b2135264f17024e1f5e9250f03 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Fri, 16 Jun 2017 15:40:46 +0200
Subject: [PATCH 4/4] fixup! sequencer: print autostash messages to stderr
This is the companion to the proposed patch, but I had no time to verify
that the test suite still passes (it may actually test for the buggy
behavior...)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
git-rebase.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index db1deed8464..2cf73b88e8e 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -166,14 +166,14 @@ apply_autostash () {
stash_sha1=$(cat "$state_dir/autostash")
if git stash apply $stash_sha1 2>&1 >/dev/null
then
- echo "$(gettext 'Applied autostash.')"
+ echo "$(gettext 'Applied autostash.')" >&2
else
git stash store -m "autostash" -q $stash_sha1 ||
die "$(eval_gettext "Cannot store \$stash_sha1")"
gettext 'Applying autostash resulted in conflicts.
Your changes are safe in the stash.
You can run "git stash pop" or "git stash drop" at any time.
-'
+' >&2
fi
fi
}
--
2.12.2.windows.1
next prev parent reply other threads:[~2017-06-16 13:50 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 10:42 [PATCH 0/3] Add regression tests for recent rebase -i fixes Phillip Wood
2017-05-31 10:42 ` [PATCH 1/3] rebase -i: Add test for reflog message Phillip Wood
2017-06-01 2:00 ` Junio C Hamano
2017-05-31 10:42 ` [PATCH 2/3] rebase: Add tests for console output Phillip Wood
2017-05-31 19:02 ` Phillip Wood
2017-06-01 1:59 ` Junio C Hamano
2017-06-01 12:56 ` Johannes Schindelin
2017-06-01 23:40 ` Junio C Hamano
2017-06-01 23:47 ` Stefan Beller
2017-06-02 12:47 ` pushing for a new hash, was " Johannes Schindelin
2017-06-02 17:54 ` Jonathan Nieder
2017-06-02 18:05 ` Jonathan Nieder
2017-06-02 20:29 ` Ævar Arnfjörð Bjarmason
2017-06-15 10:38 ` Johannes Schindelin
2017-06-03 0:36 ` Junio C Hamano
2017-06-06 22:22 ` Johannes Schindelin
2017-06-06 22:45 ` Jonathan Nieder
2017-06-07 1:09 ` Junio C Hamano
2017-06-07 2:18 ` [PATCH] t4005: modernize style and drop hard coded sha1 Stefan Beller
2017-06-07 17:39 ` Brandon Williams
2017-06-06 22:45 ` pushing for a new hash, was Re: [PATCH 2/3] rebase: Add tests for console output Stefan Beller
2017-06-06 22:52 ` Jonathan Nieder
2017-06-07 0:34 ` Samuel Lijin
2017-06-07 14:47 ` Johannes Schindelin
2017-06-07 16:53 ` Stefan Beller
2017-06-07 10:47 ` Phillip Wood
2017-06-09 16:39 ` Junio C Hamano
2017-06-14 10:18 ` Phillip Wood
2017-06-14 12:51 ` Johannes Schindelin
2017-05-31 10:42 ` [PATCH 3/3] rebase: Add tests for console output with conflicting stash Phillip Wood
2017-06-14 10:24 ` [PATCH v2 0/3] Add regression tests for rectent rebase -i fixes Phillip Wood
2017-06-14 10:24 ` [PATCH v2 1/3] rebase -i: Add test for reflog message Phillip Wood
2017-06-14 10:24 ` [PATCH v2 2/3] rebase: Add regression tests for console output Phillip Wood
2017-06-14 10:24 ` [PATCH v2 3/3] rebase: Add more " Phillip Wood
2017-06-14 20:35 ` [PATCH v2 0/3] Add regression tests for rectent rebase -i fixes Johannes Schindelin
2017-06-15 23:05 ` Junio C Hamano
2017-06-15 23:23 ` Junio C Hamano
2017-06-15 23:29 ` Junio C Hamano
2017-06-16 13:49 ` Johannes Schindelin [this message]
2017-06-16 18:43 ` Johannes Sixt
2017-06-16 21:05 ` Junio C Hamano
2017-06-19 19:45 ` Johannes Sixt
2017-06-19 20:02 ` Junio C Hamano
2017-06-19 9:49 ` Phillip Wood
2017-06-19 15:45 ` Junio C Hamano
2017-06-19 9:52 ` Phillip Wood
2017-06-19 17:56 ` [PATCH v3 0/4] Add regression tests for recent " Phillip Wood
2017-06-19 17:56 ` [PATCH v3 1/4] sequencer: print autostash messages to stderr Phillip Wood
2017-06-19 17:56 ` [PATCH v3 2/4] rebase -i: Add test for reflog message Phillip Wood
2017-06-19 17:56 ` [PATCH v3 3/4] rebase: Add regression tests for console output Phillip Wood
2017-06-19 17:56 ` [PATCH v3 4/4] rebase: Add more " Phillip Wood
2017-06-23 4:17 ` [PATCH v3 0/4] Add regression tests for recent rebase -i fixes Junio C Hamano
2017-06-23 5:07 ` Junio C Hamano
2017-06-23 9:53 ` Phillip Wood
2017-06-23 17:03 ` Junio C Hamano
2017-06-23 18:53 ` Junio C Hamano
2017-06-26 9:17 ` Phillip Wood
2017-06-23 19:01 ` Junio C Hamano
2017-06-26 9:23 ` Phillip Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.1.1706161527140.4200@virtualbox \
--to=johannes.schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=phillip.wood@talktalk.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).