if (!strcmp(arg, "-n") || !strcmp(arg, "--no-commit"))
no_commit = 1;
else if (!strcmp(arg, "-e") || !strcmp(arg, "--edit"))
if (!strcmp(arg, "-n") || !strcmp(arg, "--no-commit"))
no_commit = 1;
else if (!strcmp(arg, "-e") || !strcmp(arg, "--edit"))
static int msg_fd;
static void add_to_msg(const char *string)
{
int len = strlen(string);
if (write_in_full(msg_fd, string, len) < 0)
static int msg_fd;
static void add_to_msg(const char *string)
{
int len = strlen(string);
if (write_in_full(msg_fd, string, len) < 0)
- char *oneline, *encoding, *reencoded_message = NULL;
- const char *message;
+ char *oneline, *reencoded_message = NULL;
+ const char *message, *encoding;
+ const char *defmsg = xstrdup(git_path("MERGE_MSG"));
- add_to_msg("Revert ");
- add_to_msg(find_unique_abbrev(commit->object.sha1,
- DEFAULT_ABBREV));
- add_to_msg(oneline);
- add_to_msg("\nThis reverts commit ");
+ add_to_msg("Revert \"");
+ add_to_msg(oneline_body + 1);
+ add_to_msg("\"\n\nThis reverts commit ");
sha1_to_hex(head), "HEAD",
sha1_to_hex(next->object.sha1), oneline) ||
write_tree(head, 0, NULL)) {
sha1_to_hex(head), "HEAD",
sha1_to_hex(next->object.sha1), oneline) ||
write_tree(head, 0, NULL)) {
- die ("Error wrapping up .msg");
- unlink(target);
- if (rename(".msg", target))
- die ("Could not move .msg to %s", target);
+ die ("Error wrapping up %s", defmsg);
fprintf(stderr, "Automatic %s failed. "
"After resolving the conflicts,\n"
"mark the corrected paths with 'git-add <paths>'\n"
fprintf(stderr, "Automatic %s failed. "
"After resolving the conflicts,\n"
"mark the corrected paths with 'git-add <paths>'\n"
- return execl_git_cmd("commit", "-n", "-F", ".msg",
- "-e", NULL);
+ return execl_git_cmd("commit", "-n", NULL);
- return execl_git_cmd("commit", "-n", "-F", ".msg",
- NULL);
+ return execl_git_cmd("commit", "-n", "-F", defmsg, NULL);