diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-12-22 12:26:23 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-12-22 12:26:24 -0800 |
commit | 0ed8a4e161c06b82734f5f5268a5b1fb68abb954 (patch) | |
tree | 3adfc815939e2ce7688b69d3463cdb9b19dca5ab /sequencer.c | |
parent | 3f1509809e728b70ea7912e4e1b40f22965e45ee (diff) | |
parent | 3d24a7267dd9b57b864d119a533bdfdfaccd9161 (diff) | |
download | git-0ed8a4e161c06b82734f5f5268a5b1fb68abb954.tar.gz |
Merge branch 'cc/interpret-trailers-more'
"git interpret-trailers" learned to properly handle the
"Conflicts:" block at the end.
* cc/interpret-trailers-more:
trailer: add test with an old style conflict block
trailer: reuse ignore_non_trailer() to ignore conflict lines
commit: make ignore_non_trailer() non static
merge & sequencer: turn "Conflicts:" hint into a comment
builtin/commit.c: extract ignore_non_trailer() helper function
merge & sequencer: unify codepaths that write "Conflicts:" hint
builtin/merge.c: drop a parameter that is never used
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/sequencer.c b/sequencer.c index a03d4fa252..77a1266760 100644 --- a/sequencer.c +++ b/sequencer.c @@ -267,6 +267,23 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from, return 0; } +void append_conflicts_hint(struct strbuf *msgbuf) +{ + int i; + + strbuf_addch(msgbuf, '\n'); + strbuf_commented_addf(msgbuf, "Conflicts:\n"); + for (i = 0; i < active_nr;) { + const struct cache_entry *ce = active_cache[i++]; + if (ce_stage(ce)) { + strbuf_commented_addf(msgbuf, "\t%s\n", ce->name); + while (i < active_nr && !strcmp(ce->name, + active_cache[i]->name)) + i++; + } + } +} + static int do_recursive_merge(struct commit *base, struct commit *next, const char *base_label, const char *next_label, unsigned char *head, struct strbuf *msgbuf, @@ -307,21 +324,8 @@ static int do_recursive_merge(struct commit *base, struct commit *next, if (opts->signoff) append_signoff(msgbuf, 0, 0); - if (!clean) { - int i; - strbuf_addstr(msgbuf, "\nConflicts:\n"); - for (i = 0; i < active_nr;) { - const struct cache_entry *ce = active_cache[i++]; - if (ce_stage(ce)) { - strbuf_addch(msgbuf, '\t'); - strbuf_addstr(msgbuf, ce->name); - strbuf_addch(msgbuf, '\n'); - while (i < active_nr && !strcmp(ce->name, - active_cache[i]->name)) - i++; - } - } - } + if (!clean) + append_conflicts_hint(msgbuf); return !clean; } |