git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Matthieu.Moy@grenoble-inp.fr, j6t@kdbg.org,
	johannes.schindelin@gmail.com, Lucien.Kong@ensimag.imag.fr,
	Stefan Beller <sbeller@google.com>
Subject: [PATCH] rebase -x: do not die without -i
Date: Wed, 16 Mar 2016 18:19:44 -0700	[thread overview]
Message-ID: <1458177584-11378-1-git-send-email-sbeller@google.com> (raw)

In the later steps of preparing a patch series I do not want to edit the
patches any more, but just make sure the test suite passes after each
patch. Currently I would run

  EDITOR=true git rebase -i <anchor> -x "make test"

In an ideal world the command would be simpler and just be

  git rebase <anchor> -x "make test"

to run the test for each commit I am about to send out for review.
This patch enables the short line.

While at it, remove the double empty lines in t3404.

Signed-off-by: Stefan Beller <sbeller@google.com>
---

 Junio,
 
 This is a slightly different approach.
 
 -x doesn't imply -i any more, but just the internal code does that. The user
 will see --exec working just fine without the -i option given.

 Thanks,
 Stefan

 git-rebase.sh                 |  4 +++-
 t/t3404-rebase-interactive.sh | 18 +++++-------------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index cf60c43..232484a 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -351,7 +351,9 @@ test $# -gt 2 && usage
 if test -n "$cmd" &&
    test "$interactive_rebase" != explicit
 then
-	die "$(gettext "The --exec option must be used with the --interactive option")"
+	interactive_rebase=implicit
+	GIT_EDITOR=true
+	export GIT_EDITOR
 fi
 
 if test -n "$action"
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 544f9ad..2064d88 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -771,7 +771,6 @@ test_expect_success 'rebase-i history with funny messages' '
 	test_cmp expect actual
 '
 
-
 test_expect_success 'prepare for rebase -i --exec' '
 	git checkout master &&
 	git checkout -b execute &&
@@ -780,7 +779,6 @@ test_expect_success 'prepare for rebase -i --exec' '
 	test_commit three_exec main.txt three_exec
 '
 
-
 test_expect_success 'running "git rebase -i --exec git show HEAD"' '
 	set_fake_editor &&
 	git rebase -i --exec "git show HEAD" HEAD~2 >actual &&
@@ -793,7 +791,6 @@ test_expect_success 'running "git rebase -i --exec git show HEAD"' '
 	test_cmp expected actual
 '
 
-
 test_expect_success 'running "git rebase --exec git show HEAD -i"' '
 	git reset --hard execute &&
 	set_fake_editor &&
@@ -807,7 +804,6 @@ test_expect_success 'running "git rebase --exec git show HEAD -i"' '
 	test_cmp expected actual
 '
 
-
 test_expect_success 'running "git rebase -ix git show HEAD"' '
 	git reset --hard execute &&
 	set_fake_editor &&
@@ -835,7 +831,6 @@ test_expect_success 'rebase -ix with several <CMD>' '
 	test_cmp expected actual
 '
 
-
 test_expect_success 'rebase -ix with several instances of --exec' '
 	git reset --hard execute &&
 	set_fake_editor &&
@@ -850,7 +845,6 @@ test_expect_success 'rebase -ix with several instances of --exec' '
 	test_cmp expected actual
 '
 
-
 test_expect_success 'rebase -ix with --autosquash' '
 	git reset --hard execute &&
 	git checkout -b autosquash &&
@@ -876,16 +870,14 @@ test_expect_success 'rebase -ix with --autosquash' '
 	test_cmp expected actual
 '
 
-
-test_expect_success 'rebase --exec without -i shows error message' '
+test_expect_success 'rebase --exec works without -i ' '
 	git reset --hard execute &&
-	set_fake_editor &&
-	test_must_fail git rebase --exec "git show HEAD" HEAD~2 2>actual &&
-	echo "The --exec option must be used with the --interactive option" >expected &&
-	test_i18ncmp expected actual
+	git rebase --exec true HEAD~2 2>actual2 >actual1 &&
+	echo "Successfully rebased and updated refs/heads/autosquash_expected." >expected &&
+	test_i18ncmp expected actual2 &&
+	test_line_count = 2 actual1
 '
 
-
 test_expect_success 'rebase -i --exec without <CMD>' '
 	git reset --hard execute &&
 	set_fake_editor &&
-- 
2.8.0.rc3.1.ge1ac87c.dirty

             reply	other threads:[~2016-03-17  1:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17  1:19 Stefan Beller [this message]
2016-03-17  6:20 ` [PATCH] rebase -x: do not die without -i Johannes Sixt
2016-03-17  6:48 ` Johannes Schindelin
2016-03-17  7:50 ` Junio C Hamano
2016-03-17 13:11   ` Johannes Schindelin
2016-03-17 18:10     ` Junio C Hamano

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458177584-11378-1-git-send-email-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=Lucien.Kong@ensimag.imag.fr \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=johannes.schindelin@gmail.com \
    /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.
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 NNTP newsgroup(s).