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

Re: [PATCH v5 3/4] notes: add notes.mergestrategy option to select default strategy

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 14, 2015, 18:07 UTC
Message-ID
<CAPig+cQN9bszBiW4dxp8cz+aJUf=70V-vLQio_6OX9ry1cOYRw@mail.gmail.com>
In-Reply-To
<1439574620-25249-4-git-send-email-jacob.e.keller@intel.com>
On Fri, Aug 14, 2015 at 1:50 PM, Jacob Keller <jacob.e.keller@intel.com> wrote:
Show 31 quoted lines
> Teach git-notes about "notes.mergestrategy" to select a general strategy
> for all notes merges. This enables a user to always get expected merge
> strategy such as "cat_sort_uniq" without having to pass the "-s" option
> manually.
>
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
> diff --git a/builtin/notes.c b/builtin/notes.c
> index 042348082709..97109f8d419c 100644
> --- a/builtin/notes.c
> +++ b/builtin/notes.c
> @@ -796,21 +814,16 @@ static int merge(int argc, const char **argv, const char *prefix)
>         expand_notes_ref(&remote_ref);
>         o.remote_ref = remote_ref.buf;
>
> +       git_config_get_string_const("notes.mergestrategy", &configured_strategy);
> +
>         if (strategy) {
> -               if (!strcmp(strategy, "manual"))
> -                       o.strategy = NOTES_MERGE_RESOLVE_MANUAL;
> -               else if (!strcmp(strategy, "ours"))
> -                       o.strategy = NOTES_MERGE_RESOLVE_OURS;
> -               else if (!strcmp(strategy, "theirs"))
> -                       o.strategy = NOTES_MERGE_RESOLVE_THEIRS;
> -               else if (!strcmp(strategy, "union"))
> -                       o.strategy = NOTES_MERGE_RESOLVE_UNION;
> -               else if (!strcmp(strategy, "cat_sort_uniq"))
> -                       o.strategy = NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ;
> -               else {
> +               if (parse_notes_strategy(strategy, &o.strategy)) {
>                         error("Unknown -s/--strategy: %s", strategy);

This error message points the user at the source of the problem ("--strategy"). Good.

Show 5 quoted lines
>                         usage_with_options(git_notes_merge_usage, options);
>                 }
> +       } else if (configured_strategy) {
> +               if (parse_notes_strategy(configured_strategy, &o.strategy))
> +                       die("Unknown notes merge strategy: %s", configured_strategy);

This error message doesn't. Perhaps it should mention the config variable "notes.mergestrategy" to help the user track down the problem more quickly?

>         }
>
>         t = init_notes_check("merge");
Previous: Jacob KellerNext: Jacob Keller
Message 5 of 6 in “notes mergestrategy configuration option”
  1. 0/4 notes mergestrategy configuration optionJacob Keller, Aug 14, 2015
  2. 1/4 notes: document cat_sort_uniq rewriteModeJacob Keller, Aug 14, 2015
  3. 2/4 notes: add tests for --commit/--abort/--strategy exclusivityJacob Keller, Aug 14, 2015
  4. 3/4 notes: add notes.mergestrategy option to select default strategyJacob Keller, Aug 14, 2015
  5. Eric SunshineAug 14, 2015
  6. 4/4 notes: teach git-notes about notes.<ref>.mergestrategy optionJacob Keller, Aug 14, 2015

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.