10
#include "commit-reach.h"
11
12
static int use_branch_desc;
13
+static int suppress_dest_pattern_seen;
14
+static struct string_list suppress_dest_patterns = STRING_LIST_INIT_DUP;
15
16
int fmt_merge_msg_config(const char *key, const char *value, void *cb)
17
{
24
merge_log_config = DEFAULT_MERGE_LOG_LEN;
25
} else if (!strcmp(key, "merge.branchdesc")) {
26
use_branch_desc = git_config_bool(key, value);
27
+ } else if (!strcmp(key, "merge.suppressdest")) {
28
+ if (!value)
29
+ return config_error_nonbool(key);
30
+ if (!*value)
31
+ string_list_clear(&suppress_dest_patterns, 0);
32
+ else
33
+ string_list_append(&suppress_dest_patterns, value);
34
+ suppress_dest_pattern_seen = 1;
35
} else {
36
return git_default_config(key, value, cb);
37
}
413
string_list_clear(&subjects, 0);
414
}
415
416
+/*
417
+ * See if dest_branch matches with any glob pattern on the
418
+ * suppress_dest_patterns list.
419
+ *
420
+ * We may want to also allow negative matches e.g. ":!glob" like we do
421
+ * for pathspec, but for now, let's keep it simple and stupid.
422
+ */
423
+static int dest_suppressed(const char *dest_branch)
424
+{
425
+ struct string_list_item *item;
426
+
427
+ for_each_string_list_item(item, &suppress_dest_patterns) {
428
+ if (!wildmatch(item->string, dest_branch, WM_PATHNAME))
429
+ return 1;
430
+ }
431
+ return 0;
432
+}
433
+
434
static void fmt_merge_msg_title(struct strbuf *out,
435
const char *current_branch)
436
{
479
strbuf_addf(out, " of %s", srcs.items[i].string);
480
}
481
454
- if (!strcmp("master", current_branch))
455
- strbuf_addch(out, '\n');
456
- else
457
- strbuf_addf(out, " into %s\n", current_branch);
482
+ if (!dest_suppressed(current_branch))
483
+ strbuf_addf(out, " into %s", current_branch);
484
+ strbuf_addch(out, '\n');
485
}
486
487
static void fmt_tag_signature(struct strbuf *tagbuf,
626
void *current_branch_to_free;
627
struct merge_parents merge_parents;
628
629
+ if (!suppress_dest_pattern_seen)
630
+ string_list_append(&suppress_dest_patterns, "master");
631
+
632
memset(&merge_parents, 0, sizeof(merge_parents));
633
634
/* get current branch */