{"thread":{"id":"30700","subject":"[PATCH] rebase [-i --exec | -ix] <CMD>...","startedAt":"2012-06-04T13:47:54Z","lastAt":"2012-06-14T14:08:09Z","messageCount":50,"participants":["Kong Lucien","Junio C Hamano","Matthieu Moy","konglu@minatec.inpg.fr","Lucien Kong","Zbigniew Jędrzejewski-Szmek","Johannes Sixt","Torsten Bögershausen","Marc Branchaud"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"192802","messageId":"1338817674-22877-1-git-send-email-Lucien.Kong@ensimag.imag.fr","threadId":"30700","inReplyTo":null,"subject":"[PATCH] rebase [-i --exec | -ix] <CMD>...","fromName":"Kong Lucien","fromEmail":"lucien.kong@ensimag.imag.fr","sentAt":"2012-06-04T13:47:54Z","receivedAt":"2012-06-04T13:47:54Z","isPatch":true,"sender":{"key":"lucien.kong@ensimag.imag.fr","avatar":null},"body":"This patch provides a way to automatically add these \"exec\" lines\nbetween each commit applications. For instance, running 'git rebase -i\n--exec \"make test\"' lets you check that intermediate commits are\ncompilable.  At this point, you can't use --exec without the\ninteractive mode (-i).\n\nTests about this new command are also added in\nt3404-rebase-interactive.sh.\n\nSigned-off-by: Kong Lucien <Lucien.Kong@ensimag.imag.fr>\nSigned-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>\nSigned-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>\nSigned-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>\nSigned-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n---\n Documentation/git-rebase.txt  |   43 ++++++++++++++++++++++-\n git-rebase--interactive.sh    |   13 +++++++\n git-rebase.sh                 |   35 +++++++++++++++++--\n t/t3404-rebase-interactive.sh |   74 +++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 159 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 147fa1a..96dbf26 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head\n SYNOPSIS\n --------\n [verse]\n-'git rebase' [-i | --interactive] [options] [--onto <newbase>]\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t[<upstream>] [<branch>]\n-'git rebase' [-i | --interactive] [options] --onto <newbase>\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>\n \t--root [<branch>]\n 'git rebase' --continue | --skip | --abort\n \n@@ -210,6 +210,17 @@ rebase.autosquash::\n \n OPTIONS\n -------\n+<cmd>::\n+\tShell command executed between each commit applications. The\n+\t--exec option has to be specified.\n++\n+You may execute several commands between each commit applications.\n+Therefore, you can use one instance of exec:\n+\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n+You can also insert several instances of exec, if you wish to\n+only have one command per line for example:\n+\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n+\n <newbase>::\n \tStarting point at which to create the new commits. If the\n \t--onto option is not specified, the starting point is\n@@ -336,6 +347,13 @@ link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for details).\n \tuser edit that list before rebasing.  This mode can also be used to\n \tsplit commits (see SPLITTING COMMITS below).\n \n+-x::\n+--exec::\n+\tAutomatically add \"exec\" followed by <cmd> between each commit\n+\tapplications (see INTERACTIVE MODE below).\n++\n+This has to be used along with the `--interactive` option explicitly.\n+\n -p::\n --preserve-merges::\n \tInstead of ignoring merges, try to recreate them.\n@@ -521,6 +539,27 @@ in `$SHELL`, or the default shell if `$SHELL` is not set), so you can\n use shell features (like \"cd\", \">\", \";\" ...). The command is run from\n the root of the working tree.\n \n+----------------------------------\n+$ git rebase -i --exec \"make test\"\n+----------------------------------\n+\n+This command lets you check that intermediate commits are compilable.\n+The todo list becomes like that:\n+\n+--------------------\n+pick 5928aea one\n+exec make test\n+pick 04d0fda two\n+exec make test\n+pick ba46169 three\n+exec make test\n+pick f4593f9 four\n+exec make test\n+--------------------\n+\n+If the option '-i' is missing, The command will return the usage page\n+of \"git rebase\". Same if there is no <cmd> specified behind --exec.\n+\n SPLITTING COMMITS\n -----------------\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 0c19b7c..7444160 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -876,6 +876,19 @@ cat >> \"$todo\" << EOF\n #\n EOF\n \n+if test -n \"$cmd\"\n+then\n+\tOIFS=$IFS\n+\tIFS=','\n+\tfor i in $cmd\n+\tdo\n+\t\tsed \"/^pick .*/aexec $i\" \"$todo\" >tmp\n+\t\tcat tmp >\"$todo\"\n+\tdone\n+\trm tmp\n+\tIFS=$OIFS\n+fi\n+\n if test -z \"$keep_empty\"\n then\n \techo \"# Note that empty commits are commented out\" >>\"$todo\"\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 24a2840..a8b1793 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,7 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n+USAGE='[--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]\n+       [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n LONG_USAGE='git-rebase replaces <branch> with a new branch of the\n same name.  When the --onto option is provided the new branch starts\n out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>\n@@ -30,8 +31,8 @@ Example:       git-rebase master~1 topic\n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n-git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]\n-git rebase [-i] [options] --onto <newbase> --root [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] --onto <newbase> --root [<branch>]\n git-rebase [-i] --continue | --abort | --skip\n --\n  Available options are\n@@ -43,6 +44,7 @@ s,strategy=!       use the given merge strategy\n no-ff!             cherry-pick all commits, even if unchanged\n m,merge!           use merging strategies to rebase\n i,interactive!     let the user edit the list of commits to rebase\n+x,exec=!           add exec lines after each commit of the editable list\n k,keep-empty\t   preserve empty commits during rebase\n f,force-rebase!    force rebase even if branch is up to date\n X,strategy-option=! pass the argument through to the merge strategy\n@@ -76,6 +78,7 @@ If you would prefer to skip this patch, instead run \\\"git rebase --skip\\\".\n To check out the original branch and stop rebasing run \\\"git rebase --abort\\\".\n \"\n unset onto\n+unset cmd\n strategy=\n strategy_opts=\n do_merge=\n@@ -219,6 +222,24 @@ do\n \t\tonto=\"$2\"\n \t\tshift\n \t\t;;\n+\t-x)\n+\t\texec_flag=true\n+\t\ttest 3 -le \"$#\" || usage\n+\t\tif orig_head=$(git rev-parse -q --verify \"$2\") ||\n+\t\t   test `expr substr \"$2\" 1 1` = -\n+\t\tthen\n+\t\t\techo \"You must specify a command after --exec option\\n\"\n+\t\t\tusage\n+\t\telse\n+\t\t\tif test -n \"$cmd\"\n+\t\t\tthen\n+\t\t\t\tcmd=\"$2,$cmd\"\n+\t\t\telse\n+\t\t\t\tcmd=\"$2\"\n+\t\t\tfi\n+\t\tfi\n+\t\tshift\n+\t\t;;\n \t-i)\n \t\tinteractive_rebase=explicit\n \t\t;;\n@@ -304,6 +325,13 @@ do\n done\n test $# -gt 2 && usage\n \n+if test -n \"$exec_flag\" &&\n+   test -z \"$interactive_rebase\"\n+then\n+\techo \"--exec option must be used with --interactive option\\n\"\n+\tusage\n+fi\n+\n if test -n \"$action\"\n then\n \ttest -z \"$in_progress\" && die \"No rebase in progress?\"\n@@ -348,7 +376,6 @@ abort)\n \texit\n \t;;\n esac\n-\n # Make sure no rebase is in progress\n if test -n \"$in_progress\"\n then\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 025c1c6..2976f07 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -755,4 +755,78 @@ test_expect_success 'rebase-i history with funny messages' '\n \ttest_cmp expect actual\n '\n \n+\n+test_expect_success 'running \"git rebase -i --exec git show HEAD\"' '\n+\tgit checkout master &&\n+\tgit checkout -b execute &&\n+\ttest_commit one_exec main.txt one_exec &&\n+\ttest_commit two_exec main.txt two_exec &&\n+\ttest_commit three_exec main.txt three_exec &&\n+\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase --exec git show HEAD -i\"' '\n+\tgit rebase --exec \"git show HEAD\" -i HEAD~2 >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase -ix git show HEAD\"' '\n+\tgit rebase -ix \"git show HEAD\" HEAD~2 >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several <CMD>' '\n+\tgit rebase -ix \"git show HEAD; pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD;_pwd 2 exec_git_show_HEAD;_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several instances of --exec' '\n+\tgit rebase -i --exec \"git show HEAD\" --exec \"pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD exec_pwd 2\n+\t\t\t\texec_git_show_HEAD exec_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,11d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase --exec without -i shows error message and usage ' '\n+\ttest_must_fail git rebase --exec \"git show HEAD\" HEAD~2 >actual &&\n+\techo \"--exec option must be used with --interactive option\\n\" >expected &&\n+\ttest_must_fail git rebase -h >>expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -i --exec without <CMD> shows error message and usage ' '\n+\ttest_must_fail git rebase -i --exec HEAD~2>actual &&\n+\techo \"You must specify a command after --exec option\\n\" >expected &&\n+\ttest_must_fail git rebase -h >>expected &&\n+\ttest_cmp expected actual &&\n+\tgit checkout master\n+'\n+\n test_done\n-- \n1.7.8\n"},{"id":"192826","messageId":"7vhaurt1m6.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"1338817674-22877-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCH] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-04T17:42:41Z","receivedAt":"2012-06-04T17:42:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kong Lucien <Lucien.Kong@ensimag.imag.fr> writes:\n\n> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> index 147fa1a..96dbf26 100644\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -210,6 +210,17 @@ rebase.autosquash::\n>  \n>  OPTIONS\n>  -------\n> +<cmd>::\n> +\tShell command executed between each commit applications. The\n> +\t--exec option has to be specified.\n> ++\n> +You may execute several commands between each commit applications.\n> +Therefore, you can use one instance of exec:\n> +\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n> +You can also insert several instances of exec, if you wish to\n> +only have one command per line for example:\n> +\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n> +\n\nThe description of this and exisitng <newbase> look very odd.  The\nusual way to describe an option that take a parameter in the OPTIONS\nsection is to instead do:\n\n\t--onto <newbase>::\n\t\tDescription of what --onto option does and how <newbase>\n\t\tis used in what it does.\n\n\t--exec <cmd>::\n\t\tDescription of what --exec option does, and how\t<cmd> \n                is used in what it does.\n\n> @@ -336,6 +347,13 @@ link:howto/revert-a-faulty-me\n>  \tuser edit that list before rebasing.  This mode can also be used to\n>  \tsplit commits (see SPLITTING COMMITS below).\n>  \n> +-x::\n> +--exec::\n> +\tAutomatically add \"exec\" followed by <cmd> between each commit\n> +\tapplications (see INTERACTIVE MODE below).\n> ++\n> +This has to be used along with the `--interactive` option explicitly.\n> +\n\nOK.\n\n> @@ -521,6 +539,27 @@ in `$SHELL`, or the default shell if\n> ...\n> +If the option '-i' is missing, The command will return the usage page\n> +of \"git rebase\". Same if there is no <cmd> specified behind --exec.\n\nOK.\n\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 0c19b7c..7444160 100644\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -876,6 +876,19 @@ cat >> \"$todo\" << EOF\n>  #\n>  EOF\n>  \n> +if test -n \"$cmd\"\n> +then\n> +\tOIFS=$IFS\n> +\tIFS=','\n> +\tfor i in $cmd\n> +\tdo\n> +\t\tsed \"/^pick .*/aexec $i\" \"$todo\" >tmp\n> +\t\tcat tmp >\"$todo\"\n> +\tdone\n> +\trm tmp\n> +\tIFS=$OIFS\n> +fi\n\nWhere does this \"we split at comma\", implying \"the user is forbidden\nto have a comma in the executed command and its arguments\" come\nfrom?\n\nA more conventional way that would be less troublesome in the real\nlife is to use LF instead in a case like this (and git-rebase.sh\nalready defines it for exactly a case like this).\n\nI am not sure if that \"aexec\" is portable outside GNUism, though.\nTraditionally the a(ppend) command is spelled like this:\n\n\t[1addr]a\\\n        text\n\nto write one line (cf. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_03).\n\nWhy is \"pick\" special?  Don't you want to run the commands after\n\"edit\", \"reword\", \"squash\", \"fixup\"?\n\nThis should come immediately after autosquash rearranged the insns\nin the $todo file, before the help text is appended to it.\n\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 24a2840..a8b1793 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -76,6 +78,7 @@ If you would prefer to skip this patch, instead run \\\"git rebase --skip\\\".\n>  To check out the original branch and stop rebasing run \\\"git rebase --abort\\\".\n>  \"\n>  unset onto\n> +unset cmd\n>  strategy=\n>  strategy_opts=\n>  do_merge=\n\nYou copied badness from the existing \"unset onto\"; I do not think\nthe rest of the code (and especially the new code you add) treats a\nvariable that is not set and set to an empty string any different,\nand setting it to empty is the right thing to do in such a case.\n\n> @@ -219,6 +222,24 @@ do\n>  \t\tonto=\"$2\"\n>  \t\tshift\n>  \t\t;;\n> +\t-x)\n> +\t\texec_flag=true\n\nexec_flag is not cleared at the beginning of the script, so if the\ncommand is run without \"-x\" on the command line, it can have\nwhatever garbage value that was in the environment.  You know that\n$cmd is empty if \"-x\" was not given, and you can make sure $cmd\nbecomes non-empty when \"-x\" is given, so remove use of this variable\nand replace any 'test -n \"$exec_flag\"' with 'test -n \"$cmd\"'.\n\n> +\t\ttest 3 -le \"$#\" || usage\n\nWhy 3?  You only care about the presense of $2 you are about to\nread, no?\n\n> +\t\tif orig_head=$(git rev-parse -q --verify \"$2\") ||\n> +\t\t   test `expr substr \"$2\" 1 1` = -\n> +\t\tthen\n> +\t\t\techo \"You must specify a command after --exec option\\n\"\n> +\t\t\tusage\n> +\t\telse\n> +\t\t\tif test -n \"$cmd\"\n> +\t\t\tthen\n> +\t\t\t\tcmd=\"$2,$cmd\"\n> +\t\t\telse\n> +\t\t\t\tcmd=\"$2\"\n> +\t\t\tfi\n> +\t\tfi\n> +\t\tshift\n> +\t\t;;\n\nAre you telling me that I cannot have a branch named \"make\"?  Drop\nthis nonsense, and just write it in a more straightforward way, e.g.\n\n\t-x)\n\t\ttest 2 -le \"$#\" || usage\n                cmd=\"${cmd:+\"$cmd$LF\"} $2\"\n                shift\n                ;;\n                \n>  \t-i)\n>  \t\tinteractive_rebase=explicit\n>  \t\t;;\n> @@ -304,6 +325,13 @@ do\n>  done\n>  test $# -gt 2 && usage\n>  \n> +if test -n \"$exec_flag\" &&\n> +   test -z \"$interactive_rebase\"\n> +then\n\nI think this should be\n\n\tif test -n \"$cmd\" && test \"$interactive_rebase\" != explicit\n        then\n\n> @@ -348,7 +376,6 @@ abort)\n>  \texit\n>  \t;;\n>  esac\n> -\n>  # Make sure no rebase is in progress\n>  if test -n \"$in_progress\"\n>  then\n\nWhy?\n"},{"id":"192827","messageId":"vpqk3znrmrh.fsf@bauges.imag.fr","threadId":"30700","inReplyTo":"1338817674-22877-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCH] rebase [-i --exec | -ix] <CMD>...","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-06-04T17:48:50Z","receivedAt":"2012-06-04T17:48:50Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Kong Lucien <Lucien.Kong@ensimag.imag.fr> writes:\n\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head\n>  SYNOPSIS\n>  --------\n>  [verse]\n> -'git rebase' [-i | --interactive] [options] [--onto <newbase>]\n> +'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n>  \t[<upstream>] [<branch>]\n> -'git rebase' [-i | --interactive] [options] --onto <newbase>\n> +'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>\n>  \t--root [<branch>]\n>  'git rebase' --continue | --skip | --abort\n>  \n> @@ -210,6 +210,17 @@ rebase.autosquash::\n>  \n>  OPTIONS\n>  -------\n> +<cmd>::\n> +\tShell command executed between each commit applications. The\n> +\t--exec option has to be specified.\n[...]\n> +-x::\n> +--exec::\n\nThat seems weird to have --exec <cmd> specification split into one for\n--exec, and another for <cmd> ...\n\n> +You may execute several commands between each commit applications.\n> +Therefore, you can use one instance of exec:\n> +\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n\ns/Therefore/For this/ ?\n\n(Therefore = donc in French)\n\n> +if test -n \"$cmd\"\n> +then\n> +\tOIFS=$IFS\n> +\tIFS=','\n> +\tfor i in $cmd\n> +\tdo\n> +\t\tsed \"/^pick .*/aexec $i\" \"$todo\" >tmp\n> +\t\tcat tmp >\"$todo\"\n> +\tdone\n> +\trm tmp\n\nIsn't this executed from the top of the workdir? What if the user\nalready has a file named tmp there?\n\n> +\t\t\tif test -n \"$cmd\"\n> +\t\t\tthen\n> +\t\t\t\tcmd=\"$2,$cmd\"\n> +\t\t\telse\n> +\t\t\t\tcmd=\"$2\"\n> +\t\t\tfi\n\nWhat happens when <cmd> contains a comma (e.g. --exec \"rm\nfile,with,commas,in,name.txt\") ?\n\nIf you don't allow this case, then you should error out instead of\nexecuting a weird behavior silently. Or you can escape the comma and\nunescape it later, but that may be overkill.\n\n> +if test -n \"$exec_flag\" &&\n> +   test -z \"$interactive_rebase\"\n> +then\n> +\techo \"--exec option must be used with --interactive option\\n\"\n> +\tusage\n> +fi\n\nI'd even skip the \"usage\" here, as the error message is clear enough\n(and is much less visible before a page of \"usage\" output). Just die-ing\nwould be better I think.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"192849","messageId":"vpqk3zmn7k1.fsf@bauges.imag.fr","threadId":"30700","inReplyTo":"7vhaurt1m6.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] rebase [-i --exec | -ix] <CMD>...","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-06-04T20:30:54Z","receivedAt":"2012-06-04T20:30:54Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> The description of this and exisitng <newbase> look very odd.  The\n> usual way to describe an option that take a parameter in the OPTIONS\n> section is to instead do:\n>\n> \t--onto <newbase>::\n> \t\tDescription of what --onto option does and how <newbase>\n> \t\tis used in what it does.\n>\n> \t--exec <cmd>::\n> \t\tDescription of what --exec option does, and how\t<cmd> \n>                 is used in what it does.\n\n(to the authors: you can add a trivial patch to fix the --onto doc, and\nbase your work on it)\n\n> Why is \"pick\" special?  Don't you want to run the commands after\n> \"edit\", \"reword\", \"squash\", \"fixup\"?\n\nI'd actually say you want to run it after a squash/fixup serie only.\n\nIf the result of --autosquash is\n\npick foo\nfixup bar\nfixup boz\npick foobar\n\nI think you want to rewrite it as\n\npick foo\nfixup bar\nfixup boz\nexec make\npick foobar\nexec make\n\nThe command is typically used to check that each new commit is OK, but\nwe can forget about the intermediate states as we are precisely getting\nrid of them.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"192855","messageId":"7v7gvmss6z.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"vpqk3zmn7k1.fsf@bauges.imag.fr","subject":"Re: [PATCH] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-04T21:06:12Z","receivedAt":"2012-06-04T21:06:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> I'd actually say you want to run it after a squash/fixup serie only.\n>\n> If the result of --autosquash is\n>\n> pick foo\n> fixup bar\n> fixup boz\n> pick foobar\n>\n> I think you want to rewrite it as\n>\n> pick foo\n> fixup bar\n> fixup boz\n> exec make\n> pick foobar\n> exec make\n\nThat makes sense.\n"},{"id":"192935","messageId":"20120605195959.Horde.h42jfHwdC4BPzkkfVQizm9A@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"7vhaurt1m6.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] rebase [-i --exec | -ix] <CMD>...","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-05T17:59:59Z","receivedAt":"2012-06-05T17:59:59Z","isPatch":true,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nJunio C Hamano <gitster@pobox.com> a écrit :\n\n\n>> +\t\tif orig_head=$(git rev-parse -q --verify \"$2\") ||\n>> +\t\t   test `expr substr \"$2\" 1 1` = -\n>> +\t\tthen\n>> +\t\t\techo \"You must specify a command after --exec option\\n\"\n>> +\t\t\tusage\n>> +\t\telse\n>> +\t\t\tif test -n \"$cmd\"\n>> +\t\t\tthen\n>> +\t\t\t\tcmd=\"$2,$cmd\"\n>> +\t\t\telse\n>> +\t\t\t\tcmd=\"$2\"\n>> +\t\t\tfi\n>> +\t\tfi\n>> +\t\tshift\n>> +\t\t;;\n>\n> Are you telling me that I cannot have a branch named \"make\"?  Drop\n> this nonsense, and just write it in a more straightforward way, e.g.\n>\n> \t-x)\n> \t\ttest 2 -le \"$#\" || usage\n>                 cmd=\"${cmd:+\"$cmd$LF\"} $2\"\n>                 shift\n>                 ;;\nI agree with the fact that the code must not restrain you in naming branches.\nBut shouldn't we keep the \"test `expr substr \"$2\" 1 1` = -\" part so that\noptions can't be right after the \"--exec\" ?\n"},{"id":"192936","messageId":"7vtxypocdf.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"20120605195959.Horde.h42jfHwdC4BPzkkfVQizm9A@webmail.minatec.grenoble-inp.fr","subject":"Re: [PATCH] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-05T18:13:48Z","receivedAt":"2012-06-05T18:13:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"konglu@minatec.inpg.fr writes:\n\n> But shouldn't we keep the \"test `expr substr \"$2\" 1 1` = -\" part so that\n> options can't be right after the \"--exec\" ?\n\nNo.  We have no reason to forbid users from giving their commands\nnames that begin with \"-\", and if it is a typo, \"exec\" machinery\nwill catch it and tell the user \"no such command\".  I do not see any\ngood reason to be clever in the part of the command parsing loop\nthat handles \"--exec <cmd>\" option.\n"},{"id":"192970","messageId":"1338978856-26838-1-git-send-email-Lucien.Kong@ensimag.imag.fr","threadId":"30700","inReplyTo":"1338817674-22877-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"[PATCHv2] rebase [-i --exec | -ix] <CMD>...","fromName":"Lucien Kong","fromEmail":"lucien.kong@ensimag.imag.fr","sentAt":"2012-06-06T10:34:16Z","receivedAt":"2012-06-06T10:34:16Z","isPatch":false,"sender":{"key":"lucien.kong@ensimag.imag.fr","avatar":null},"body":"This patch provides a way to automatically add these \"exec\" lines\nbetween each commit applications. For instance, running 'git rebase -i\n--exec \"make test\"' lets you check that intermediate commits are\ncompilable. It is also compatible with the option --autosquash. At\nthis point, you can't use --exec without the interactive mode (-i).\n\nTests about this new command are also added in\nt3404-rebase-interactive.sh.\n\nSigned-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr>\nSigned-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>\nSigned-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>\nSigned-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>\nSigned-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n---\nThe part of --onto in the documentation is changed to be consistent\nwith the other options. The exec line, when using the option --autosquash,\nis now only added after the squash/fixup series.\n\n Documentation/git-rebase.txt  |   54 +++++++++++++++--\n git-rebase--interactive.sh    |   19 ++++++\n git-rebase.sh                 |   20 ++++++-\n t/t3404-rebase-interactive.sh |  124 +++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 207 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 147fa1a..1dd95c4 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head\n SYNOPSIS\n --------\n [verse]\n-'git rebase' [-i | --interactive] [options] [--onto <newbase>]\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t[<upstream>] [<branch>]\n-'git rebase' [-i | --interactive] [options] --onto <newbase>\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>\n \t--root [<branch>]\n 'git rebase' --continue | --skip | --abort\n \n@@ -210,11 +210,29 @@ rebase.autosquash::\n \n OPTIONS\n -------\n-<newbase>::\n-\tStarting point at which to create the new commits. If the\n-\t--onto option is not specified, the starting point is\n-\t<upstream>.  May be any valid commit, and not just an\n-\texisting branch name.\n+-x <cmd>::\n+--exec <cmd>::\n+\tAutomatically add \"exec\" followed by <cmd> between each commit\n+\tapplications. Using this option along with --autosquash adds\n+\tthe exec line after the squash/fixeup series only. <cmd>\n+\tstands for shell commands. The --exec option has to be\n+\tspecified. (see INTERACTIVE MODE below)\n++\n+This has to be used along with the `--interactive` option explicitly.\n+You may execute several commands between each commit applications.\n+For this, you can use one instance of exec:\n+\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n+You can also insert several instances of exec, if you wish to\n+only have one command per line for example:\n+\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n+\n+--onto <newbase>::\n+\tWith this option, git rebase takes all commits from <branch>,\n+\tthat are not in <upstream>, and transplant them on top of\n+\t<newbase>. <newbase> is the starting point at which to create\n+\tthe new commits. If the --onto option is not specified, the\n+\tstarting point is <upstream>.  May be any valid commit, and\n+\tnot just an existing branch name.\n +\n As a special case, you may use \"A\\...B\" as a shortcut for the\n merge base of A and B if there is exactly one merge base. You can\n@@ -521,6 +539,28 @@ in `$SHELL`, or the default shell if `$SHELL` is not set), so you can\n use shell features (like \"cd\", \">\", \";\" ...). The command is run from\n the root of the working tree.\n \n+----------------------------------\n+$ git rebase -i --exec \"make test\"\n+----------------------------------\n+\n+This command lets you check that intermediate commits are compilable.\n+The todo list becomes like that:\n+\n+--------------------\n+pick 5928aea one\n+exec make test\n+pick 04d0fda two\n+exec make test\n+pick ba46169 three\n+exec make test\n+pick f4593f9 four\n+exec make test\n+--------------------\n+\n+If the option '-i' is missing, The command will return a message\n+error. If there is no <cmd> specified behind --exec, the command will\n+return a message error and the usage page of 'git rebase'.\n+\n SPLITTING COMMITS\n -----------------\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 0c19b7c..3539afd 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -684,6 +684,23 @@ rearrange_squash () {\n \trm -f \"$1.sq\" \"$1.rearranged\"\n }\n \n+# Add commands after a pick or after a squash/fixup serie\n+# in the todo list.\n+add_exec_commands () {\n+\tOIFS=$IFS\n+\tIFS=$LF\n+\tfor i in $cmd\n+\tdo\n+\t\ttmp=$(sed \"/^pick .*/i\\\n+\t\t\t\texec $i\" \"$1\")\n+\t\techo \"$tmp\" >\"$1\"\n+\t\ttmp=$(sed '1d' \"$1\")\n+\t\techo \"$tmp\" >\"$1\"\n+\t\techo \"exec $i\" >>\"$1\"\n+\tdone\n+\tIFS=$OIFS\n+}\n+\n case \"$action\" in\n continue)\n \t# do we have anything to commit?\n@@ -857,6 +874,8 @@ fi\n \n test -s \"$todo\" || echo noop >> \"$todo\"\n test -n \"$autosquash\" && rearrange_squash \"$todo\"\n+test -n \"$cmd\" && add_exec_commands \"$todo\"\n+\n cat >> \"$todo\" << EOF\n \n # Rebase $shortrevisions onto $shortonto\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 24a2840..19ead1a 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,7 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n+USAGE='[--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]\n+       [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n LONG_USAGE='git-rebase replaces <branch> with a new branch of the\n same name.  When the --onto option is provided the new branch starts\n out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>\n@@ -30,8 +31,8 @@ Example:       git-rebase master~1 topic\n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n-git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]\n-git rebase [-i] [options] --onto <newbase> --root [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] --onto <newbase> --root [<branch>]\n git-rebase [-i] --continue | --abort | --skip\n --\n  Available options are\n@@ -43,6 +44,7 @@ s,strategy=!       use the given merge strategy\n no-ff!             cherry-pick all commits, even if unchanged\n m,merge!           use merging strategies to rebase\n i,interactive!     let the user edit the list of commits to rebase\n+x,exec=!           add exec lines after each commit of the editable list\n k,keep-empty\t   preserve empty commits during rebase\n f,force-rebase!    force rebase even if branch is up to date\n X,strategy-option=! pass the argument through to the merge strategy\n@@ -76,6 +78,7 @@ If you would prefer to skip this patch, instead run \\\"git rebase --skip\\\".\n To check out the original branch and stop rebasing run \\\"git rebase --abort\\\".\n \"\n unset onto\n+cmd=\n strategy=\n strategy_opts=\n do_merge=\n@@ -219,6 +222,11 @@ do\n \t\tonto=\"$2\"\n \t\tshift\n \t\t;;\n+\t-x)\n+\t\ttest 2 -le \"$#\" || usage\n+\t\tcmd=\"${cmd:+\"$cmd$LF\"} $2\"\n+\t\tshift\n+\t\t;;\n \t-i)\n \t\tinteractive_rebase=explicit\n \t\t;;\n@@ -304,6 +312,12 @@ do\n done\n test $# -gt 2 && usage\n \n+if test -n \"$cmd\" &&\n+   test \"$interactive_rebase\" != explicit\n+then\n+\tdie \"--exec option must be used with --interactive option\\n\"\n+fi\n+\n if test -n \"$action\"\n then\n \ttest -z \"$in_progress\" && die \"No rebase in progress?\"\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 025c1c6..4fe98d5 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -755,4 +755,128 @@ test_expect_success 'rebase-i history with funny messages' '\n \ttest_cmp expect actual\n '\n \n+\n+test_expect_success 'prepare for rebase -i --exec' '\n+\tgit checkout master &&\n+\tgit checkout -b execute &&\n+\ttest_commit one_exec main.txt one_exec &&\n+\ttest_commit two_exec main.txt two_exec &&\n+\ttest_commit three_exec main.txt three_exec\n+'\n+\n+\n+test_expect_success 'running \"git rebase -i --exec git show HEAD\"' '\n+\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase --exec git show HEAD -i\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase --exec \"git show HEAD\" -i HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase -ix git show HEAD\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several <CMD>' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD; pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD;_pwd 2 exec_git_show_HEAD;_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several instances of --exec' '\n+\tgit reset --hard execute &&\n+\tgit rebase -i --exec \"git show HEAD\" --exec \"pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD exec_pwd 2\n+\t\t\t\texec_git_show_HEAD exec_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,11d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with --autosquash' '\n+\tgit reset --hard execute &&\n+\tgit checkout -b autosquash &&\n+\techo second >second.txt &&\n+\tgit add second.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\techo bis >bis.txt &&\n+\tgit add bis.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\t(\n+\t\tgit checkout -b autosquash_actual &&\n+\t\tgit rebase -i --exec \"git show HEAD\" --autosquash HEAD~4 >actual\n+\t) &&\n+\tgit checkout autosquash &&\n+\t(\n+\t\tgit checkout -b autosquash_expected &&\n+\t\tFAKE_LINES=\"1 fixup 3 fixup 4 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~4 >expected\n+\t) &&\n+\tsed '1,13d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase --exec without -i shows error message' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase --exec \"git show HEAD\" HEAD~2 2>actual &&\n+\techo \"--exec option must be used with --interactive option\\n\" >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -i --exec without <CMD> shows error message and usage' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase -i --exec 2>actual &&\n+\tsed '1d' actual >tmp &&\n+\tmv tmp actual &&\n+\ttest_must_fail git rebase -h >expected &&\n+\ttest_cmp expected actual &&\n+\tgit checkout master\n+'\n+\n test_done\n-- \n1.7.8\n"},{"id":"193008","messageId":"vpqvcj48axn.fsf@bauges.imag.fr","threadId":"30700","inReplyTo":"1338978856-26838-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv2] rebase [-i --exec | -ix] <CMD>...","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-06-06T20:03:48Z","receivedAt":"2012-06-06T20:03:48Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Lucien Kong <Lucien.Kong@ensimag.imag.fr> writes:\n\n> @@ -210,11 +210,29 @@ rebase.autosquash::\n>  \n>  OPTIONS\n>  -------\n> -<newbase>::\n> -\tStarting point at which to create the new commits. If the\n> -\t--onto option is not specified, the starting point is\n> -\t<upstream>.  May be any valid commit, and not just an\n> -\texisting branch name.\n> +-x <cmd>::\n> +--exec <cmd>::\n> +\tAutomatically add \"exec\" followed by <cmd> between each commit\n> +\tapplications. Using this option along with --autosquash adds\n> +\tthe exec line after the squash/fixeup series only. <cmd>\n> +\tstands for shell commands. The --exec option has to be\n> +\tspecified. (see INTERACTIVE MODE below)\n\nIt would make sense to split that into two patches, one to fix --onto's\ndocumentation, and the next one to add --exec. I won't insist on that\nthough (but maybe others will).\n\n> ++\n> +This has to be used along with the `--interactive` option explicitly.\n> +You may execute several commands between each commit applications.\n> +For this, you can use one instance of exec:\n> +\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n> +You can also insert several instances of exec, if you wish to\n> +only have one command per line for example:\n> +\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n\nThis formats badly in asciidoc (try \"make doc\" and see the generated\nHTML).\n\nTry this:\n\nThis has to be used along with the `--interactive` option explicitly.\nYou may execute several commands between each commit applications.\nFor this, you can use one instance of exec:\n+\n\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n+\nYou can also insert several instances of exec, if you wish to\nonly have one command per line for example:\n+\n\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n\n\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"193020","messageId":"7vy5o0jbkl.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"1338978856-26838-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv2] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T22:54:34Z","receivedAt":"2012-06-06T22:54:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lucien Kong <Lucien.Kong@ensimag.imag.fr> writes:\n\n> The part of --onto in the documentation is changed to be consistent\n> with the other options. The exec line, when using the option --autosquash,\n> is now only added after the squash/fixup series.\n\nThanks.\n\nInserting \"exec\" before each \"pick\" and then adjusting the result\n(i.e. removing the very first one and adding one at the end) is a\nclever idea. I wonder if that can be done without temporary variable\nwhose value can grow to be a large string, though.\n\nQueued, but I've tweaked the log message a bit before queuing.\n"},{"id":"193040","messageId":"4FD06566.5010709@in.waw.pl","threadId":"30700","inReplyTo":"1338978856-26838-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv2] rebase [-i --exec | -ix] <CMD>...","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-06-07T08:25:10Z","receivedAt":"2012-06-07T08:25:10Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 06/06/2012 12:34 PM, Lucien Kong wrote:\n> This patch provides a way to automatically add these \"exec\" lines\n> between each commit applications. For instance, running 'git rebase -i\n> --exec \"make test\"' lets you check that intermediate commits are\n> compilable. It is also compatible with the option --autosquash. At\n> this point, you can't use --exec without the interactive mode (-i).\n> \n> Tests about this new command are also added in\n> t3404-rebase-interactive.sh.\n> \n> Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr>\n> Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>\n> Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>\n> Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>\n> Signed-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n> ---\n> The part of --onto in the documentation is changed to be consistent\n> with the other options. The exec line, when using the option --autosquash,\n> is now only added after the squash/fixup series.\n> \n>  Documentation/git-rebase.txt  |   54 +++++++++++++++--\n>  git-rebase--interactive.sh    |   19 ++++++\n>  git-rebase.sh                 |   20 ++++++-\n>  t/t3404-rebase-interactive.sh |  124 +++++++++++++++++++++++++++++++++++++++++\n>  4 files changed, 207 insertions(+), 10 deletions(-)\n> \n> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> index 147fa1a..1dd95c4 100644\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head\n>  SYNOPSIS\n>  --------\n>  [verse]\n> -'git rebase' [-i | --interactive] [options] [--onto <newbase>]\n> +'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n>  \t[<upstream>] [<branch>]\n> -'git rebase' [-i | --interactive] [options] --onto <newbase>\n> +'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>\n>  \t--root [<branch>]\n>  'git rebase' --continue | --skip | --abort\n>  \n> @@ -210,11 +210,29 @@ rebase.autosquash::\n>  \n>  OPTIONS\n>  -------\n> -<newbase>::\n> -\tStarting point at which to create the new commits. If the\n> -\t--onto option is not specified, the starting point is\n> -\t<upstream>.  May be any valid commit, and not just an\n> -\texisting branch name.\n> +-x <cmd>::\n> +--exec <cmd>::\n> +\tAutomatically add \"exec\" followed by <cmd> between each commit\n> +\tapplications. Using this option along with --autosquash adds\n> +\tthe exec line after the squash/fixeup series only. <cmd>\n> +\tstands for shell commands. The --exec option has to be\n> +\tspecified. (see INTERACTIVE MODE below)\nHi,\nthis still doesn't seem right:\n- \"exec\" is added *after* other lines, not *between*\n- --exec is not mandatory\n\nMaybe something along these lines:\n-x <cmd>::\n--exec <cmd>::\n  Append \"exec <cmd>\" after each commit application line. <cmd> will\n  be interpreted as one or more shell commands.\n  +\n  If --autosquash is used, the \"exec\" lines will not be appended for\n  the intermediate commits, and will only appear at the end of each\n  squash/fixup series.\n\n> ++\n> +This has to be used along with the `--interactive` option explicitly.\nThis sentence is very unclear. (E.g. is 'this'?)\n\n> +You may execute several commands between each commit applications.\n> +For this, you can use one instance of exec:\n> +\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n> +You can also insert several instances of exec, if you wish to\n> +only have one command per line for example:\n> +\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\ns/per line for example/per line. For example/ ?\n\n> +\n> +--onto <newbase>::\n> +\tWith this option, git rebase takes all commits from <branch>,\n> +\tthat are not in <upstream>, and transplant them on top of\n> +\t<newbase>. <newbase> is the starting point at which to create\n> +\tthe new commits. If the --onto option is not specified, the\n> +\tstarting point is <upstream>.  May be any valid commit, and\n> +\tnot just an existing branch name.\nShouldn't this chunk be a separate patch?\n\ns/transplant/transplants/\n\n--\nZbyszek\n"},{"id":"193041","messageId":"4FD06906.1080007@kdbg.org","threadId":"30700","inReplyTo":"1338978856-26838-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv2] rebase [-i --exec | -ix] <CMD>...","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-06-07T08:40:38Z","receivedAt":"2012-06-07T08:40:38Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 06.06.2012 12:34, schrieb Lucien Kong:\n> This patch provides a way to automatically add these \"exec\" lines\n> between each commit applications. For instance, running 'git rebase -i\n> --exec \"make test\"' lets you check that intermediate commits are\n> compilable.\n\nWhile I won't be a heavy user of this feature, I think it has some merit\nas a porcelain feature, particularly because it is rather cumbersome to\nachieve the same effect as in the given example without plumbing commands.\n\n> +-x <cmd>::\n> +--exec <cmd>::\n...\n> ++\n> +This has to be used along with the `--interactive` option explicitly.\n...\n> +\n> +If the option '-i' is missing, The command will return a message\n> +error. If there is no <cmd> specified behind --exec, the command will\n> +return a message error and the usage page of 'git rebase'.\n\nThe important part (that -x needs -i) of this paragraph are already\nspelled out above, and the exact error behavior does not need a\ndescription in the manual. Drop this paragraph.\n\nBTW, I don't think it is a good idea to dump the usage if -x was used\nwithout -i.\n\n> +# Add commands after a pick or after a squash/fixup serie\n> +# in the todo list.\n> +add_exec_commands () {\n> +\tOIFS=$IFS\n> +\tIFS=$LF\n> +\tfor i in $cmd\n> +\tdo\n> +\t\ttmp=$(sed \"/^pick .*/i\\\n> +\t\t\t\texec $i\" \"$1\")\n\nDoes this white-space before 'exec' not end up in the  todo list?\n\nI think it is wise to use introduce sed expressions by using -e. This\napplies to all 'sed' invocations that this patch introduces (also in the\ntest-suite).\n\n> +\t\techo \"$tmp\" >\"$1\"\n\nSome 'echo' implementations expand escape sequences in the supplied\ntexts. To avoid it (this is user-supplied text!), do this:\n\n\t\tprintf \"%s\\n\" \"$tmp\" >\"$1\"\n\n> +\t\ttmp=$(sed '1d' \"$1\")\n> +\t\techo \"$tmp\" >\"$1\"\n> +\t\techo \"exec $i\" >>\"$1\"\n\nDitto.\n\n> +\tdone\n> +\tIFS=$OIFS\n> +}\n\n> +\t-x)\n> +\t\ttest 2 -le \"$#\" || usage\n> +\t\tcmd=\"${cmd:+\"$cmd$LF\"} $2\"\n\nThe quoting here is *very* odd. The outer dquotes do extend their effect\ninto the replacement word after the :+ operator. I am surprised that so\nmany shells grok it. ash does not, by the way. Also, you don't need the\nspace anymore. Therefore:\n\n\t\tcmd=\"${cmd:+$cmd$LF}$2\"\n\n> +\t\tshift\n> +\t\t;;\n\n> +test_expect_success 'running \"git rebase -i --exec git show HEAD\"' '\n> +\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n> +\t(\n> +\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n> +\t\texport FAKE_LINES &&\n> +\t\tgit rebase -i HEAD~2 >expected\n> +\t) &&\n> +\tsed '1,9d' expected >expect &&\n\nHere and everywhere else: Single quotes do not nest :-) use dquotes (and\n-e).\n\n> +\tmv expect expected &&\n\nWhy not\n\n\t( ... git rebase ... >expect ) &&\n\tsed -e ... expect >expected &&\n\nwithout the mv?\n\nYou could even line up the commands in a pipeline, but since the first\none contains a git command, it is better not to do that because breakage\nof the git command would not be detected if it is not the last command\nin the pipeline.\n\n> +test_expect_success 'rebase --exec without -i shows error message' '\n> +\tgit reset --hard execute &&\n> +\ttest_must_fail git rebase --exec \"git show HEAD\" HEAD~2 2>actual &&\n> +\techo \"--exec option must be used with --interactive option\\n\" >expected &&\n> +\ttest_cmp expected actual\n\nSooner or later this text will be translated. Therefore:\n\n\ttest_i18ncmp ...\n\n-- Hannes\n"},{"id":"193054","messageId":"20120607140404.Horde.hAwfKHwdC4BP0Ji0lAVB6zA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"4FD06906.1080007@kdbg.org","subject":"Re: [PATCHv2] rebase [-i --exec | -ix] <CMD>...","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-07T12:04:04Z","receivedAt":"2012-06-07T12:04:04Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nJohannes Sixt <j6t@kdbg.org> a écrit :\n\n> BTW, I don't think it is a good idea to dump the usage if -x was used\n> without -i.\n\nIn fact, that would be the next step, so that the \"--exec\" option could\nbe used without the interactive mode.\n"},{"id":"193068","messageId":"vpqobov5jbi.fsf@bauges.imag.fr","threadId":"30700","inReplyTo":"20120607140404.Horde.hAwfKHwdC4BP0Ji0lAVB6zA@webmail.minatec.grenoble-inp.fr","subject":"Re: [PATCHv2] rebase [-i --exec | -ix] <CMD>...","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-06-07T13:43:13Z","receivedAt":"2012-06-07T13:43:13Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"konglu@minatec.inpg.fr writes:\n\n> Johannes Sixt <j6t@kdbg.org> a écrit :\n>\n>> BTW, I don't think it is a good idea to dump the usage if -x was used\n>> without -i.\n>\n> In fact, that would be the next step, so that the \"--exec\" option could\n> be used without the interactive mode.\n\nI think Jeff meant that a short error message would be better than\nshowing the complete usage instruction, which indeed is already the\ncase:\n\n+if test -n \"$cmd\" &&\n+   test \"$interactive_rebase\" != explicit\n+then\n+\tdie \"--exec option must be used with --interactive option\\n\"\n+fi\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"193155","messageId":"1339167235-2009-1-git-send-email-Lucien.Kong@ensimag.imag.fr","threadId":"30700","inReplyTo":"1338978856-26838-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"[PATCHv3 1/2] git-rebase.txt: \"--onto\" option updated","fromName":"Lucien Kong","fromEmail":"lucien.kong@ensimag.imag.fr","sentAt":"2012-06-08T14:53:54Z","receivedAt":"2012-06-08T14:53:54Z","isPatch":false,"sender":{"key":"lucien.kong@ensimag.imag.fr","avatar":null},"body":"The description of the option \"--onto\" is changed to be consistent\nwith the format of the other options.\n\nSigned-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr>\nSigned-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>\nSigned-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>\nSigned-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>\nSigned-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n---\n Documentation/git-rebase.txt |   12 +++++++-----\n 1 files changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 147fa1a..d2a510c 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -210,11 +210,13 @@ rebase.autosquash::\n \n OPTIONS\n -------\n-<newbase>::\n-\tStarting point at which to create the new commits. If the\n-\t--onto option is not specified, the starting point is\n-\t<upstream>.  May be any valid commit, and not just an\n-\texisting branch name.\n+--onto <newbase>::\n+\tWith this option, git rebase takes all commits from <branch>,\n+\tthat are not in <upstream>, and transplants them on top of\n+\t<newbase>. <newbase is the starting point at which to create\n+\tthe new commits. If the --onto option is not specified, the\n+\tstarting point is <upstream>.  May be any valid commit, and\n+\tnot just an existing branch name.\n +\n As a special case, you may use \"A\\...B\" as a shortcut for the\n merge base of A and B if there is exactly one merge base. You can\n-- \n1.7.8\n"},{"id":"193156","messageId":"1339167235-2009-2-git-send-email-Lucien.Kong@ensimag.imag.fr","threadId":"30700","inReplyTo":"1339167235-2009-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"[PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"Lucien Kong","fromEmail":"lucien.kong@ensimag.imag.fr","sentAt":"2012-06-08T14:53:55Z","receivedAt":"2012-06-08T14:53:55Z","isPatch":false,"sender":{"key":"lucien.kong@ensimag.imag.fr","avatar":null},"body":"This patch provides a way to automatically add these \"exec\" lines\nbetween each commit applications. For instance, running 'git rebase -i\n--exec \"make test\"' lets you check that intermediate commits are\ncompilable. It is also compatible with the option --autosquash. At\nthis point, you can't use --exec without the interactive mode (-i).\n\nTests about this new command are also added in\nt3404-rebase-interactive.sh.\n\nSigned-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr>\nSigned-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>\nSigned-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>\nSigned-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>\nSigned-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n---\nShould now work on MacOS.\n\n Documentation/git-rebase.txt  |   43 ++++++++++++++-\n git-rebase--interactive.sh    |   18 ++++++\n git-rebase.sh                 |   20 ++++++-\n t/t3404-rebase-interactive.sh |  118 +++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 194 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex d2a510c..866b451 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head\n SYNOPSIS\n --------\n [verse]\n-'git rebase' [-i | --interactive] [options] [--onto <newbase>]\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t[<upstream>] [<branch>]\n-'git rebase' [-i | --interactive] [options] --onto <newbase>\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>\n \t--root [<branch>]\n 'git rebase' --continue | --skip | --abort\n \n@@ -210,6 +210,27 @@ rebase.autosquash::\n \n OPTIONS\n -------\n+-x <cmd>::\n+--exec <cmd>::\n+\tAppend \"exec <cmd>\" after each commit application line. <cmd>\n+\twill be interpreted as one or more shell commands (see\n+\tINTERACTIVE MODE below).\n++\n+This option has to be used along with the `--interactive` option\n+explicitly.  You may execute several commands between each commit\n+applications.  For this, you can use one instance of exec:\n++\n+\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n++\n+You can also insert several instances of exec, if you wish to only\n+have one command per line. For example:\n++\n+\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n++\n+If --autosquash is used, the \"exec\" lines will not be appended for the\n+intermediate commits, and will only appear at the end of each\n+squash/fixup series.\n+\n --onto <newbase>::\n \tWith this option, git rebase takes all commits from <branch>,\n \tthat are not in <upstream>, and transplants them on top of\n@@ -523,6 +544,24 @@ in `$SHELL`, or the default shell if `$SHELL` is not set), so you can\n use shell features (like \"cd\", \">\", \";\" ...). The command is run from\n the root of the working tree.\n \n+----------------------------------\n+$ git rebase -i --exec \"make test\"\n+----------------------------------\n+\n+This command lets you check that intermediate commits are compilable.\n+The todo list becomes like that:\n+\n+--------------------\n+pick 5928aea one\n+exec make test\n+pick 04d0fda two\n+exec make test\n+pick ba46169 three\n+exec make test\n+pick f4593f9 four\n+exec make test\n+--------------------\n+\n SPLITTING COMMITS\n -----------------\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 0c19b7c..7bbef4b 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -684,6 +684,22 @@ rearrange_squash () {\n \trm -f \"$1.sq\" \"$1.rearranged\"\n }\n \n+# Add commands after a pick or after a squash/fixup serie\n+# in the todo list.\n+add_exec_commands () {\n+\tOIFS=$IFS\n+\tIFS=$LF\n+\tfor i in $cmd\n+\tdo\n+\t\tsed -e \"/^pick .*/i\\\\\n+exec $i\" \"$1\" >\"$1.exec\"\n+\t\tsed -e '1d' \"$1.exec\" >\"$1\"\n+\t\tprintf \"%s\\n\" \"exec $i\" >>\"$1\"\n+\tdone\n+\tIFS=$OIFS\n+\trm -f \"$1.exec\"\n+}\n+\n case \"$action\" in\n continue)\n \t# do we have anything to commit?\n@@ -857,6 +873,8 @@ fi\n \n test -s \"$todo\" || echo noop >> \"$todo\"\n test -n \"$autosquash\" && rearrange_squash \"$todo\"\n+test -n \"$cmd\" && add_exec_commands \"$todo\"\n+\n cat >> \"$todo\" << EOF\n \n # Rebase $shortrevisions onto $shortonto\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 24a2840..04dbf74 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,7 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n+USAGE='[--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]\n+       [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n LONG_USAGE='git-rebase replaces <branch> with a new branch of the\n same name.  When the --onto option is provided the new branch starts\n out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>\n@@ -30,8 +31,8 @@ Example:       git-rebase master~1 topic\n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n-git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]\n-git rebase [-i] [options] --onto <newbase> --root [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] --onto <newbase> --root [<branch>]\n git-rebase [-i] --continue | --abort | --skip\n --\n  Available options are\n@@ -43,6 +44,7 @@ s,strategy=!       use the given merge strategy\n no-ff!             cherry-pick all commits, even if unchanged\n m,merge!           use merging strategies to rebase\n i,interactive!     let the user edit the list of commits to rebase\n+x,exec=!           add exec lines after each commit of the editable list\n k,keep-empty\t   preserve empty commits during rebase\n f,force-rebase!    force rebase even if branch is up to date\n X,strategy-option=! pass the argument through to the merge strategy\n@@ -76,6 +78,7 @@ If you would prefer to skip this patch, instead run \\\"git rebase --skip\\\".\n To check out the original branch and stop rebasing run \\\"git rebase --abort\\\".\n \"\n unset onto\n+cmd=\n strategy=\n strategy_opts=\n do_merge=\n@@ -219,6 +222,11 @@ do\n \t\tonto=\"$2\"\n \t\tshift\n \t\t;;\n+\t-x)\n+\t\ttest 2 -le \"$#\" || usage\n+\t\tcmd=\"${cmd:+$cmd$LF}$2\"\n+\t\tshift\n+\t\t;;\n \t-i)\n \t\tinteractive_rebase=explicit\n \t\t;;\n@@ -304,6 +312,12 @@ do\n done\n test $# -gt 2 && usage\n \n+if test -n \"$cmd\" &&\n+   test \"$interactive_rebase\" != explicit\n+then\n+\tdie \"--exec option must be used with --interactive option\\n\"\n+fi\n+\n if test -n \"$action\"\n then\n \ttest -z \"$in_progress\" && die \"No rebase in progress?\"\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 025c1c6..ba953ab 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -755,4 +755,122 @@ test_expect_success 'rebase-i history with funny messages' '\n \ttest_cmp expect actual\n '\n \n+\n+test_expect_success 'prepare for rebase -i --exec' '\n+\tgit checkout master &&\n+\tgit checkout -b execute &&\n+\ttest_commit one_exec main.txt one_exec &&\n+\ttest_commit two_exec main.txt two_exec &&\n+\ttest_commit three_exec main.txt three_exec\n+'\n+\n+\n+test_expect_success 'running \"git rebase -i --exec git show HEAD\"' '\n+\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase --exec git show HEAD -i\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase --exec \"git show HEAD\" -i HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed '1,9d' expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase -ix git show HEAD\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed '1,9d' expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several <CMD>' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD; pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD;_pwd 2 exec_git_show_HEAD;_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed '1,9d' expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several instances of --exec' '\n+\tgit reset --hard execute &&\n+\tgit rebase -i --exec \"git show HEAD\" --exec \"pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD exec_pwd 2\n+\t\t\t\texec_git_show_HEAD exec_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed '1,11d' expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with --autosquash' '\n+\tgit reset --hard execute &&\n+\tgit checkout -b autosquash &&\n+\techo second >second.txt &&\n+\tgit add second.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\techo bis >bis.txt &&\n+\tgit add bis.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\t(\n+\t\tgit checkout -b autosquash_actual &&\n+\t\tgit rebase -i --exec \"git show HEAD\" --autosquash HEAD~4 >actual\n+\t) &&\n+\tgit checkout autosquash &&\n+\t(\n+\t\tgit checkout -b autosquash_expected &&\n+\t\tFAKE_LINES=\"1 fixup 3 fixup 4 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~4 >expect\n+\t) &&\n+\tsed '1,13d' expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase --exec without -i shows error message' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase --exec \"git show HEAD\" HEAD~2 2>actual &&\n+\techo \"--exec option must be used with --interactive option\\n\" >expected &&\n+\ttest_i18ncmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -i --exec without <CMD> shows error message and usage' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase -i --exec 2>actual &&\n+\tsed '1d' actual >tmp &&\n+\tmv tmp actual &&\n+\ttest_must_fail git rebase -h >expected &&\n+\ttest_cmp expected actual &&\n+\tgit checkout master\n+'\n+\n test_done\n-- \n1.7.8\n"},{"id":"193159","messageId":"vpqaa0drgqt.fsf@bauges.imag.fr","threadId":"30700","inReplyTo":"1339167235-2009-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv3 1/2] git-rebase.txt: \"--onto\" option updated","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-06-08T15:00:10Z","receivedAt":"2012-06-08T15:00:10Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Lucien Kong <Lucien.Kong@ensimag.imag.fr> writes:\n\n> +\t<newbase>. <newbase is the starting point at which to create\n\nMissing > after <newbase.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"193170","messageId":"4FD23041.90908@kdbg.org","threadId":"30700","inReplyTo":"1339167235-2009-2-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-06-08T17:02:57Z","receivedAt":"2012-06-08T17:02:57Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 08.06.2012 16:53, schrieb Lucien Kong:\n> +if test -n \"$cmd\" &&\n> +   test \"$interactive_rebase\" != explicit\n> +then\n> +\tdie \"--exec option must be used with --interactive option\\n\"\n> +fi\n\nIs the \\n really necessary?\n\n> +\tsed -e \"1,9d\" expect >expected &&\n\nGood. But I said \"Here and everywhere else\". So I wonder about these\nlines ;)\n\n> +\tsed '1,9d' expect >expected &&\n> +\tsed '1,9d' expect >expected &&\n> +\tsed '1,9d' expect >expected &&\n> +\tsed '1,11d' expect >expected &&\n> +\tsed '1,13d' expect >expected &&\n> +\tsed '1d' actual >tmp &&\n\n-- Hannes\n"},{"id":"193173","messageId":"7vipf1d96k.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"1339167235-2009-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv3 1/2] git-rebase.txt: \"--onto\" option updated","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-08T17:07:15Z","receivedAt":"2012-06-08T17:07:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lucien Kong <Lucien.Kong@ensimag.imag.fr> writes:\n\n> The description of the option \"--onto\" is changed to be consistent\n> with the format of the other options.\n> ...\n>  OPTIONS\n>  -------\n> -<newbase>::\n> -\tStarting point at which to create the new commits. If the\n> -\t--onto option is not specified, the starting point is\n> -\t<upstream>.  May be any valid commit, and not just an\n> -\texisting branch name.\n> +--onto <newbase>::\n> +\tWith this option, git rebase takes all commits from <branch>,\n> +\tthat are not in <upstream>, and transplants them on top of\n> +\t<newbase>. <newbase is the starting point at which to create\n> +\tthe new commits. If the --onto option is not specified, the\n> +\tstarting point is <upstream>.  May be any valid commit, and\n> +\tnot just an existing branch name.\n>  +\n>  As a special case, you may use \"A\\...B\" as a shortcut for the\n>  merge base of A and B if there is exactly one merge base. You can\n\nThis is doing two unrelated things in a single patch, isn't it?\n\nI would imagine that a patch that is about \"to be consistent with\nthe format\" would be a one-liner\n\n\t-<newbase>::\n        +--onto <newbase>::\n\nwithout anything else.  The change this patch makes to the\nexplanation is much larger, but that is not justified in the\nproposed commit log message.\n\nBesides, I find the new explanatory text much harder to understand\nthan the original one.\n"},{"id":"193175","messageId":"4FD24AE9.8020101@web.de","threadId":"30700","inReplyTo":"1339167235-2009-2-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2012-06-08T18:56:41Z","receivedAt":"2012-06-08T18:56:41Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 08.06.12 16:53, Lucien Kong wrote:\n> This patch provides a way to automatically add these \"exec\" lines\n> between each commit applications. For instance, running 'git rebase -i\n> --exec \"make test\"' lets you check that intermediate commits are\n> compilable. It is also compatible with the option --autosquash. At\n> this point, you can't use --exec without the interactive mode (-i).\n> \n> Tests about this new command are also added in\n> t3404-rebase-interactive.sh.\n\n> Should now work on MacOS.\n\nHej,\nI'm not sure on which commit to apply the patch. \n(may be we shoud improve git format-patch to tell us the original commit ID),\nbut if I remove the non applying part, it looks like this:\n\n=================\nok 54 - rebase-i history with funny messages\n\nexpecting success: \n\tgit checkout master &&\n\tgit checkout -b execute &&\n\ttest_commit one_exec main.txt one_exec &&\n\ttest_commit two_exec main.txt two_exec &&\n\ttest_commit three_exec main.txt three_exec\n\nSwitched to branch 'master'\nSwitched to a new branch 'execute'\n[execute 925b01e] one_exec\n Author: A U Thor <author@example.com>\n 1 file changed, 1 insertion(+)\n create mode 100644 main.txt\n[execute 7f87cbe] two_exec\n Author: A U Thor <author@example.com>\n 1 file changed, 1 insertion(+), 1 deletion(-)\n[execute f0f177e] three_exec\n Author: A U Thor <author@example.com>\n 1 file changed, 1 insertion(+), 1 deletion(-)\nok 55 - prepare for rebase -i --exec\n\nexpecting success: \n\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n\t(\n\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n\t\texport FAKE_LINES &&\n\t\tgit rebase -i HEAD~2 >expected\n\t) &&\n\tsed 1,9d expected >expect &&\n\tmv expect expected &&\n\ttest_cmp expected actual\n\nerror: unknown option `exec'\nusage: git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]\n   or: git rebase [-i] [options] --onto <newbase> --root [<branch>]\n   or: git-rebase [-i] --continue | --abort | --skip\n\nAvailable options are\n    -v, --verbose         display a diffstat of what changed upstream\n    -q, --quiet           be quiet. implies --no-stat\n    --onto ...            rebase onto given branch instead of upstream\n    -p, --preserve-merges\n                          try to recreate merges instead of ignoring them\n    -s, --strategy ...    use the given merge strategy\n    --no-ff               cherry-pick all commits, even if unchanged\n    -m, --merge           use merging strategies to rebase\n    -i, --interactive     let the user edit the list of commits to rebase\n    -k, --keep-empty\t     preserve empty commits during rebase\n    -f, --force-rebase    force rebase even if branch is up to date\n    -X, --strategy-option ...\n                          pass the argument through to the merge strategy\n    --stat                display a diffstat of what changed upstream\n    -n, --no-stat         do not show diffstat of what changed upstream\n    --verify              allow pre-rebase hook to run\n    --rerere-autoupdate   allow rerere to update index with resolved conflicts\n    --root                rebase all reachable commits up to the root(s)\n    --autosquash          move commits that begin with squash!/fixup! under -i\n    --committer-date-is-author-date\n                          passed to 'git am'\n    --ignore-date         passed to 'git am'\n    --whitespace ...      passed to 'git apply'\n    --ignore-whitespace   passed to 'git apply'\n    -C ...                passed to 'git apply'\n\nActions:\n    --continue            continue\n    --abort               abort and check out the original branch\n    --skip                skip current patch and continue\n\nnot ok - 56 running \"git rebase -i --exec git show HEAD\"\n#\t\n#\t\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n#\t\t(\n#\t\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n#\t\t\texport FAKE_LINES &&\n#\t\t\tgit rebase -i HEAD~2 >expected\n#\t\t) &&\n#\t\tsed 1,9d expected >expect &&\n#\t\tmv expect expected &&\n#\t\ttest_cmp expected actual\n#\t\n\nexpecting success: \n\tgit reset --hard execute &&\n\tgit rebase --exec \"git show HEAD\" -i HEAD~2 >actual &&\n\t(\n\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n\t\texport FAKE_LINES &&\n\t\tgit rebase -i HEAD~2 >expected\n\t) &&\n\tsed 1,9d expected >expect &&\n\tmv expect expected &&\n\ttest_cmp expected actual\n\nHEAD is now at f0f177e three_exec\nerror: unknown option `exec'\nusage: git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]\n   or: git rebase [-i] [options] --onto <newbase> --root [<branch>]\n   or: git-rebase [-i] --continue | --abort | --skip\n\nAvailable options are\n    -v, --verbose         display a diffstat of what changed upstream\n    -q, --quiet           be quiet. implies --no-stat\n    --onto ...            rebase onto given branch instead of upstream\n    -p, --preserve-merges\n                          try to recreate merges instead of ignoring them\n    -s, --strategy ...    use the given merge strategy\n    --no-ff               cherry-pick all commits, even if unchanged\n    -m, --merge           use merging strategies to rebase\n    -i, --interactive     let the user edit the list of commits to rebase\n    -k, --keep-empty\t     preserve empty commits during rebase\n    -f, --force-rebase    force rebase even if branch is up to date\n    -X, --strategy-option ...\n                          pass the argument through to the merge strategy\n    --stat                display a diffstat of what changed upstream\n    -n, --no-stat         do not show diffstat of what changed upstream\n    --verify              allow pre-rebase hook to run\n    --rerere-autoupdate   allow rerere to update index with resolved conflicts\n    --root                rebase all reachable commits up to the root(s)\n    --autosquash          move commits that begin with squash!/fixup! under -i\n    --committer-date-is-author-date\n                          passed to 'git am'\n    --ignore-date         passed to 'git am'\n    --whitespace ...      passed to 'git apply'\n    --ignore-whitespace   passed to 'git apply'\n    -C ...                passed to 'git apply'\n\nActions:\n    --continue            continue\n    --abort               abort and check out the original branch\n    --skip                skip current patch and continue\n\nnot ok - 57 running \"git rebase --exec git show HEAD -i\"\n"},{"id":"193176","messageId":"20120608210630.Horde.joXbQHwdC4BP0k02QgDFpMA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"7vipf1d96k.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCHv3 1/2] git-rebase.txt: \"--onto\" option updated","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-08T19:06:30Z","receivedAt":"2012-06-08T19:06:30Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nJunio C Hamano <gitster@pobox.com> a écrit :\n\n> Lucien Kong <Lucien.Kong@ensimag.imag.fr> writes:\n>\n>> The description of the option \"--onto\" is changed to be consistent\n>> with the format of the other options.\n>> ...\n>>  OPTIONS\n>>  -------\n>> -<newbase>::\n>> -\tStarting point at which to create the new commits. If the\n>> -\t--onto option is not specified, the starting point is\n>> -\t<upstream>.  May be any valid commit, and not just an\n>> -\texisting branch name.\n>> +--onto <newbase>::\n>> +\tWith this option, git rebase takes all commits from <branch>,\n>> +\tthat are not in <upstream>, and transplants them on top of\n>> +\t<newbase>. <newbase is the starting point at which to create\n>> +\tthe new commits. If the --onto option is not specified, the\n>> +\tstarting point is <upstream>.  May be any valid commit, and\n>> +\tnot just an existing branch name.\n>>  +\n>>  As a special case, you may use \"A\\...B\" as a shortcut for the\n>>  merge base of A and B if there is exactly one merge base. You can\n>\n> This is doing two unrelated things in a single patch, isn't it?\n>\n> I would imagine that a patch that is about \"to be consistent with\n> the format\" would be a one-liner\n>\n> \t-<newbase>::\n>         +--onto <newbase>::\n>\n> without anything else.  The change this patch makes to the\n> explanation is much larger, but that is not justified in the\n> proposed commit log message.\n\nThat's what I thought, but it appeared to me that the description\n\n--onto <newbase>::\n         Starting point at which to create the new commits.\n         If the --onto option is not specified, the starting\n         point is <upstream>.  May be any valid commit, and\n\tnot just an existing branch name.\n\nonly focus on the parameter <newbase>. It does not really\nexplain first what the option is doing. With the second\nsentence, it's more like a description of \"what happens when\nwe run git rebase without --onto\" than \"what happens when\nwe run git rebase with --onto\".\n\nJunio C Hamano <gitster@pobox.com> a écrit :\n\n> \t--onto <newbase>::\n> \t\tDescription of what --onto option does and how <newbase>\n> \t\tis used in what it does.\n"},{"id":"193177","messageId":"20120608211540.Horde.SRiCRHwdC4BP0k9c5TdWBaA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"4FD24AE9.8020101@web.de","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-08T19:15:40Z","receivedAt":"2012-06-08T19:15:40Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nTorsten Bögershausen <tboegi@web.de> a écrit :\n\n> On 08.06.12 16:53, Lucien Kong wrote:\n>> This patch provides a way to automatically add these \"exec\" lines\n>> between each commit applications. For instance, running 'git rebase -i\n>> --exec \"make test\"' lets you check that intermediate commits are\n>> compilable. It is also compatible with the option --autosquash. At\n>> this point, you can't use --exec without the interactive mode (-i).\n>>\n>> Tests about this new command are also added in\n>> t3404-rebase-interactive.sh.\n>\n>> Should now work on MacOS.\n>\n> Hej,\n> I'm not sure on which commit to apply the patch.\n> (may be we shoud improve git format-patch to tell us the original commit ID),\n> but if I remove the non applying part, it looks like this:\n\nWhich part does not apply ? If you skip the part that's implementing the\nexec option, of course Git will not recognize it.\n"},{"id":"193181","messageId":"7v8vfxd1j3.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"20120608210630.Horde.joXbQHwdC4BP0k02QgDFpMA@webmail.minatec.grenoble-inp.fr","subject":"Re: [PATCHv3 1/2] git-rebase.txt: \"--onto\" option updated","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-08T19:52:32Z","receivedAt":"2012-06-08T19:52:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"konglu@minatec.inpg.fr writes:\n\n> That's what I thought, but it appeared to me that the description\n>\n> --onto <newbase>::\n>          Starting point at which to create the new commits.\n>          If the --onto option is not specified, the starting\n>          point is <upstream>.  May be any valid commit, and\n> \tnot just an existing branch name.\n>\n> only focus on the parameter <newbase>.\n\nTalking about <newbase> is equivalent to talking about --onto isn't\nit?  What the command does is described far above upfront in the\nmanual page; the description of options is the place to explain what\ndetails are affected by giving (or not giving) the option in the\nbehaviour that was explained earlier.\n"},{"id":"193182","messageId":"4FD258AD.6070601@web.de","threadId":"30700","inReplyTo":"20120608211540.Horde.SRiCRHwdC4BP0k9c5TdWBaA@webmail.minatec.grenoble-inp.fr","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2012-06-08T19:55:25Z","receivedAt":"2012-06-08T19:55:25Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 08.06.12 21:15, konglu@minatec.inpg.fr wrote:\n> \n> Torsten Bögershausen <tboegi@web.de> a écrit :\n\n> Which part does not apply ? If you skip the part that's implementing the\n> exec option, of course Git will not recognize it.\n\n\nHej, \n2 questions:\na) Where should it apply ?\nI tried to apply it on commit f623ca1cae600e97cb0b38131fdd33e4fb669cf8\n\nb) Does the line from my log\n\"error: unknown option `exec'\" \ntell us anything?\n\n/Torsten\n"},{"id":"193184","messageId":"20120608220751.Horde.HHn7fXwdC4BP0luXQhxWxBA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"4FD258AD.6070601@web.de","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-08T20:07:51Z","receivedAt":"2012-06-08T20:07:51Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nTorsten Bögershausen <tboegi@web.de> a écrit :\n\n> On 08.06.12 21:15, konglu@minatec.inpg.fr wrote:\n>>\n>> Torsten Bögershausen <tboegi@web.de> a écrit :\n>\n>> Which part does not apply ? If you skip the part that's implementing the\n>> exec option, of course Git will not recognize it.\n>\n>\n> Hej,\n> 2 questions:\n> a) Where should it apply ?\n> I tried to apply it on commit f623ca1cae600e97cb0b38131fdd33e4fb669cf8\n\nI just tried to apply it on that commit and it works for me. What's the\nerror message ?\n\n> b) Does the line from my log\n> \"error: unknown option `exec'\"\n> tell us anything?\n\nYes, that the patch was not applied ^^'.\n"},{"id":"193185","messageId":"20120608220835.Horde.eP-uRXwdC4BP0lvDP2D2BYA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"7v8vfxd1j3.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCHv3 1/2] git-rebase.txt: \"--onto\" option updated","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-08T20:08:35Z","receivedAt":"2012-06-08T20:08:35Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nJunio C Hamano <gitster@pobox.com> a écrit :\n\n> konglu@minatec.inpg.fr writes:\n>\n>> That's what I thought, but it appeared to me that the description\n>>\n>> --onto <newbase>::\n>>          Starting point at which to create the new commits.\n>>          If the --onto option is not specified, the starting\n>>          point is <upstream>.  May be any valid commit, and\n>> \tnot just an existing branch name.\n>>\n>> only focus on the parameter <newbase>.\n>\n> Talking about <newbase> is equivalent to talking about --onto isn't\n> it?  What the command does is described far above upfront in the\n> manual page; the description of options is the place to explain what\n> details are affected by giving (or not giving) the option in the\n> behaviour that was explained earlier.\n\nAlright, gonna keep it unchanged then :).\n"},{"id":"193189","messageId":"4FD265C7.6050807@web.de","threadId":"30700","inReplyTo":"20120608220751.Horde.HHn7fXwdC4BP0luXQhxWxBA@webmail.minatec.grenoble-inp.fr","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2012-06-08T20:51:19Z","receivedAt":"2012-06-08T20:51:19Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 08.06.12 22:07, konglu@minatec.inpg.fr wrote:\n> \n> Torsten Bögershausen <tboegi@web.de> a écrit :\n> \n>> On 08.06.12 21:15, konglu@minatec.inpg.fr wrote:\n>>>\n>>> Torsten Bögershausen <tboegi@web.de> a écrit :\n>>\n>>> Which part does not apply ? If you skip the part that's implementing the\n>>> exec option, of course Git will not recognize it.\n>>\n>>\n>> Hej,\n>> 2 questions:\n>> a) Where should it apply ?\n>> I tried to apply it on commit f623ca1cae600e97cb0b38131fdd33e4fb669cf8\n> \n> I just tried to apply it on that commit and it works for me. What's the\n> error message ?\n> \n>> b) Does the line from my log\n>> \"error: unknown option `exec'\"\n>> tell us anything?\n> \n> Yes, that the patch was not applied ^^'.\n------------------------------------------------\nThat's the outcome, if I try to re-apply it:\nApplying: Fwd: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...\nerror: patch failed: Documentation/git-rebase.txt:210\nerror: Documentation/git-rebase.txt: patch does not apply\nPatch failed at 0001 Fwd: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...\nWhen you have resolved this problem run \"git am --resolved\".\nIf you would prefer to skip this patch, instead run \"git am --skip\".\nTo restore the original branch and stop patching run \"git am --abort\".\n=====================\nAnd after my fumbling, the diff looks like this (see below).\nIt seems that something changed, because the error line is different- \n\nSorry if I messed something up here, it looks as if the functionality implementing\nthe \"exec\" is missing in my code base.\nFor me it looks as if I only picked up the test cases, and I'm missing something.\n\nIn this case it would be helpful if you just re-send the patch to my email,\nand I can try to re-do the patch based on f623ca1cae600e97cb0b38,\nor whatever you specify.\nDoes that makes sense?\n/Torsten\n \n------------------------\ngit diff  f623ca1cae600e97cb0b38..63884a991c9d8\n=================================================\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 147fa1a..1dd95c4 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head\n SYNOPSIS\n --------\n [verse]\n-'git rebase' [-i | --interactive] [options] [--onto <newbase>]\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t[<upstream>] [<branch>]\n-'git rebase' [-i | --interactive] [options] --onto <newbase>\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>\n \t--root [<branch>]\n 'git rebase' --continue | --skip | --abort\n \n@@ -210,11 +210,29 @@ rebase.autosquash::\n \n OPTIONS\n -------\n-<newbase>::\n-\tStarting point at which to create the new commits. If the\n-\t--onto option is not specified, the starting point is\n-\t<upstream>.  May be any valid commit, and not just an\n-\texisting branch name.\n+-x <cmd>::\n+--exec <cmd>::\n+\tAutomatically add \"exec\" followed by <cmd> between each commit\n+\tapplications. Using this option along with --autosquash adds\n+\tthe exec line after the squash/fixeup series only. <cmd>\n+\tstands for shell commands. The --exec option has to be\n+\tspecified. (see INTERACTIVE MODE below)\n++\n+This has to be used along with the `--interactive` option explicitly.\n+You may execute several commands between each commit applications.\n+For this, you can use one instance of exec:\n+\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n+You can also insert several instances of exec, if you wish to\n+only have one command per line for example:\n+\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n+\n+--onto <newbase>::\n+\tWith this option, git rebase takes all commits from <branch>,\n+\tthat are not in <upstream>, and transplant them on top of\n+\t<newbase>. <newbase> is the starting point at which to create\n+\tthe new commits. If the --onto option is not specified, the\n+\tstarting point is <upstream>.  May be any valid commit, and\n+\tnot just an existing branch name.\n +\n As a special case, you may use \"A\\...B\" as a shortcut for the\n merge base of A and B if there is exactly one merge base. You can\n@@ -521,6 +539,28 @@ in `$SHELL`, or the default shell if `$SHELL` is not set), so you can\n use shell features (like \"cd\", \">\", \";\" ...). The command is run from\n the root of the working tree.\n \n+----------------------------------\n+$ git rebase -i --exec \"make test\"\n+----------------------------------\n+\n+This command lets you check that intermediate commits are compilable.\n+The todo list becomes like that:\n+\n+--------------------\n+pick 5928aea one\n+exec make test\n+pick 04d0fda two\n+exec make test\n+pick ba46169 three\n+exec make test\n+pick f4593f9 four\n+exec make test\n+--------------------\n+\n+If the option '-i' is missing, The command will return a message\n+error. If there is no <cmd> specified behind --exec, the command will\n+return a message error and the usage page of 'git rebase'.\n+\n SPLITTING COMMITS\n -----------------\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 0c19b7c..dc9e7e9 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -684,6 +684,22 @@ rearrange_squash () {\n \trm -f \"$1.sq\" \"$1.rearranged\"\n }\n \n+# Add commands after a pick or after a squash/fixup serie\n+# in the todo list.\n+add_exec_commands () {\n+\tOIFS=$IFS\n+\tIFS=$LF\n+\tfor i in $cmd\n+\tdo\n+\t\ttmp=$(sed \"/^pick .*/i\\exec $i\" \"$1\")\n+\t\techo \"$tmp\" >\"$1\"\n+\t\ttmp=$(sed '1d' \"$1\")\n+\t\techo \"$tmp\" >\"$1\"\n+\t\techo \"exec $i\" >>\"$1\"\n+\tdone\n+\tIFS=$OIFS\n+}\n+\n case \"$action\" in\n continue)\n \t# do we have anything to commit?\n@@ -857,6 +873,8 @@ fi\n \n test -s \"$todo\" || echo noop >> \"$todo\"\n test -n \"$autosquash\" && rearrange_squash \"$todo\"\n+test -n \"$cmd\" && add_exec_commands \"$todo\"\n+\n cat >> \"$todo\" << EOF\n \n # Rebase $shortrevisions onto $shortonto\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex e616737..87b21e3 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,7 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n+USAGE='[--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]\n+       [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n LONG_USAGE='git-rebase replaces <branch> with a new branch of the\n same name.  When the --onto option is provided the new branch starts\n out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>\n@@ -30,8 +31,8 @@ Example:       git-rebase master~1 topic\n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n-git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]\n-git rebase [-i] [options] --onto <newbase> --root [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] --onto <newbase> --root [<branch>]\n git-rebase [-i] --continue | --abort | --skip\n --\n  Available options are\n@@ -43,6 +44,7 @@ s,strategy=!       use the given merge strategy\n no-ff!             cherry-pick all commits, even if unchanged\n m,merge!           use merging strategies to rebase\n i,interactive!     let the user edit the list of commits to rebase\n+x,exec=!           add exec lines after each commit of the editable list\n k,keep-empty\t   preserve empty commits during rebase\n f,force-rebase!    force rebase even if branch is up to date\n X,strategy-option=! pass the argument through to the merge strategy\n@@ -76,6 +78,7 @@ If you would prefer to skip this patch, instead run \\\"git rebase --skip\\\".\n To check out the original branch and stop rebasing run \\\"git rebase --abort\\\".\n \"\n unset onto\n+cmd=\n strategy=\n strategy_opts=\n do_merge=\n@@ -220,6 +223,11 @@ do\n \t\tonto=\"$2\"\n \t\tshift\n \t\t;;\n+\t-x)\n+\t\ttest 2 -le \"$#\" || usage\n+\t\tcmd=\"${cmd:+\"$cmd$LF\"} $2\"\n+\t\tshift\n+\t\t;;\n \t-i)\n \t\tinteractive_rebase=explicit\n \t\t;;\n@@ -305,6 +313,12 @@ do\n done\n test $# -gt 2 && usage\n \n+if test -n \"$cmd\" &&\n+   test \"$interactive_rebase\" != explicit\n+then\n+\tdie \"--exec option must be used with --interactive option\\n\"\n+fi\n+\n if test -n \"$action\"\n then\n \ttest -z \"$in_progress\" && die \"No rebase in progress?\"\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 025c1c6..4fe98d5 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -755,4 +755,128 @@ test_expect_success 'rebase-i history with funny messages' '\n \ttest_cmp expect actual\n '\n \n+\n+test_expect_success 'prepare for rebase -i --exec' '\n+\tgit checkout master &&\n+\tgit checkout -b execute &&\n+\ttest_commit one_exec main.txt one_exec &&\n+\ttest_commit two_exec main.txt two_exec &&\n+\ttest_commit three_exec main.txt three_exec\n+'\n+\n+\n+test_expect_success 'running \"git rebase -i --exec git show HEAD\"' '\n+\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase --exec git show HEAD -i\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase --exec \"git show HEAD\" -i HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase -ix git show HEAD\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several <CMD>' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD; pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD;_pwd 2 exec_git_show_HEAD;_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,9d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several instances of --exec' '\n+\tgit reset --hard execute &&\n+\tgit rebase -i --exec \"git show HEAD\" --exec \"pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD exec_pwd 2\n+\t\t\t\texec_git_show_HEAD exec_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expected\n+\t) &&\n+\tsed '1,11d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with --autosquash' '\n+\tgit reset --hard execute &&\n+\tgit checkout -b autosquash &&\n+\techo second >second.txt &&\n+\tgit add second.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\techo bis >bis.txt &&\n+\tgit add bis.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\t(\n+\t\tgit checkout -b autosquash_actual &&\n+\t\tgit rebase -i --exec \"git show HEAD\" --autosquash HEAD~4 >actual\n+\t) &&\n+\tgit checkout autosquash &&\n+\t(\n+\t\tgit checkout -b autosquash_expected &&\n+\t\tFAKE_LINES=\"1 fixup 3 fixup 4 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~4 >expected\n+\t) &&\n+\tsed '1,13d' expected >expect &&\n+\tmv expect expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase --exec without -i shows error message' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase --exec \"git show HEAD\" HEAD~2 2>actual &&\n+\techo \"--exec option must be used with --interactive option\\n\" >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -i --exec without <CMD> shows error message and usage' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase -i --exec 2>actual &&\n+\tsed '1d' actual >tmp &&\n+\tmv tmp actual &&\n+\ttest_must_fail git rebase -h >expected &&\n+\ttest_cmp expected actual &&\n+\tgit checkout master\n+'\n+\n test_done\n"},{"id":"193190","messageId":"20120608230327.Horde.IXfFTHwdC4BP0mifi63m9KA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"4FD265C7.6050807@web.de","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-08T21:03:27Z","receivedAt":"2012-06-08T21:03:27Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nTorsten Bögershausen <tboegi@web.de> a écrit :\n\n> On 08.06.12 22:07, konglu@minatec.inpg.fr wrote:\n>>\n>> Torsten Bögershausen <tboegi@web.de> a écrit :\n>>\n>>> On 08.06.12 21:15, konglu@minatec.inpg.fr wrote:\n>>>>\n>>>> Torsten Bögershausen <tboegi@web.de> a écrit :\n>>>\n>>>> Which part does not apply ? If you skip the part that's implementing the\n>>>> exec option, of course Git will not recognize it.\n>>>\n>>>\n>>> Hej,\n>>> 2 questions:\n>>> a) Where should it apply ?\n>>> I tried to apply it on commit f623ca1cae600e97cb0b38131fdd33e4fb669cf8\n>>\n>> I just tried to apply it on that commit and it works for me. What's the\n>> error message ?\n>>\n>>> b) Does the line from my log\n>>> \"error: unknown option `exec'\"\n>>> tell us anything?\n>>\n>> Yes, that the patch was not applied ^^'.\n> ------------------------------------------------\n> That's the outcome, if I try to re-apply it:\n> Applying: Fwd: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...\n> error: patch failed: Documentation/git-rebase.txt:210\n> error: Documentation/git-rebase.txt: patch does not apply\n> Patch failed at 0001 Fwd: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...\n> When you have resolved this problem run \"git am --resolved\".\n> If you would prefer to skip this patch, instead run \"git am --skip\".\n> To restore the original branch and stop patching run \"git am --abort\".\n\nDid you first apply the first part [PATCHv3 1/2] of the patch ?\n\nLucien Kong.\n"},{"id":"193202","messageId":"4FD2E9B5.1010709@web.de","threadId":"30700","inReplyTo":"20120608230327.Horde.IXfFTHwdC4BP0mifi63m9KA@webmail.minatec.grenoble-inp.fr","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2012-06-09T06:14:13Z","receivedAt":"2012-06-09T06:14:13Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 08.06.12 23:03, konglu@minatec.inpg.fr wrote:\n> \n> Torsten Bögershausen <tboegi@web.de> a écrit :\n> \n>> On 08.06.12 22:07, konglu@minatec.inpg.fr wrote:\n>>>\n>>> Torsten Bögershausen <tboegi@web.de> a écrit :\n>>>\n>>>> On 08.06.12 21:15, konglu@minatec.inpg.fr wrote:\n>>>>>\n>>>>> Torsten Bögershausen <tboegi@web.de> a écrit :\n>>>>\n>>>>> Which part does not apply ? If you skip the part that's implementing the\n>>>>> exec option, of course Git will not recognize it.\n>>>>\n>>>>\n>>>> Hej,\n>>>> 2 questions:\n>>>> a) Where should it apply ?\n>>>> I tried to apply it on commit f623ca1cae600e97cb0b38131fdd33e4fb669cf8\n>>>\n>>> I just tried to apply it on that commit and it works for me. What's the\n>>> error message ?\n>>>\n>>>> b) Does the line from my log\n>>>> \"error: unknown option `exec'\"\n>>>> tell us anything?\n>>>\n>>> Yes, that the patch was not applied ^^'.\n>> ------------------------------------------------\n>> That's the outcome, if I try to re-apply it:\n>> Applying: Fwd: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...\n>> error: patch failed: Documentation/git-rebase.txt:210\n>> error: Documentation/git-rebase.txt: patch does not apply\n>> Patch failed at 0001 Fwd: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...\n>> When you have resolved this problem run \"git am --resolved\".\n>> If you would prefer to skip this patch, instead run \"git am --skip\".\n>> To restore the original branch and stop patching run \"git am --abort\".\n> \n> Did you first apply the first part [PATCHv3 1/2] of the patch ?\n> \n> Lucien Kong.\nHej,\nI have 2 patches with the headline \"[PATCHv3 1/2\" in my in box.\nNone of them is dealing in any kind with upgrading a command to understand \"exec\".\n\nTo be able to test under Mac OS it could be helpful if you just re-send\none patch to my email.\nThen I can try to re-do the patch based on f623ca1cae600e97cb0b38 and\ntest it under Mac OS.\n\nDoes that makes sense?\n\n/Torsten\n"},{"id":"193204","messageId":"20120609084707.Horde.CGejZXwdC4BP0vFrryT2xDA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"4FD2E9B5.1010709@web.de","subject":"Re: [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD>...","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-09T06:47:07Z","receivedAt":"2012-06-09T06:47:07Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nTorsten Bögershausen <tboegi@web.de> a écrit :\n\n> Hej,\n> I have 2 patches with the headline \"[PATCHv3 1/2\" in my in box.\n> None of them is dealing in any kind with upgrading a command to  \n> understand \"exec\".\n\nHere you can see the thread of the discussion:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/199497\n\n> To be able to test under Mac OS it could be helpful if you just re-send\n> one patch to my email.\n> Then I can try to re-do the patch based on f623ca1cae600e97cb0b38 and\n> test it under Mac OS.\n\nAlright, gonna send you the patch in one part so that it can be applied\nalone :).\n\nLucien Kong\n"},{"id":"193242","messageId":"1339325076-474-1-git-send-email-Lucien.Kong@ensimag.imag.fr","threadId":"30700","inReplyTo":"1339167235-2009-2-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"[PATCHv4] rebase [-i --exec | -ix] <CMD>...","fromName":"Lucien Kong","fromEmail":"lucien.kong@ensimag.imag.fr","sentAt":"2012-06-10T10:44:36Z","receivedAt":"2012-06-10T10:44:36Z","isPatch":false,"sender":{"key":"lucien.kong@ensimag.imag.fr","avatar":null},"body":"This patch provides a way to automatically add these \"exec\" lines\nbetween each commit applications. For instance, running 'git rebase -i\n--exec \"make test\"' lets you check that intermediate commits are\ncompilable. It is also compatible with the option --autosquash. At\nthis point, you can't use --exec without the interactive mode (-i).\n\nTests about this new command are also added in\nt3404-rebase-interactive.sh.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr>\nSigned-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>\nSigned-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>\nSigned-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>\nSigned-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n---\nThe change in git-rebase.txt about the option --onto\nwas done in another patch. This patch can be applied\nindependently.\n\n Documentation/git-rebase.txt  |   43 ++++++++++++++-\n git-rebase--interactive.sh    |   23 ++++++++\n git-rebase.sh                 |   20 ++++++-\n t/t3404-rebase-interactive.sh |  118 +++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 199 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 147fa1a..a2f1514 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head\n SYNOPSIS\n --------\n [verse]\n-'git rebase' [-i | --interactive] [options] [--onto <newbase>]\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t[<upstream>] [<branch>]\n-'git rebase' [-i | --interactive] [options] --onto <newbase>\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>\n \t--root [<branch>]\n 'git rebase' --continue | --skip | --abort\n \n@@ -210,6 +210,27 @@ rebase.autosquash::\n \n OPTIONS\n -------\n+-x <cmd>::\n+--exec <cmd>::\n+\tAppend \"exec <cmd>\" after each commit application line. <cmd>\n+\twill be interpreted as one or more shell commands (see\n+\tINTERACTIVE MODE below).\n++\n+This option has to be used along with the `--interactive` option\n+explicitly.  You may execute several commands between each commit\n+applications.  For this, you can use one instance of exec:\n++\n+\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n++\n+You can also insert several instances of exec, if you wish to only\n+have one command per line. For example:\n++\n+\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n++\n+If --autosquash is used, the \"exec\" lines will not be appended for the\n+intermediate commits, and will only appear at the end of each\n+squash/fixup series.\n+\n <newbase>::\n \tStarting point at which to create the new commits. If the\n \t--onto option is not specified, the starting point is\n@@ -521,6 +542,24 @@ in `$SHELL`, or the default shell if `$SHELL` is not set), so you can\n use shell features (like \"cd\", \">\", \";\" ...). The command is run from\n the root of the working tree.\n \n+----------------------------------\n+$ git rebase -i --exec \"make test\"\n+----------------------------------\n+\n+This command lets you check that intermediate commits are compilable.\n+The todo list becomes like that:\n+\n+--------------------\n+pick 5928aea one\n+exec make test\n+pick 04d0fda two\n+exec make test\n+pick ba46169 three\n+exec make test\n+pick f4593f9 four\n+exec make test\n+--------------------\n+\n SPLITTING COMMITS\n -----------------\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 0c19b7c..5f56672 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -684,6 +684,27 @@ rearrange_squash () {\n \trm -f \"$1.sq\" \"$1.rearranged\"\n }\n \n+# Add commands after a pick or after a squash/fixup serie\n+# in the todo list.\n+add_exec_commands () {\n+\t{\n+\t\tfirst=t\n+\t\twhile read -r insn rest\n+\t\tdo\n+\t\t\tcase $insn in\n+\t\t\tpick)\n+\t\t\t\ttest -n \"$first\" ||\n+\t\t\t\tprintf \"%s\" \"$cmd\"\n+\t\t\t\t;;\n+\t\t\tesac\n+\t\t\tprintf \"%s %s\\n\" \"$insn\" \"$rest\"\n+\t\t\tfirst=\n+\t\tdone\n+\t\tprintf \"%s\" \"$cmd\"\n+\t} <\"$1\" >\"$1.new\" &&\n+\tmv \"$1.new\" \"$1\"\n+}\n+\n case \"$action\" in\n continue)\n \t# do we have anything to commit?\n@@ -857,6 +878,8 @@ fi\n \n test -s \"$todo\" || echo noop >> \"$todo\"\n test -n \"$autosquash\" && rearrange_squash \"$todo\"\n+test -n \"$cmd\" && add_exec_commands \"$todo\"\n+\n cat >> \"$todo\" << EOF\n \n # Rebase $shortrevisions onto $shortonto\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 24a2840..2952bc0 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,7 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n+USAGE='[--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]\n+       [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n LONG_USAGE='git-rebase replaces <branch> with a new branch of the\n same name.  When the --onto option is provided the new branch starts\n out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>\n@@ -30,8 +31,8 @@ Example:       git-rebase master~1 topic\n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n-git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]\n-git rebase [-i] [options] --onto <newbase> --root [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] --onto <newbase> --root [<branch>]\n git-rebase [-i] --continue | --abort | --skip\n --\n  Available options are\n@@ -43,6 +44,7 @@ s,strategy=!       use the given merge strategy\n no-ff!             cherry-pick all commits, even if unchanged\n m,merge!           use merging strategies to rebase\n i,interactive!     let the user edit the list of commits to rebase\n+x,exec=!           add exec lines after each commit of the editable list\n k,keep-empty\t   preserve empty commits during rebase\n f,force-rebase!    force rebase even if branch is up to date\n X,strategy-option=! pass the argument through to the merge strategy\n@@ -76,6 +78,7 @@ If you would prefer to skip this patch, instead run \\\"git rebase --skip\\\".\n To check out the original branch and stop rebasing run \\\"git rebase --abort\\\".\n \"\n unset onto\n+cmd=\n strategy=\n strategy_opts=\n do_merge=\n@@ -219,6 +222,11 @@ do\n \t\tonto=\"$2\"\n \t\tshift\n \t\t;;\n+\t-x)\n+\t\ttest 2 -le \"$#\" || usage\n+\t\tcmd=\"${cmd}exec $2${LF}\"\n+\t\tshift\n+\t\t;;\n \t-i)\n \t\tinteractive_rebase=explicit\n \t\t;;\n@@ -304,6 +312,12 @@ do\n done\n test $# -gt 2 && usage\n \n+if test -n \"$cmd\" &&\n+   test \"$interactive_rebase\" != explicit\n+then\n+\tdie \"--exec option must be used with --interactive option\"\n+fi\n+\n if test -n \"$action\"\n then\n \ttest -z \"$in_progress\" && die \"No rebase in progress?\"\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 025c1c6..600519c 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -755,4 +755,122 @@ test_expect_success 'rebase-i history with funny messages' '\n \ttest_cmp expect actual\n '\n \n+\n+test_expect_success 'prepare for rebase -i --exec' '\n+\tgit checkout master &&\n+\tgit checkout -b execute &&\n+\ttest_commit one_exec main.txt one_exec &&\n+\ttest_commit two_exec main.txt two_exec &&\n+\ttest_commit three_exec main.txt three_exec\n+'\n+\n+\n+test_expect_success 'running \"git rebase -i --exec git show HEAD\"' '\n+\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase --exec git show HEAD -i\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase --exec \"git show HEAD\" -i HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase -ix git show HEAD\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several <CMD>' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD; pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD;_pwd 2 exec_git_show_HEAD;_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several instances of --exec' '\n+\tgit reset --hard execute &&\n+\tgit rebase -i --exec \"git show HEAD\" --exec \"pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD exec_pwd 2\n+\t\t\t\texec_git_show_HEAD exec_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,11d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with --autosquash' '\n+\tgit reset --hard execute &&\n+\tgit checkout -b autosquash &&\n+\techo second >second.txt &&\n+\tgit add second.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\techo bis >bis.txt &&\n+\tgit add bis.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\t(\n+\t\tgit checkout -b autosquash_actual &&\n+\t\tgit rebase -i --exec \"git show HEAD\" --autosquash HEAD~4 >actual\n+\t) &&\n+\tgit checkout autosquash &&\n+\t(\n+\t\tgit checkout -b autosquash_expected &&\n+\t\tFAKE_LINES=\"1 fixup 3 fixup 4 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~4 >expect\n+\t) &&\n+\tsed -e \"1,13d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase --exec without -i shows error message' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase --exec \"git show HEAD\" HEAD~2 2>actual &&\n+\techo \"--exec option must be used with --interactive option\" >expected &&\n+\ttest_i18ncmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -i --exec without <CMD> shows error message and usage' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase -i --exec 2>actual &&\n+\tsed '1d' actual >tmp &&\n+\tmv tmp actual &&\n+\ttest_must_fail git rebase -h >expected &&\n+\ttest_cmp expected actual &&\n+\tgit checkout master\n+'\n+\n test_done\n-- \n1.7.8\n"},{"id":"193250","messageId":"4FD48B70.5080600@kdbg.org","threadId":"30700","inReplyTo":"1339325076-474-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv4] rebase [-i --exec | -ix] <CMD>...","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-06-10T11:56:32Z","receivedAt":"2012-06-10T11:56:32Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.06.2012 12:44, schrieb Lucien Kong:\n> +test_expect_success 'rebase -i --exec without <CMD> shows error message and usage' '\n> +\tgit reset --hard execute &&\n> +\ttest_must_fail git rebase -i --exec 2>actual &&\n> +\tsed '1d' actual >tmp &&\n> +\tmv tmp actual &&\n> +\ttest_must_fail git rebase -h >expected &&\n> +\ttest_cmp expected actual &&\n> +\tgit checkout master\n> +'\n\nIMO, it is more important to check that the error message is present\nrather than whether the usage blurb is correct. But since the error is\ngenerated by the option parsing machinery, it is probably sufficient to\ncheck *only* for failure, and don't verify the output at all.\n\nThen change the headline of the text to the neutral\n\ntest_expect_success 'rebase -i --exec without <CMD>' '\n\nAnd, BTW, next time I point out that sed 'xy'... should be changed to\nsed -e \"xy\"... you review *ALL* sed commands you introduce, not just\nthose that I point out, OK?\n\nAnd, BTW, when I point out that ...>expected && sed <expected >expect &&\nmv expect expected should be ...>expect && sed <expect >expected, you\nextrapolate *yourself* that the same pattern applies even if the files\nare named \"tmp\" and \"actual\", OK?\n\nThat's expected from thoughtful contributors.\n\n-- Hannes\n"},{"id":"193311","messageId":"7vpq9598yb.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"4FD48B70.5080600@kdbg.org","subject":"Re: [PATCHv4] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-11T15:14:52Z","receivedAt":"2012-06-11T15:14:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Am 10.06.2012 12:44, schrieb Lucien Kong:\n>> +test_expect_success 'rebase -i --exec without <CMD> shows error message and usage' '\n>> +\tgit reset --hard execute &&\n>> +\ttest_must_fail git rebase -i --exec 2>actual &&\n>> +\tsed '1d' actual >tmp &&\n>> +\tmv tmp actual &&\n>> +\ttest_must_fail git rebase -h >expected &&\n>> +\ttest_cmp expected actual &&\n>> +\tgit checkout master\n>> +'\n>\n> IMO, it is more important to check that the error message is present\n> rather than whether the usage blurb is correct. But since the error is\n> generated by the option parsing machinery, it is probably sufficient to\n> check *only* for failure, and don't verify the output at all.\n>\n> Then change the headline of the text to the neutral\n>\n> test_expect_success 'rebase -i --exec without <CMD>' '\n\nMakes sense; thanks for a thoughtful suggestion.\n\n> And, BTW, next time I point out that sed 'xy'... should be changed to\n> sed -e \"xy\"... you review *ALL* sed commands you introduce, not just\n> those that I point out, OK?\n>\n> And, BTW, when I point out that ...>expected && sed <expected >expect &&\n> mv expect expected should be ...>expect && sed <expect >expected, you\n> extrapolate *yourself* that the same pattern applies even if the files\n> are named \"tmp\" and \"actual\", OK?\n>\n> That's expected from thoughtful contributors.\n>\n> -- Hannes\n"},{"id":"193420","messageId":"1339488312-6349-1-git-send-email-Lucien.Kong@ensimag.imag.fr","threadId":"30700","inReplyTo":"1339325076-474-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"[PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Lucien Kong","fromEmail":"lucien.kong@ensimag.imag.fr","sentAt":"2012-06-12T08:05:12Z","receivedAt":"2012-06-12T08:05:12Z","isPatch":false,"sender":{"key":"lucien.kong@ensimag.imag.fr","avatar":null},"body":"This patch provides a way to automatically add these \"exec\" lines\nbetween each commit applications. For instance, running 'git rebase -i\n--exec \"make test\"' lets you check that intermediate commits are\ncompilable. It is also compatible with the option --autosquash. At\nthis point, you can't use --exec without the interactive mode (-i).\n\nTests about this new command are also added in\nt3404-rebase-interactive.sh.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr>\nSigned-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>\nSigned-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>\nSigned-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>\nSigned-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n---\nThe last test is changed to be consistent with the other\n(thanks Johannes for reviewing the code).\n\n Documentation/git-rebase.txt  |   43 ++++++++++++++-\n git-rebase--interactive.sh    |   23 ++++++++\n git-rebase.sh                 |   20 ++++++-\n t/t3404-rebase-interactive.sh |  117 +++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 198 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 147fa1a..a2f1514 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head\n SYNOPSIS\n --------\n [verse]\n-'git rebase' [-i | --interactive] [options] [--onto <newbase>]\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t[<upstream>] [<branch>]\n-'git rebase' [-i | --interactive] [options] --onto <newbase>\n+'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>\n \t--root [<branch>]\n 'git rebase' --continue | --skip | --abort\n \n@@ -210,6 +210,27 @@ rebase.autosquash::\n \n OPTIONS\n -------\n+-x <cmd>::\n+--exec <cmd>::\n+\tAppend \"exec <cmd>\" after each commit application line. <cmd>\n+\twill be interpreted as one or more shell commands (see\n+\tINTERACTIVE MODE below).\n++\n+This option has to be used along with the `--interactive` option\n+explicitly.  You may execute several commands between each commit\n+applications.  For this, you can use one instance of exec:\n++\n+\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n++\n+You can also insert several instances of exec, if you wish to only\n+have one command per line. For example:\n++\n+\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n++\n+If --autosquash is used, the \"exec\" lines will not be appended for the\n+intermediate commits, and will only appear at the end of each\n+squash/fixup series.\n+\n <newbase>::\n \tStarting point at which to create the new commits. If the\n \t--onto option is not specified, the starting point is\n@@ -521,6 +542,24 @@ in `$SHELL`, or the default shell if `$SHELL` is not set), so you can\n use shell features (like \"cd\", \">\", \";\" ...). The command is run from\n the root of the working tree.\n \n+----------------------------------\n+$ git rebase -i --exec \"make test\"\n+----------------------------------\n+\n+This command lets you check that intermediate commits are compilable.\n+The todo list becomes like that:\n+\n+--------------------\n+pick 5928aea one\n+exec make test\n+pick 04d0fda two\n+exec make test\n+pick ba46169 three\n+exec make test\n+pick f4593f9 four\n+exec make test\n+--------------------\n+\n SPLITTING COMMITS\n -----------------\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 0c19b7c..5f56672 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -684,6 +684,27 @@ rearrange_squash () {\n \trm -f \"$1.sq\" \"$1.rearranged\"\n }\n \n+# Add commands after a pick or after a squash/fixup serie\n+# in the todo list.\n+add_exec_commands () {\n+\t{\n+\t\tfirst=t\n+\t\twhile read -r insn rest\n+\t\tdo\n+\t\t\tcase $insn in\n+\t\t\tpick)\n+\t\t\t\ttest -n \"$first\" ||\n+\t\t\t\tprintf \"%s\" \"$cmd\"\n+\t\t\t\t;;\n+\t\t\tesac\n+\t\t\tprintf \"%s %s\\n\" \"$insn\" \"$rest\"\n+\t\t\tfirst=\n+\t\tdone\n+\t\tprintf \"%s\" \"$cmd\"\n+\t} <\"$1\" >\"$1.new\" &&\n+\tmv \"$1.new\" \"$1\"\n+}\n+\n case \"$action\" in\n continue)\n \t# do we have anything to commit?\n@@ -857,6 +878,8 @@ fi\n \n test -s \"$todo\" || echo noop >> \"$todo\"\n test -n \"$autosquash\" && rearrange_squash \"$todo\"\n+test -n \"$cmd\" && add_exec_commands \"$todo\"\n+\n cat >> \"$todo\" << EOF\n \n # Rebase $shortrevisions onto $shortonto\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 24a2840..2952bc0 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -3,7 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano.\n #\n \n-USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n+USAGE='[--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]\n+       [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'\n LONG_USAGE='git-rebase replaces <branch> with a new branch of the\n same name.  When the --onto option is provided the new branch starts\n out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>\n@@ -30,8 +31,8 @@ Example:       git-rebase master~1 topic\n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n OPTIONS_SPEC=\"\\\n-git rebase [-i] [options] [--onto <newbase>] [<upstream>] [<branch>]\n-git rebase [-i] [options] --onto <newbase> --root [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n+git rebase [-i] [options] [--exec <cmd>] --onto <newbase> --root [<branch>]\n git-rebase [-i] --continue | --abort | --skip\n --\n  Available options are\n@@ -43,6 +44,7 @@ s,strategy=!       use the given merge strategy\n no-ff!             cherry-pick all commits, even if unchanged\n m,merge!           use merging strategies to rebase\n i,interactive!     let the user edit the list of commits to rebase\n+x,exec=!           add exec lines after each commit of the editable list\n k,keep-empty\t   preserve empty commits during rebase\n f,force-rebase!    force rebase even if branch is up to date\n X,strategy-option=! pass the argument through to the merge strategy\n@@ -76,6 +78,7 @@ If you would prefer to skip this patch, instead run \\\"git rebase --skip\\\".\n To check out the original branch and stop rebasing run \\\"git rebase --abort\\\".\n \"\n unset onto\n+cmd=\n strategy=\n strategy_opts=\n do_merge=\n@@ -219,6 +222,11 @@ do\n \t\tonto=\"$2\"\n \t\tshift\n \t\t;;\n+\t-x)\n+\t\ttest 2 -le \"$#\" || usage\n+\t\tcmd=\"${cmd}exec $2${LF}\"\n+\t\tshift\n+\t\t;;\n \t-i)\n \t\tinteractive_rebase=explicit\n \t\t;;\n@@ -304,6 +312,12 @@ do\n done\n test $# -gt 2 && usage\n \n+if test -n \"$cmd\" &&\n+   test \"$interactive_rebase\" != explicit\n+then\n+\tdie \"--exec option must be used with --interactive option\"\n+fi\n+\n if test -n \"$action\"\n then\n \ttest -z \"$in_progress\" && die \"No rebase in progress?\"\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 025c1c6..68d6148 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -755,4 +755,121 @@ test_expect_success 'rebase-i history with funny messages' '\n \ttest_cmp expect actual\n '\n \n+\n+test_expect_success 'prepare for rebase -i --exec' '\n+\tgit checkout master &&\n+\tgit checkout -b execute &&\n+\ttest_commit one_exec main.txt one_exec &&\n+\ttest_commit two_exec main.txt two_exec &&\n+\ttest_commit three_exec main.txt three_exec\n+'\n+\n+\n+test_expect_success 'running \"git rebase -i --exec git show HEAD\"' '\n+\tgit rebase -i --exec \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase --exec git show HEAD -i\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase --exec \"git show HEAD\" -i HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'running \"git rebase -ix git show HEAD\"' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several <CMD>' '\n+\tgit reset --hard execute &&\n+\tgit rebase -ix \"git show HEAD; pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD;_pwd 2 exec_git_show_HEAD;_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,9d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with several instances of --exec' '\n+\tgit reset --hard execute &&\n+\tgit rebase -i --exec \"git show HEAD\" --exec \"pwd\" HEAD~2 >actual &&\n+\t(\n+\t\tFAKE_LINES=\"1 exec_git_show_HEAD exec_pwd 2\n+\t\t\t\texec_git_show_HEAD exec_pwd\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~2 >expect\n+\t) &&\n+\tsed -e \"1,11d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -ix with --autosquash' '\n+\tgit reset --hard execute &&\n+\tgit checkout -b autosquash &&\n+\techo second >second.txt &&\n+\tgit add second.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\techo bis >bis.txt &&\n+\tgit add bis.txt &&\n+\tgit commit -m \"fixup! two_exec\" &&\n+\t(\n+\t\tgit checkout -b autosquash_actual &&\n+\t\tgit rebase -i --exec \"git show HEAD\" --autosquash HEAD~4 >actual\n+\t) &&\n+\tgit checkout autosquash &&\n+\t(\n+\t\tgit checkout -b autosquash_expected &&\n+\t\tFAKE_LINES=\"1 fixup 3 fixup 4 exec_git_show_HEAD 2 exec_git_show_HEAD\" &&\n+\t\texport FAKE_LINES &&\n+\t\tgit rebase -i HEAD~4 >expect\n+\t) &&\n+\tsed -e \"1,13d\" expect >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase --exec without -i shows error message' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase --exec \"git show HEAD\" HEAD~2 2>actual &&\n+\techo \"--exec option must be used with --interactive option\" >expected &&\n+\ttest_i18ncmp expected actual\n+'\n+\n+\n+test_expect_success 'rebase -i --exec without <CMD>' '\n+\tgit reset --hard execute &&\n+\ttest_must_fail git rebase -i --exec 2>tmp &&\n+\tsed -e \"1d\" tmp >actual &&\n+\ttest_must_fail git rebase -h >expected &&\n+\ttest_cmp expected actual &&\n+\tgit checkout master\n+'\n+\n test_done\n-- \n1.7.8\n"},{"id":"193424","messageId":"4FD70A8E.7050502@in.waw.pl","threadId":"30700","inReplyTo":"1339488312-6349-1-git-send-email-Lucien.Kong@ensimag.imag.fr","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-06-12T09:23:26Z","receivedAt":"2012-06-12T09:23:26Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 06/12/2012 10:05 AM, Lucien Kong wrote:\n> +-x <cmd>::\n> +--exec <cmd>::\n> +\tAppend \"exec <cmd>\" after each commit application line. <cmd>\n> +\twill be interpreted as one or more shell commands (see\n> +\tINTERACTIVE MODE below).\n> ++\n> +This option has to be used along with the `--interactive` option\n> +explicitly.  You may execute several commands between each commit\n> +applications.  For this, you can use one instance of exec:\nHi,\n\nthis is still grammatically fishy, and has \"between each commit\napplications\", which was corrected above, but not here.\n\n> +\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n> ++\n> +You can also insert several instances of exec, if you wish to only\n> +have one command per line. For example:\ns/instances of exec/instances of --exec/\n\n> +\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n> ++\n> +If --autosquash is used, the \"exec\" lines will not be appended for the\n> +intermediate commits, and will only appear at the end of each\n> +squash/fixup series.\n> +\n\nZbyszek\n"},{"id":"193446","messageId":"7vk3zc4mgz.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"4FD70A8E.7050502@in.waw.pl","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-12T14:46:20Z","receivedAt":"2012-06-12T14:46:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n\n> On 06/12/2012 10:05 AM, Lucien Kong wrote:\n>> +-x <cmd>::\n>> +--exec <cmd>::\n>> +\tAppend \"exec <cmd>\" after each commit application line. <cmd>\n>> +\twill be interpreted as one or more shell commands (see\n>> +\tINTERACTIVE MODE below).\n>> ++\n>> +This option has to be used along with the `--interactive` option\n>> +explicitly.  You may execute several commands between each commit\n>> +applications.  For this, you can use one instance of exec:\n> Hi,\n>\n> this is still grammatically fishy, and has \"between each commit\n> applications\", which was corrected above, but not here.\n\nNot just grammo, but \"between\" is not correct, as there will be the\nfinal test after the last \"pick\".\n\n>> +\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n>> ++\n>> +You can also insert several instances of exec, if you wish to only\n>> +have one command per line. For example:\n> s/instances of exec/instances of --exec/\n\nNot just that, in the explanation part, we tend to spell `--exec` to\nmake the part that needs to be literally typed stand out (also we\nwant to see dash-dash, not em-dash, in the formatted output).\n\n>> +\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n>> ++\n>> +If --autosquash is used, the \"exec\" lines will not be appended for the\n>> +intermediate commits, and will only appear at the end of each\n>> +squash/fixup series.\n>> +\n\nSame for `--autosquash`.\n\nI do not think it is worth another round of resend at this point, so\nplease eyeball the version I fixed up and queued in 'pu' when it is\npushed out.  I also moved the '-x <cmd>::' option description to\nwhere it belongs (iow, not at the very beginning).\n"},{"id":"193482","messageId":"4FD790AF.5070108@kdbg.org","threadId":"30700","inReplyTo":"7vpq9598yb.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCHv4] rebase [-i --exec | -ix] <CMD>...","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-06-12T18:55:43Z","receivedAt":"2012-06-12T18:55:43Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 11.06.2012 17:14, schrieb Junio C Hamano:\n> Johannes Sixt <j6t@kdbg.org> writes:\n> \n>> Am 10.06.2012 12:44, schrieb Lucien Kong:\n>>> +test_expect_success 'rebase -i --exec without <CMD> shows error message and usage' '\n>>> +\tgit reset --hard execute &&\n>>> +\ttest_must_fail git rebase -i --exec 2>actual &&\n>>> +\tsed '1d' actual >tmp &&\n>>> +\tmv tmp actual &&\n>>> +\ttest_must_fail git rebase -h >expected &&\n>>> +\ttest_cmp expected actual &&\n>>> +\tgit checkout master\n>>> +'\n>>\n>> IMO, it is more important to check that the error message is present\n>> rather than whether the usage blurb is correct. But since the error is\n>> generated by the option parsing machinery, it is probably sufficient to\n>> check *only* for failure, and don't verify the output at all.\n\nI changed my mind. If option parsing regresses in such a way that --exec\nsuddenly works without command, then the 'test_must_fail git rebase ...'\ncould pass because there is a failure much later in the rebase process,\nwhich we would not detect if we do not check the output. It is therefore\ngood to check whether the expected failure happens during option parsing.\n\nChecking the usage blurb rather than the error message even has\nadvantages: it is immune to changes of the error messages and to i18n\npoisoning.\n\nIn this light, the version you have queued is fine.\n\n-- Hannes\n"},{"id":"193498","messageId":"7v4nqgjmu6.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"4FD790AF.5070108@kdbg.org","subject":"Re: [PATCHv4] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-12T20:29:21Z","receivedAt":"2012-06-12T20:29:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Checking the usage blurb rather than the error message even has\n> advantages: it is immune to changes of the error messages and to i18n\n> poisoning.\n\nYes, to a degree.  There is no guarantee that the error message\nstays on a single line in a particular l10n ;-).\n\n> In this light, the version you have queued is fine.\n"},{"id":"193540","messageId":"4FD89DD6.1070705@in.waw.pl","threadId":"30700","inReplyTo":"7vk3zc4mgz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-06-13T14:04:06Z","receivedAt":"2012-06-13T14:04:06Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 06/12/2012 04:46 PM, Junio C Hamano wrote:\n> I do not think it is worth another round of resend at this point, so\n> please eyeball the version I fixed up and queued in 'pu' when it is\n> pushed out.  I also moved the '-x <cmd>::' option description to\n> where it belongs (iow, not at the very beginning).\n\nHi,\nI think some small changes are still in order. Please consider\nsquashing this in:\n\n-----8<------\nSubject: [PATCH] squash! rebase -i: teach \"--exec <cmd>\"\n\nIn the commit message: s/each runs/each run/\n\nFixup to the documentation part:\n- Use the phrase \"after each commit in the final history\" from Junio's\n  commit message to replace \"each commit application\". The latter is\n  awkward and not really true.\n- Reorder paragraphs and reword the one about --interactive.\n  Make the part about two forms of exec less verbose.\n- Replace ';' with '&&' in the example. This (a) makes the two\n  examples equivalent, and (b) encourages good practice that we try\n  to follow in git tests to never fail silently. People are likely\n  to copy the example verbatim.\n---\n Documentation/git-rebase.txt | 23 ++++++++++++-----------\n 1 file changed, 12 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 048da64..179ab77 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -346,22 +346,23 @@ idea unless you know what you are doing (see BUGS\nbelow).\n\n -x <cmd>::\n --exec <cmd>::\n-\tAppend \"exec <cmd>\" after each commit application line. <cmd>\n-\twill be interpreted as one or more shell commands (see\n-\tINTERACTIVE MODE below).\n+\tAppend \"exec <cmd>\" after each line creating a commit in the\n+\tfinal history. <cmd> will be interpreted as one or more shell\n+\tcommands.\n +\n-This option has to be used along with the `--interactive` option\n-explicitly.  You may execute several commands after each commit\n-application.  For this, you can use one instance of `--exec`:\n+This option can only be used with the `--interactive` option\n+(see INTERACTIVE MODE below).\n +\n-\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n+You may execute several commands by either using one instance of `--exec`\n+with several commands:\n +\n-You can also insert several instances of `--exec`, if you wish to only\n-have one command per line. For example:\n+\tgit rebase -i --exec \"cmd1 && cmd2 && ...\"\n +\n-\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n+or equivalently by giving more than one `--exec`:\n +\n-If `--autosquash` is used, the \"exec\" lines will not be appended for\n+\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" --exec ...\n++\n+If `--autosquash` is used, \"exec\" lines will not be appended for\n the intermediate commits, and will only appear at the end of each\n squash/fixup series.\n\n-- \n1.7.11.rc3.129.ga90bc7a.dirty\n-----8<------\n\nZbyszek\n"},{"id":"193557","messageId":"7vvcivglsd.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"4FD89DD6.1070705@in.waw.pl","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-13T17:32:34Z","receivedAt":"2012-06-13T17:32:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n\n> On 06/12/2012 04:46 PM, Junio C Hamano wrote:\n>> I do not think it is worth another round of resend at this point, so\n>> please eyeball the version I fixed up and queued in 'pu' when it is\n>> pushed out.  I also moved the '-x <cmd>::' option description to\n>> where it belongs (iow, not at the very beginning).\n>\n> Hi,\n> I think some small changes are still in order. Please consider\n> squashing this in:\n>\n> -----8<------\n> Subject: [PATCH] squash! rebase -i: teach \"--exec <cmd>\"\n>\n> In the commit message: s/each runs/each run/\n>\n> Fixup to the documentation part:\n> - Use the phrase \"after each commit in the final history\" from Junio's\n>   commit message to replace \"each commit application\". The latter is\n>   awkward and not really true.\n> - Reorder paragraphs and reword the one about --interactive.\n>   Make the part about two forms of exec less verbose.\n> - Replace ';' with '&&' in the example. This (a) makes the two\n>   examples equivalent, and (b) encourages good practice that we try\n>   to follow in git tests to never fail silently. People are likely\n>   to copy the example verbatim.\n\nLooks sensible; Lucien, opinions?\n\n>  Documentation/git-rebase.txt | 23 ++++++++++++-----------\n>  1 file changed, 12 insertions(+), 11 deletions(-)\n>\n> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> index 048da64..179ab77 100644\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -346,22 +346,23 @@ idea unless you know what you are doing (see BUGS\n> below).\n>\n>  -x <cmd>::\n>  --exec <cmd>::\n> -\tAppend \"exec <cmd>\" after each commit application line. <cmd>\n> -\twill be interpreted as one or more shell commands (see\n> -\tINTERACTIVE MODE below).\n> +\tAppend \"exec <cmd>\" after each line creating a commit in the\n> +\tfinal history. <cmd> will be interpreted as one or more shell\n> +\tcommands.\n>  +\n> -This option has to be used along with the `--interactive` option\n> -explicitly.  You may execute several commands after each commit\n> -application.  For this, you can use one instance of `--exec`:\n> +This option can only be used with the `--interactive` option\n> +(see INTERACTIVE MODE below).\n>  +\n> -\tgit rebase -i --exec \"cmd1; cmd2; ...\".\n> +You may execute several commands by either using one instance of `--exec`\n> +with several commands:\n>  +\n> -You can also insert several instances of `--exec`, if you wish to only\n> -have one command per line. For example:\n> +\tgit rebase -i --exec \"cmd1 && cmd2 && ...\"\n>  +\n> -\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n> +or equivalently by giving more than one `--exec`:\n>  +\n> -If `--autosquash` is used, the \"exec\" lines will not be appended for\n> +\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" --exec ...\n> ++\n> +If `--autosquash` is used, \"exec\" lines will not be appended for\n>  the intermediate commits, and will only appear at the end of each\n>  squash/fixup series.\n"},{"id":"193561","messageId":"20120613200552.Horde.JHFYfHwdC4BP2NaA39-wrmA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"4FD89DD6.1070705@in.waw.pl","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-13T18:05:52Z","receivedAt":"2012-06-13T18:05:52Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> a écrit :\n\n> On 06/12/2012 04:46 PM, Junio C Hamano wrote:\n>> I do not think it is worth another round of resend at this point, so\n>> please eyeball the version I fixed up and queued in 'pu' when it is\n>> pushed out.  I also moved the '-x <cmd>::' option description to\n>> where it belongs (iow, not at the very beginning).\n>\n> Hi,\n> I think some small changes are still in order. Please consider\n> squashing this in:\n>\n> -----8<------\n> Subject: [PATCH] squash! rebase -i: teach \"--exec <cmd>\"\n>\n> In the commit message: s/each runs/each run/\n>\n> Fixup to the documentation part:\n> - Use the phrase \"after each commit in the final history\" from Junio's\n>   commit message to replace \"each commit application\". The latter is\n>   awkward and not really true.\n\n\nAfter reading again the sentence, I find that the new expression is  \nmore appropriate\nwhen it comes to the \"--autosquash\" case (here, \"in the final history\"  \nis clearer than\n\"application\"). Thus, the new formulation seems good to me.\n\n> - Reorder paragraphs and reword the one about --interactive.\n>   Make the part about two forms of exec less verbose.\n\nLess verbose and avoid some repetitions. But...\n\n> +You may execute several commands by either using one instance of `--exec`\n> +with several commands:\n>  +\n> -You can also insert several instances of `--exec`, if you wish to only\n> -have one command per line. For example:\n> +\tgit rebase -i --exec \"cmd1 && cmd2 && ...\"\n>  +\n> -\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n> +or equivalently by giving more than one `--exec`:\n\n...I'm against using \"equivalently\" as in the first case, all the commands\nare on one line, and in the second case, each commands have its line, thus\neasier for the user to manipulate them independently.\n\n> - Replace ';' with '&&' in the example. This (a) makes the two\n>   examples equivalent, and (b) encourages good practice that we try\n>   to follow in git tests to never fail silently. People are likely\n>   to copy the example verbatim.\n\nWhy not.\n"},{"id":"193563","messageId":"7vipevgjhp.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"20120613200552.Horde.JHFYfHwdC4BP2NaA39-wrmA@webmail.minatec.grenoble-inp.fr","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-13T18:22:10Z","receivedAt":"2012-06-13T18:22:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"konglu@minatec.inpg.fr writes:\n\n>> +You may execute several commands by either using one instance of `--exec`\n>> +with several commands:\n>>  +\n>> -You can also insert several instances of `--exec`, if you wish to only\n>> -have one command per line. For example:\n>> +\tgit rebase -i --exec \"cmd1 && cmd2 && ...\"\n>>  +\n>> -\tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" ...\n>> +or equivalently by giving more than one `--exec`:\n>\n> ...I'm against using \"equivalently\" as in the first case, all the commands\n> are on one line, and in the second case, each commands have its line, thus\n> easier for the user to manipulate them independently.\n\nIt looks that editing\n\n    pick foo            pick foo\n    exec cmd1           exec cmd1 && cmd2\n    exec cmd2\n    pick bar            pick bar\n    exec cmd1           exec cmd1 && cmd2\n    exec cmd2\n\nto\n\n    pick foo            pick foo\n                        exec         cmd2\n    exec cmd2\n    pick bar            pick bar\n    exec cmd1           exec cmd1\n\nwould take exactly the same effort, at least to me.  And more\nimportantly, without editing don't they do *exactly* the same thing?\nIf cmd1 fails, the sequencing stops at that step without running cmd2.\n"},{"id":"193585","messageId":"20120613213836.Horde.qI8GQnwdC4BP2Ow8uCTQqgA@webmail.minatec.grenoble-inp.fr","threadId":"30700","inReplyTo":"7vipevgjhp.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"","fromEmail":"konglu@minatec.inpg.fr","sentAt":"2012-06-13T19:38:36Z","receivedAt":"2012-06-13T19:38:36Z","isPatch":false,"sender":{"key":"konglu@minatec.inpg.fr","avatar":null},"body":"\nJunio C Hamano <gitster@pobox.com> a écrit :\n\n> It looks that editing\n>\n>     pick foo            pick foo\n>     exec cmd1           exec cmd1 && cmd2\n>     exec cmd2\n>     pick bar            pick bar\n>     exec cmd1           exec cmd1 && cmd2\n>     exec cmd2\n>\n> to\n>\n>     pick foo            pick foo\n>                         exec         cmd2\n>     exec cmd2\n>     pick bar            pick bar\n>     exec cmd1           exec cmd1\n>\n> would take exactly the same effort, at least to me.  And more\n> importantly, without editing don't they do *exactly* the same thing?\n> If cmd1 fails, the sequencing stops at that step without running cmd2.\n\nTrue. I was thinking under the fact that the user would edit the commands\nby himself but the purpose of the \"--exec\" option is to avoid that (or at\nleast that the user won't have to type all by himself). Forget what I said\nthen :).\n"},{"id":"193592","messageId":"4FD8FF25.6030908@kdbg.org","threadId":"30700","inReplyTo":"20120613213836.Horde.qI8GQnwdC4BP2Ow8uCTQqgA@webmail.minatec.grenoble-inp.fr","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-06-13T20:59:17Z","receivedAt":"2012-06-13T20:59:17Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 13.06.2012 21:38, schrieb konglu@minatec.inpg.fr:\n> \n> Junio C Hamano <gitster@pobox.com> a écrit :\n> \n>> It looks that editing\n>>\n>>     pick foo            pick foo\n>>     exec cmd1           exec cmd1 && cmd2\n>>     exec cmd2\n>>     pick bar            pick bar\n>>     exec cmd1           exec cmd1 && cmd2\n>>     exec cmd2\n>>\n>> to\n>>\n>>     pick foo            pick foo\n>>                         exec         cmd2\n>>     exec cmd2\n>>     pick bar            pick bar\n>>     exec cmd1           exec cmd1\n>>\n>> would take exactly the same effort, at least to me.  And more\n>> importantly, without editing don't they do *exactly* the same thing?\n>> If cmd1 fails, the sequencing stops at that step without running cmd2.\n> \n> True. I was thinking under the fact that the user would edit the commands\n> by himself but the purpose of the \"--exec\" option is to avoid that (or at\n> least that the user won't have to type all by himself). Forget what I said\n> then :).\n\nNot so fast.\n\n\texec cmd1 && cmd2\nand\n\texec cmd1\n\texec cmd2\n\nare far from equivalent: If cmd1 fails, the first version never runs\ncmd2, but the second version runs cmd2 upon rebase --continue.\n\nThe updated documentation should not say that the two are \"equivalent\".\n\n-- Hannes\n"},{"id":"193593","messageId":"4FD90114.50006@in.waw.pl","threadId":"30700","inReplyTo":"4FD8FF25.6030908@kdbg.org","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-06-13T21:07:32Z","receivedAt":"2012-06-13T21:07:32Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 06/13/2012 10:59 PM, Johannes Sixt wrote:\n> Am 13.06.2012 21:38, schrieb konglu@minatec.inpg.fr:\n>>\n>> Junio C Hamano <gitster@pobox.com> a écrit :\n>>\n>>> It looks that editing\n>>>\n>>>     pick foo            pick foo\n>>>     exec cmd1           exec cmd1 && cmd2\n>>>     exec cmd2\n>>>     pick bar            pick bar\n>>>     exec cmd1           exec cmd1 && cmd2\n>>>     exec cmd2\n>>>\n>>> to\n>>>\n>>>     pick foo            pick foo\n>>>                         exec         cmd2\n>>>     exec cmd2\n>>>     pick bar            pick bar\n>>>     exec cmd1           exec cmd1\n>>>\n>>> would take exactly the same effort, at least to me.  And more\n>>> importantly, without editing don't they do *exactly* the same thing?\n>>> If cmd1 fails, the sequencing stops at that step without running cmd2.\n>>\n>> True. I was thinking under the fact that the user would edit the commands\n>> by himself but the purpose of the \"--exec\" option is to avoid that (or at\n>> least that the user won't have to type all by himself). Forget what I said\n>> then :).\n> \n> Not so fast.\n> \n> \texec cmd1 && cmd2\n> and\n> \texec cmd1\n> \texec cmd2\n> \n> are far from equivalent: If cmd1 fails, the first version never runs\n> cmd2, but the second version runs cmd2 upon rebase --continue.\n> \n> The updated documentation should not say that the two are \"equivalent\".\nGood catch. Word \"equivalently\" is inappropriate here. I think that just\nremoving that one word is best.\n\nZbyszek\n"},{"id":"193599","messageId":"7vvciug88g.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"4FD8FF25.6030908@kdbg.org","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-13T22:25:19Z","receivedAt":"2012-06-13T22:25:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Not so fast.\n>\n> \texec cmd1 && cmd2\n> and\n> \texec cmd1\n> \texec cmd2\n>\n> are far from equivalent: If cmd1 fails, the first version never runs\n> cmd2, but the second version runs cmd2 upon rebase --continue.\n>\n> The updated documentation should not say that the two are \"equivalent\".\n\nFair'nuf.  Thansk.\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 179ab77..2d71e4b 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -358,7 +358,7 @@ with several commands:\n +\n \tgit rebase -i --exec \"cmd1 && cmd2 && ...\"\n +\n-or equivalently by giving more than one `--exec`:\n+or by giving more than one `--exec`:\n +\n \tgit rebase -i --exec \"cmd1\" --exec \"cmd2\" --exec ...\n +\n"},{"id":"193600","messageId":"7vr4tig7rg.fsf@alter.siamese.dyndns.org","threadId":"30700","inReplyTo":"4FD8FF25.6030908@kdbg.org","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-13T22:35:31Z","receivedAt":"2012-06-13T22:35:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Not so fast.\n>\n> \texec cmd1 && cmd2\n> and\n> \texec cmd1\n> \texec cmd2\n>\n> are far from equivalent: If cmd1 fails, the first version never runs\n> cmd2, but the second version runs cmd2 upon rebase --continue.\n\nThis reminds me of one thing.\n\nFor \"exec\" insns that are meant to validate each commit in the\nresulting history, what should happen (I am not asking what the\ncurrent implementation of \"rebase -i\" does) after \"exec cmd1\" fails?\n\nIdeally, the user will at that point fix the problem in the code,\nrun \"commit --amend\" to record the fix, and then want to make sure\nit really fixed it by re-running \"exec cmd1\", no?\n\nShouldn't \"rebase --continue\" after such a \"commit --amend\" resume\nexecution from \"exec cmd1\", which failed in the initial run?\n\nI said in the beginning 'For \"exec\" insns that are meant to validate',\nas \"exec\" is not necessarily about validation, and other use cases\nof it may want it run only once in the sequence, whether it succeeds\nor fails.  So perhaps we would need two kinds of \"exec\", one that\njust runs once and is not re-run even if the initial round fails,\nand another (perhaps spell it \"test\") that runs upon \"--continue\"\nuntil it passes.  The latter of course can be skipped by the user\nwith \"rebase --skip\".\n"},{"id":"193602","messageId":"4FD9177A.5030303@in.waw.pl","threadId":"30700","inReplyTo":"7vr4tig7rg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-06-13T22:43:06Z","receivedAt":"2012-06-13T22:43:06Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 06/14/2012 12:35 AM, Junio C Hamano wrote:\n> Johannes Sixt <j6t@kdbg.org> writes:\n> \n>> Not so fast.\n>>\n>> \texec cmd1 && cmd2\n>> and\n>> \texec cmd1\n>> \texec cmd2\n>>\n>> are far from equivalent: If cmd1 fails, the first version never runs\n>> cmd2, but the second version runs cmd2 upon rebase --continue.\n> \n> This reminds me of one thing.\n> \n> For \"exec\" insns that are meant to validate each commit in the\n> resulting history, what should happen (I am not asking what the\n> current implementation of \"rebase -i\" does) after \"exec cmd1\" fails?\n> \n> Ideally, the user will at that point fix the problem in the code,\n> run \"commit --amend\" to record the fix, and then want to make sure\n> it really fixed it by re-running \"exec cmd1\", no?\n> \n> Shouldn't \"rebase --continue\" after such a \"commit --amend\" resume\n> execution from \"exec cmd1\", which failed in the initial run?\n> \n> I said in the beginning 'For \"exec\" insns that are meant to validate',\n> as \"exec\" is not necessarily about validation, and other use cases\n> of it may want it run only once in the sequence, whether it succeeds\n> or fails.  So perhaps we would need two kinds of \"exec\", one that\n> just runs once and is not re-run even if the initial round fails,\n> and another (perhaps spell it \"test\") that runs upon \"--continue\"\n> until it passes.  The latter of course can be skipped by the user\n> with \"rebase --skip\".\nA different proposal would be to add a 'rebase --retry' which would\ninoke the last command again. And then the advice after 'exec' could say\n\"Use --retry to rerun this command, and --continue to proceed with the\nnext one\".\n\n--retry could make sense for 'apply' commands too: if a commit fails to\napply, one could do\n  git reset --hard HEAD^\n  hack hack adjusting the preimage\n  git commit\n  git rebase --retry\n\nUsing --retry to rerun tests would have the advantage that one normally\ndoesn't think that the tests will fail, so could get into the habit of\nusing 'exec', not 'test', for the verification commands.\n\nJust thinking aloud.\n\nZbyszek\n"},{"id":"193618","messageId":"vpqr4ticre1.fsf@bauges.imag.fr","threadId":"30700","inReplyTo":"4FD9177A.5030303@in.waw.pl","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-06-14T06:57:26Z","receivedAt":"2012-06-14T06:57:26Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:\n\n>> Shouldn't \"rebase --continue\" after such a \"commit --amend\" resume\n>> execution from \"exec cmd1\", which failed in the initial run?\n\nThere are use-cases where this would be useful, but that would also be a\nreal pain if the command itself is broken (e.g. does \"echo OK; exit 1\",\nthat the user can interpret as correct but that \"git rebase\" will\nconsider as a failure). It this case, the user would have no simple way\nto get out of the situation (either --abort or --skip).\n\nThe current behavior is not that bad: \"git rebase --continue\" does not\nre-check the current commit, but the user did have an opportunity to\ncheck the commit manually before running it. The problem with rebase\n(that --exec solves), is that it creates new commits without giving the\nuser this opportunity. I'm not sure adding one more type of command is\nworth the extra-complexity.\n\n> A different proposal would be to add a 'rebase --retry' which would\n> inoke the last command again. And then the advice after 'exec' could say\n> \"Use --retry to rerun this command, and --continue to proceed with the\n> next one\".\n>\n> --retry could make sense for 'apply' commands too: if a commit fails to\n> apply, one could do\n[...]\n\nThat makes sense to me.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"193653","messageId":"4FD9F049.1030808@xiplink.com","threadId":"30700","inReplyTo":"vpqr4ticre1.fsf@bauges.imag.fr","subject":"Re: [PATCHv5] rebase [-i --exec | -ix] <CMD>...","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2012-06-14T14:08:09Z","receivedAt":"2012-06-14T14:08:09Z","isPatch":false,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"On 12-06-14 02:57 AM, Matthieu Moy wrote:\n> Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:\n> \n>>> Shouldn't \"rebase --continue\" after such a \"commit --amend\" resume\n>>> execution from \"exec cmd1\", which failed in the initial run?\n\n+1 for Junio's proposal.\n\nCurrently the only time --continue moves on to the next insn is in the \"edit\"\ncase, when everything up to that point (including applying the \"edit\" commit)\nis fine.  But if the rebase halted due to a problem, --continue ensures the\nproblem is fixed before moving on to the next insn (e.g. it makes sure a\nmerge conflict is resolved).\n\nI think it makes the most sense for --continue after an exec-failure to try\nto re-run the exec.  Furthermore, --skip after an exec failure should just\nskip the exec.\n\nTo me that makes --continue's (and --skip's) behaviour consistent with what\nit does when any other insn operation fails.  In other words, if the rebase\nhits an exec failure, the user is going to want to fix it before continuing\n(just like any other failure during a rebase).  If the user decides to not\nfix the failing exec, they can --skip it.\n\n\t\tM.\n"}]}