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

Re: [PATCH v5] pull --rebase: add --[no-]autostash flag

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 7, 2016, 23:01 UTC
Message-ID
<xmqqy49tnb8x.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1457354245-26871-1-git-send-email-mehul.jain2029@gmail.com>
Mehul Jain <mehul.jain2029@gmail.com> writes:
Show 9 quoted lines
> If rebase.autoStash configuration variable is set, there is no way to
> override it for "git pull --rebase" from the command line.
>
> Teach "git pull --rebase" the --[no-]autostash command line flag which
> overrides the current value of rebase.autoStash, if set. As "git rebase"
> understands the --[no-]autostash option, it's just a matter of passing
> the option to underlying "git rebase" when "git pull --rebase" is called.
>
> Also introduce a callback function to read config variables.

I was expecting you not to do this (it does not have to be in the scope of this topic), but if you do so, it would be preferrable to do it as a preparatory clean-up patch--the existing code already makes a separate get_bool() call to read a single config while it uses git_config(git_default_config) to read the other variables, and introduction of git_pull_config() is a clean-up that is independent of your new feature.

And then on top of that cleaned-up codebase, add this new feature.
Show 16 quoted lines
> diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
> index a62a2a6..393ac7d 100644
> --- a/Documentation/git-pull.txt
> +++ b/Documentation/git-pull.txt
> @@ -128,6 +128,15 @@ unless you have read linkgit:git-rebase[1] carefully.
>  --no-rebase::
>  	Override earlier --rebase.
>  
> +--autostash::
> +--no-autostash::
> +	Before starting rebase, stash local modifications away (see
> +	linkgit:git-stash.txt[1]) if needed, and apply the stash when
> +	done (this option is only valid when '--rebase' is used).
> ++
> +'--no-autostash' is useful to override the 'rebase.autoStash'
> +configuration variable (see linkgit:git-config[1]).

Don't we use `typewriter font` when referring to literal command, option and variable names in the documentation? The description for `--rebase` that comes immediately before this hunk seems to support that observation.

Show 9 quoted lines
> @@ -306,6 +310,18 @@ static enum rebase_type config_get_rebase(void)
>  }
>  
>  /**
> + * Read config variables.
> + */
> +static int git_pull_config(const char *var, const char *value, void *cb)
> +{
> +	if (!strcmp(var,"rebase.autostash")) {
Style: SP after a comma.  There may be the same problem elsewhere on
the new lines, but I won't point out all of them.
Other than that, looking better.
Thanks.
Previous: Mehul JainNext: Mehul Jain
Message 28 of 44 in “pull --rebase: add --[no-]autostash flag”
  1. 1/2 pull --rebase: add --[no-]autostash flagMehul Jain, Feb 27, 2016
  2. 2/2 Documentation/git-pull.txt: teach 'git pull --rebase' the --[no-]autostash option.Mehul Jain, Feb 27, 2016
  3. Junio C HamanoFeb 27, 2016
  4. Mehul JainFeb 28, 2016
  5. Matthieu MoyFeb 28, 2016
  6. Paul TanFeb 28, 2016
  7. Junio C HamanoFeb 28, 2016
  8. 1/3 pull --rebase: add --[no-]autostash flagMehul Jain, Mar 3, 2016
  9. 2/3 test: add test for --[no-]autostash flagMehul Jain, Mar 3, 2016
  10. Matthieu MoyMar 3, 2016
  11. Mehul JainMar 4, 2016
  12. 3/3 Documentation/git-pull: document --[no-]autostash optionMehul Jain, Mar 3, 2016
  13. Junio C HamanoMar 3, 2016
  14. Mehul JainMar 4, 2016
  15. Matthieu MoyMar 4, 2016
  16. Paul TanMar 4, 2016
  17. Matthieu MoyMar 3, 2016
  18. Eric SunshineMar 4, 2016
  19. Matthieu MoyMar 4, 2016
  20. Mehul JainMar 4, 2016
  21. Matthieu MoyMar 4, 2016
  22. Paul TanMar 4, 2016
  23. pull --rebase: add --[no-]autostash flagMehul Jain, Mar 5, 2016
  24. Mehul JainMar 5, 2016
  25. Junio C HamanoMar 5, 2016
  26. Mehul JainMar 7, 2016
  27. pull --rebase: add --[no-]autostash flagMehul Jain, Mar 7, 2016
  28. Junio C HamanoMar 7, 2016
  29. 1/2 git-pull.c: introduce git_pull_config()Mehul Jain, Mar 8, 2016
  30. 2/2 pull --rebase: add --[no-]autostash flagMehul Jain, Mar 8, 2016
  31. 1/2 git-pull.c: introduce git_pull_config()Mehul Jain, Mar 9, 2016
  32. 2/2 pull --rebase: add --[no-]autostash flagMehul Jain, Mar 9, 2016
  33. Paul TanMar 11, 2016
  34. Mehul JainMar 11, 2016
  35. Matthieu MoyMar 11, 2016
  36. Mehul JainMar 11, 2016
  37. Mehul JainMar 12, 2016
  38. 1/2 git-pull.c: introduce git_pull_config()Mehul Jain, Mar 15, 2016
  39. 2/2 pull --rebase: add --[no-]autostash flagMehul Jain, Mar 15, 2016
  40. Eric SunshineMar 15, 2016
  41. Mehul JainMar 16, 2016
  42. Eric SunshineMar 18, 2016
  43. Mehul JainMar 17, 2016
  44. Eric SunshineMar 18, 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.