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

Re: [PATCH] revert.c: Allow to specify -x via git-config

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 18, 2014, 17:49 UTC
Message-ID
<20140218174913.GB7855@google.com>
In-Reply-To
<20140218065620.GA3448@bogon.m.sigxcpu.org>
Hi,
Guido Günther wrote:
> Without this when maintaining stable branches it's easy to forget to use
> -x to track where a patch was cherry-picked from.
[...]
Show 13 quoted lines
> --- a/Documentation/git-cherry-pick.txt
> +++ b/Documentation/git-cherry-pick.txt
> @@ -215,6 +215,14 @@ the working tree.
>  spending extra time to avoid mistakes based on incorrectly matching
>  context lines.
>  
> +CONFIGURATION
> +-------------
> +
> +See linkgit:git-config[1] for core variables.
> +
> +cherrypick.record-origin::
> +	Default for the `-x` option. Defaults to `false`.

I'm not convinced this is a good idea. Even if I always want -x when cherry-picking to stable, isn't this going to add the extra clutter line when I cherry-pick on other branches? It's especially worrying because there would be no way to override the configuration with a flag on the command line. ("-r" which used to do that is now a no-op.)

I would be more easily convinced by a '[branch "foo"] recordcherrypickorigins' option that makes cherry-pick default to '-x' when and only when on the "foo" branch.

Can you say more about the context? Why is it important to record the original commit id? Is it a matter of keeping a reminder of the commits' similarity (which cherry-pick without '-x' does ok by reusing the same message) or are people reviewing the change downstream going to be judging the change based on the recorded upstream commit id? (Like linux's stable-<version> branches --- but those have other requirements so I don't think this configuration would work as is there.)

[...]
> +++ b/builtin/revert.c
> @@ -196,6 +196,15 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
[...]
> +	if (!strcmp(var, "cherrypick.record-origin"))
> +		opts->record_origin = git_config_bool (var, value);

More nitpicky: git uses camelCase, not dash-delimited, for multiword configuration items. The config parsing machinery normalizes to lowercase, so this would then be "cherrypick.recordorigin".

Hope that helps, Jonathan

Previous: John KeepingNext: brian m. carlson
Message 3 of 10 in “revert.c: Allow to specify -x via git-config”
  1. revert.c: Allow to specify -x via git-configGuido Günther, Feb 18, 2014
  2. John KeepingFeb 18, 2014
  3. Jonathan NiederFeb 18, 2014
  4. brian m. carlsonFeb 18, 2014
  5. Jonathan NiederFeb 18, 2014
  6. 0/3 Allow to configure cherry-pick's record originGuido Günther, Feb 18, 2014
  7. 1/3 revert.c: Allow to specify -x via git-configGuido Günther, Feb 18, 2014
  8. Junio C HamanoFeb 19, 2014
  9. 2/3 revert.c: Add --record-originGuido Günther, Feb 18, 2014
  10. 3/3 revert.c Allow to override cherrypick.recordOriginGuido Günther, Feb 18, 2014

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.