Code

difftool: Update copyright notices to list each year separately
[git.git] / merge-recursive.c
index 72bfbaf43a26a00aab901c5f30fe76b1a788e3ba..dd4fbd0e6bc22f2e5f5667205b47165f8aebbbd0 100644 (file)
@@ -3,6 +3,7 @@
  * Fredrik Kuivinen.
  * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
  */
+#include "advice.h"
 #include "cache.h"
 #include "cache-tree.h"
 #include "commit.h"
@@ -86,6 +87,7 @@ static void flush_output(struct merge_options *o)
        }
 }
 
+__attribute__((format (printf, 3, 4)))
 static void output(struct merge_options *o, int v, const char *fmt, ...)
 {
        int len;
@@ -202,7 +204,8 @@ struct tree *write_tree_from_memory(struct merge_options *o)
                for (i = 0; i < active_nr; i++) {
                        struct cache_entry *ce = active_cache[i];
                        if (ce_stage(ce))
-                               output(o, 0, "%d %.*s", ce_stage(ce), ce_namelen(ce), ce->name);
+                               output(o, 0, "%d %.*s", ce_stage(ce),
+                                      (int)ce_namelen(ce), ce->name);
                }
                return NULL;
        }
@@ -1182,6 +1185,11 @@ struct unpack_trees_error_msgs get_porcelain_error_msgs(void)
                /* 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;
 }