summaryrefslogtreecommitdiff
path: root/builtin-merge.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-20 14:42:59 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-20 14:42:59 -0800
commit71b3ef11fa0aade4a514c51b83438858a4a3c03b (patch)
tree6cea8215ecc0e70c8f19e04c51327deda93672d3 /builtin-merge.c
parentf922df8655675aafaea96f3715c9473c63d2ca47 (diff)
parentd38a30df7dd54c5c6883af1de1a03ec7d523cee5 (diff)
downloadgit-71b3ef11fa0aade4a514c51b83438858a4a3c03b.tar.gz
Merge branch 'mm/conflict-advice'
* mm/conflict-advice: Be more user-friendly when refusing to do something because of conflict. Conflicts: Documentation/config.txt advice.c advice.h
Diffstat (limited to 'builtin-merge.c')
-rw-r--r--builtin-merge.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/builtin-merge.c b/builtin-merge.c
index 82e2a0491a..6f1311414b 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -849,11 +849,20 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
const char *best_strategy = NULL, *wt_strategy = NULL;
struct commit_list **remotes = &remoteheads;
- if (file_exists(git_path("MERGE_HEAD")))
- die("You have not concluded your merge. (MERGE_HEAD exists)");
- if (read_cache_unmerged())
- die("You are in the middle of a conflicted merge."
- " (index unmerged)");
+ if (read_cache_unmerged()) {
+ die_resolve_conflict("merge");
+ }
+ if (file_exists(git_path("MERGE_HEAD"))) {
+ /*
+ * There is no unmerged entry, don't advise 'git
+ * add/rm <file>', just 'git commit'.
+ */
+ if (advice_resolve_conflict)
+ die("You have not concluded your merge (MERGE_HEAD exists).\n"
+ "Please, commit your changes before you can merge.");
+ else
+ die("You have not concluded your merge (MERGE_HEAD exists).");
+ }
/*
* Check if we are _not_ on a detached HEAD, i.e. if there is a