Re: [PATCH] pull: add pull.autoStash config option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> write:
> You will want to add one or more new tests to a test script to verify
> that this new configuration works as expected, and probably also to
> verify that `pull.autoStash` takes precedence over `rebase.autoStash`.

Got it. Always make sure to add tests when introducing new features.

>> diff --git a/Documentation/config/pull.adoc b/Documentation/config/pull.adoc
>> @@ -13,6 +13,15 @@ pull.rebase::
>> +pull.autoStash::
>> +       When true, Git will automatically perform a `git stash` before the
>> +       operation and then restore the local changes with `git stash pop`
>> +       after the merge or rebase is complete. This means that you can run
> 
> I wonder if you meant "pull" instead of "merge or rebase".

Yes, I think I should also say that pull.autoStash only works if we set pull.rebase.

> 
>> +       pull on a dirty worktree. Noticed that `rebase.autoStash` provides
> 
> s/Noticed/Notice/
> 
>> +       the same functionality, but `pull.autoStash` overrides its behavior
> 
> Rather: "...same functionality as `pull.autoStash` but overrides the
> latter when..."

Got it.

> 
>> +       when both are set. This option can be overridden by the `--no-autostash`
>> +       and `--autostash` options of linkgit:git-pull[1]. Defaults to false.
>> diff --git a/builtin/pull.c b/builtin/pull.c
>> @@ -1052,7 +1056,7 @@ int cmd_pull(int argc,
>>        if (opt_rebase) {
>>                if (opt_autostash == -1)
>> -                       opt_autostash = config_autostash;
>> +                       opt_autostash = config_pull_autostash == -1 ? config_rebase_autostash : config_pull_autostash;
> 
> You may want to wrap this over-long line. Perhaps:
> 
>    opt_autostash = config_pull_autostash == -1 ?
>        config_rebase_autostash : config_pull_autostash;

Here's something completely unrelated: the output of clang-format can
sometimes be confusing.

- opt_autostash = config_pull_autostash == -1 ?
-       config_rebase_autostash :
-       config_pull_autostash;
+ opt_autostash = config_pull_autostash == -1 ? config_rebase_autostash : config_pull_autostash;

This made me mistakenly think that Git had set a large line length limit,
So I didn’t break this line here.

Thanks,
Lidong






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux