Code

Merge branch 'mm/maint-merge-ff-error-message-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 9 Dec 2009 06:42:23 +0000 (22:42 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Dec 2009 06:42:23 +0000 (22:42 -0800)
* mm/maint-merge-ff-error-message-fix:
  builtin-merge: show user-friendly error messages for fast-forward too.
  merge-recursive: make the error-message generation an extern function

Conflicts:
merge-recursive.c

1  2 
builtin-merge.c
merge-recursive.c

diff --cc builtin-merge.c
Simple merge
index 1870448d98d56fea31af56953dc33f6529d1d380,72bfbaf43a26a00aab901c5f30fe76b1a788e3ba..cd3628c4d9b1831c73e752b3b49c9d88b9e23098
@@@ -1186,6 -1168,23 +1169,28 @@@ static int process_entry(struct merge_o
        return clean_merge;
  }
  
+ struct unpack_trees_error_msgs get_porcelain_error_msgs(void)
+ {
+       struct unpack_trees_error_msgs msgs = {
+               /* would_overwrite */
+               "Your local changes to '%s' would be overwritten by merge.  Aborting.",
+               /* not_uptodate_file */
+               "Your local changes to '%s' would be overwritten by merge.  Aborting.",
+               /* not_uptodate_dir */
+               "Updating '%s' would lose untracked files in it.  Aborting.",
+               /* would_lose_untracked */
+               "Untracked working tree file '%s' would be %s by merge.  Aborting",
+               /* bind_overlap -- will not happen here */
+               NULL,
+       };
++      if (advice_commit_before_merge) {
++              msgs.would_overwrite = msgs.not_uptodate_file =
++                      "Your local changes to '%s' would be overwritten by merge.  Aborting.\n"
++                      "Please, commit your changes or stash them before you can merge.";
++      }
+       return msgs;
+ }
  int merge_trees(struct merge_options *o,
                struct tree *head,
                struct tree *merge,