]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin/merge.c
revert: fix off by one read when searching the end of a commit subject
[git.git] / builtin / merge.c
index 0ae480987ac4d97af437e27a9e4d6b8e4ecf4211..cae1cbee26535635cfe0d7e3a6f98e3a36e94cf7 100644 (file)
@@ -981,18 +981,22 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                /*
                 * All the rest are the commits being merged;
                 * prepare the standard merge summary message to
-                * used as the merge message.  If remote
+                * be appended to the given message.  If remote
                 * is invalid we will die later in the common
                 * codepath so we discard the error in this
                 * loop.
                 */
-               if (!have_message) {
-                       for (i = 0; i < argc; i++)
-                               merge_name(argv[i], &merge_names);
+               for (i = 0; i < argc; i++)
+                       merge_name(argv[i], &merge_names);
+
+               if (have_message && option_log)
+                       fmt_merge_msg_shortlog(&merge_names, &merge_msg);
+               else if (!have_message)
                        fmt_merge_msg(option_log, &merge_names, &merge_msg);
-                       if (merge_msg.len)
-                               strbuf_setlen(&merge_msg, merge_msg.len-1);
-               }
+
+
+               if (!(have_message && !option_log) && merge_msg.len)
+                       strbuf_setlen(&merge_msg, merge_msg.len-1);
        }
 
        if (head_invalid || !argc)