notes: teach git-notes about notes.<name>.mergeStrategy option
[gitweb.git] / builtin / notes.c
index 9026d567cd15cd54df2ceb1f0a8ec8719e104f68..ebd3e62e87a52e6be7ff07f4e317ebdd2c1ee6c6 100644 (file)
@@ -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",