summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Jacob Keller <jacob.keller@gmail.com>2015-08-17 14:33:34 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-08-17 15:39:13 -0700
commit4f655e22b76fed49b0c32bcdcd899934215b9a6d (patch)
treee48e1263e1150c5c24d21c6cba74e9c2048bd162 /builtin
parentnotes: add notes.mergeStrategy option to select default strategy (diff)
downloadtgif-4f655e22b76fed49b0c32bcdcd899934215b9a6d.tar.xz
notes: teach git-notes about notes.<name>.mergeStrategy option
Teach notes about a new "notes.<name>.mergeStrategy" option for configuring the notes merge strategy when merging into refs/notes/<name>. This option allows for the selection of merge strategy for particular notes refs, rather than all notes ref merges, as user may not want cat_sort_uniq for all refs, but only some. Note that the <name> is the local reference we are merging into, not the remote ref we merged from. The assumption is that users will mostly want to configure separate local ref merge strategies rather than strategies depending on which remote ref they merge from. notes.<name>.mergeStrategy overrides the general behavior as it is more specific. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/notes.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index 9026d567cd..ebd3e62e87 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -816,7 +816,19 @@ static int merge(int argc, const char **argv, const char *prefix)
usage_with_options(git_notes_merge_usage, options);
}
} else {
- git_config_get_notes_strategy("notes.mergeStrategy", &o.strategy);
+ struct strbuf merge_key = STRBUF_INIT;
+ const char *short_ref = NULL;
+
+ if (!skip_prefix(o.local_ref, "refs/notes/", &short_ref))
+ die("BUG: local ref %s is outside of refs/notes/",
+ o.local_ref);
+
+ strbuf_addf(&merge_key, "notes.%s.mergeStrategy", short_ref);
+
+ if (git_config_get_notes_strategy(merge_key.buf, &o.strategy))
+ git_config_get_notes_strategy("notes.mergeStrategy", &o.strategy);
+
+ strbuf_release(&merge_key);
}
strbuf_addf(&msg, "notes: Merged notes from %s into %s",