rebase: decouple --exec from --interactive
In the later steps of preparing a patch series I do not want to edit or reorder the patches any more, but just make sure the test suite passes after each patch and also to fix breakage right there if some of the steps fail. I could run EDITOR=true git rebase -i <anchor> -x "make test" but it would be simpler if it can be spelled like so: git rebase <anchor> -x "make test" Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 18, 2016 at 14:26 UTC
78ec240020db4bdd773830f3d41f4b4bdf9a4e2d
3 files changed
+10
-16
Documentation/git-rebase.txt
+3
-3
@@ -391,9 +391,6 @@ idea unless you know what you are doing (see BUGS below).
391
final history. <cmd> will be interpreted as one or more shell
392
commands.
393
+
394
-This option can only be used with the `--interactive` option
395
-(see INTERACTIVE MODE below).
396
-+
394
You may execute several commands by either using one instance of `--exec`
395
with several commands:
396
+
@@ -406,6 +403,9 @@ or by giving more than one `--exec`:
403
If `--autosquash` is used, "exec" lines will not be appended for
404
the intermediate commits, and will only appear at the end of each
405
squash/fixup series.
406
++
407
+This uses the `--interactive` machinery internally, but it can be run
408
+without an explicit `--interactive`.
409
410
--root::
411
Rebase all commits reachable from <branch>, instead of
git-rebase.sh
+1
-6
@@ -248,6 +248,7 @@ do
248
;;
249
--exec=*)
250
cmd="${cmd}exec ${1#--exec=}${LF}"
251
+ test -z "$interactive_rebase" && interactive_rebase=implied
252
;;
253
--interactive)
254
interactive_rebase=explicit
@@ -348,12 +349,6 @@ do
349
done
350
test $# -gt 2 && usage
351
351
-if test -n "$cmd" &&
352
- test "$interactive_rebase" != explicit
353
-then
354
- die "$(gettext "The --exec option must be used with the --interactive option")"
355
-fi
356
-
352
if test -n "$action"
353
then
354
test -z "$in_progress" && die "$(gettext "No rebase in progress?")"
t/t3404-rebase-interactive.sh
+6
-7
@@ -876,16 +876,15 @@ test_expect_success 'rebase -ix with --autosquash' '
876
test_cmp expected actual
877
'
878
879
-
880
-test_expect_success 'rebase --exec without -i shows error message' '
879
+test_expect_success 'rebase --exec works without -i ' '
880
git reset --hard execute &&
882
- set_fake_editor &&
883
- test_must_fail git rebase --exec "git show HEAD" HEAD~2 2>actual &&
884
- echo "The --exec option must be used with the --interactive option" >expected &&
885
- test_i18ncmp expected actual
881
+ rm -rf exec_output &&
882
+ EDITOR="echo >invoked_editor" git rebase --exec "echo a line >>exec_output" HEAD~2 2>actual &&
883
+ test_i18ngrep "Successfully rebased and updated" actual &&
884
+ test_line_count = 2 exec_output &&
885
+ test_path_is_missing invoked_editor
886
'
887
888
-
888
test_expect_success 'rebase -i --exec without <CMD>' '
889
git reset --hard execute &&
890
set_fake_editor &&