git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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"
Previous: Eric SunshineNext: Mehul Jain
Message 4 of 8 in “git-pull.c: introduce git_pull_config()”
  1. 1/2 git-pull.c: introduce git_pull_config()Mehul Jain, Mar 17, 2016
  2. 2/2 pull --rebase: add --[no-]autostash flagMehul Jain, Mar 17, 2016
  3. Eric SunshineMar 18, 2016
  4. Eric SunshineMar 18, 2016
  5. Mehul JainMar 18, 2016
  6. Eric SunshineMar 20, 2016
  7. Mehul JainMar 18, 2016
  8. Eric SunshineMar 20, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.