Re: [PATCH v9 2/2] pull --rebase: add --[no-]autostash flag
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 18, 2016, 04:39 UTC
- Message-ID
- <CAPig+cQg2gYbr26X6PPQ6bobkxbufSSNtA1T94kdyEKQwHZXBw@mail.gmail.com>
- In-Reply-To
- <CAPig+cQHbGAB=XCVWtC1MuubWUFc0tT-+ZGD+hW18whJP_U0_Q@mail.gmail.com>
On Fri, Mar 18, 2016 at 12:24 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 11 quoted lines
> On Thu, Mar 17, 2016 at 12:49 PM, Mehul Jain <mehul.jain2029@gmail.com> wrote: >> @@ -801,6 +804,7 @@ static int run_rebase(const unsigned char *curr_head, >> argv_array_pushv(&args, opt_strategy_opts.argv); >> if (opt_gpg_sign) >> argv_array_push(&args, opt_gpg_sign); >> + argv_array_push(&args, opt_autostash ? "--autostash" : "--no-autostash"); > > At this point, we know that opt_autostash can't be -1 (thus > incorrectly triggering use of --autostash) because the conditional in > cmd_pull() set it to the value of config_autostash (either 0 or 1) if > the user did not specify it on the command-line. Okay. Makes sense.
Actually, this is going to pass --autostash or --no-autostash to git-rebase unconditionally won't it? This seems kind of undesirable due to the unnecessarily tight coupling it creates between the two commands. I wasn't paying close attention to the earlier discussion, but wasn't the idea that you should pass one of these two options along to git-rebase only if the user explicitly asked to do by saying so on the command line?
In other words:
* invoke "git-rebase --autostash" only if the user typed "git pull --rebase --autostash"
* invoke "git-rebase --no-autostash" only if the user typed "git pull --rebase --no-autostash"
* invoke "git rebase" if the user typed bare "git pull --rebase"