git-commit: clean up die messages
These are three types of cleanups here: 1. remove newline from die message (die/report adds it already) 2. typo: s/merger/merge/ 3. the old "* no commit message? aborting commit." is now prepended with "fatal: ", making the asterisk look a little funny. Let's just remove it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Dec 2, 2007 at 01:07 UTC
b5b644a93adb41bca590a3cdfd9b64ccf3614f50
1 file changed
+9
-10
builtin-commit.c
+9
-10
@@ -336,7 +336,7 @@ static int prepare_log_message(const char *index_file, const char *prefix)
336
337
fp = fopen(git_path(commit_editmsg), "w");
338
if (fp == NULL)
339
- die("could not open %s\n", git_path(commit_editmsg));
339
+ die("could not open %s", git_path(commit_editmsg));
340
341
stripspace(&sb, 0);
342
@@ -362,8 +362,7 @@ static int prepare_log_message(const char *index_file, const char *prefix)
362
}
363
364
if (fwrite(sb.buf, 1, sb.len, fp) < sb.len)
365
- die("could not write commit template: %s\n",
366
- strerror(errno));
365
+ die("could not write commit template: %s", strerror(errno));
366
367
strbuf_release(&sb);
368
@@ -470,13 +469,13 @@ static void determine_author_info(struct strbuf *sb)
469
470
a = strstr(use_message_buffer, "\nauthor ");
471
if (!a)
473
- die("invalid commit: %s\n", use_message);
472
+ die("invalid commit: %s", use_message);
473
474
lb = strstr(a + 8, " <");
475
rb = strstr(a + 8, "> ");
476
eol = strchr(a + 8, '\n');
477
if (!lb || !rb || !eol)
479
- die("invalid commit: %s\n", use_message);
478
+ die("invalid commit: %s", use_message);
479
480
name = xstrndup(a + 8, lb - (a + 8));
481
email = xstrndup(lb + 2, rb - (lb + 2));
@@ -488,7 +487,7 @@ static void determine_author_info(struct strbuf *sb)
487
const char *rb = strchr(force_author, '>');
488
489
if (!lb || !rb)
491
- die("malformed --author parameter\n");
490
+ die("malformed --author parameter");
491
name = xstrndup(force_author, lb - force_author);
492
email = xstrndup(lb + 2, rb - (lb + 2));
493
}
@@ -518,7 +517,7 @@ static int parse_and_validate_options(int argc, const char *argv[])
517
if (amend && initial_commit)
518
die("You have nothing to amend.");
519
if (amend && in_merge)
521
- die("You are in the middle of a merger -- cannot amend.");
520
+ die("You are in the middle of a merge -- cannot amend.");
521
522
if (use_message)
523
f++;
@@ -641,7 +640,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
640
641
commit = lookup_commit(sha1);
642
if (!commit)
644
- die("couldn't look up newly created commit\n");
643
+ die("couldn't look up newly created commit");
644
if (!commit || parse_commit(commit))
645
die("could not parse newly created commit");
646
@@ -777,7 +776,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
776
launch_editor(git_path(commit_editmsg), &sb, env);
777
} else if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
778
rollback_index_files();
780
- die("could not read commit message\n");
779
+ die("could not read commit message");
780
}
781
if (run_hook(index_file, "commit-msg", git_path(commit_editmsg))) {
782
rollback_index_files();
@@ -792,7 +791,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
791
stripspace(&sb, 1);
792
if (sb.len < header_len || message_is_empty(&sb, header_len)) {
793
rollback_index_files();
795
- die("* no commit message? aborting commit.");
794
+ die("no commit message? aborting commit.");
795
}
796
strbuf_addch(&sb, '\0');
797
if (is_encoding_utf8(git_commit_encoding) && !is_utf8(sb.buf))