summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-12-22 20:26:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-12-22 20:26:24 (GMT)
commit0ed8a4e161c06b82734f5f5268a5b1fb68abb954 (patch)
tree3adfc815939e2ce7688b69d3463cdb9b19dca5ab /builtin/merge.c
parent3f1509809e728b70ea7912e4e1b40f22965e45ee (diff)
parent3d24a7267dd9b57b864d119a533bdfdfaccd9161 (diff)
downloadgit-0ed8a4e161c06b82734f5f5268a5b1fb68abb954.zip
git-0ed8a4e161c06b82734f5f5268a5b1fb68abb954.tar.gz
git-0ed8a4e161c06b82734f5f5268a5b1fb68abb954.tar.bz2
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 'builtin/merge.c')
-rw-r--r--builtin/merge.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index bebbe5b..215d485 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -29,6 +29,7 @@
#include "remote.h"
#include "fmt-merge-msg.h"
#include "gpg-interface.h"
+#include "sequencer.h"
#define DEFAULT_TWOHEAD (1<<0)
#define DEFAULT_OCTOPUS (1<<1)
@@ -880,28 +881,19 @@ static int finish_automerge(struct commit *head,
return 0;
}
-static int suggest_conflicts(int renormalizing)
+static int suggest_conflicts(void)
{
const char *filename;
FILE *fp;
- int pos;
+ struct strbuf msgbuf = STRBUF_INIT;
filename = git_path("MERGE_MSG");
fp = fopen(filename, "a");
if (!fp)
die_errno(_("Could not open '%s' for writing"), filename);
- fprintf(fp, "\nConflicts:\n");
- for (pos = 0; pos < active_nr; pos++) {
- const struct cache_entry *ce = active_cache[pos];
-
- if (ce_stage(ce)) {
- fprintf(fp, "\t%s\n", ce->name);
- while (pos + 1 < active_nr &&
- !strcmp(ce->name,
- active_cache[pos + 1]->name))
- pos++;
- }
- }
+
+ append_conflicts_hint(&msgbuf);
+ fputs(msgbuf.buf, fp);
fclose(fp);
rerere(allow_rerere_auto);
printf(_("Automatic merge failed; "
@@ -1550,7 +1542,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
fprintf(stderr, _("Automatic merge went well; "
"stopped before committing as requested\n"));
else
- ret = suggest_conflicts(option_renormalize);
+ ret = suggest_conflicts();
done:
free(branch_to_free);