{"thread":{"id":"11089","subject":"[PATCH resend] git-commit: clean up die messages","startedAt":"2007-12-02T06:07:03Z","lastAt":"2007-12-02T06:07:03Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"61624","messageId":"20071202060703.GA25371@coredump.intra.peff.net","threadId":"11089","inReplyTo":null,"subject":"[PATCH resend] git-commit: clean up die messages","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-12-02T06:07:03Z","receivedAt":"2007-12-02T06:07:03Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"These are three types of cleanups here:\n\n  1. remove newline from die message (die/report adds it\n     already)\n  2. typo: s/merger/merge/\n  3. the old \"* no commit message?  aborting commit.\" is now\n     prepended with \"fatal: \", making the asterisk look a\n     little funny. Let's just remove it.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n[sorry for the resend, I totally munged Kristian's address in the first\none].\n\nI actually noticed number 3, and while fixing it, saw the others. The\nwording in number 3 is a bit awkward, IMHO. I wonder if it might be\nbetter as something like:\n\n  fatal: aborting commit with empty message\n\n builtin-commit.c |   19 +++++++++----------\n 1 files changed, 9 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 0f1ae17..f6e8e44 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -336,7 +336,7 @@ static int prepare_log_message(const char *index_file, const char *prefix)\n \n \tfp = fopen(git_path(commit_editmsg), \"w\");\n \tif (fp == NULL)\n-\t\tdie(\"could not open %s\\n\", git_path(commit_editmsg));\n+\t\tdie(\"could not open %s\", git_path(commit_editmsg));\n \n \tstripspace(&sb, 0);\n \n@@ -362,8 +362,7 @@ static int prepare_log_message(const char *index_file, const char *prefix)\n \t}\n \n \tif (fwrite(sb.buf, 1, sb.len, fp) < sb.len)\n-\t\tdie(\"could not write commit template: %s\\n\",\n-\t\t    strerror(errno));\n+\t\tdie(\"could not write commit template: %s\", strerror(errno));\n \n \tstrbuf_release(&sb);\n \n@@ -470,13 +469,13 @@ static void determine_author_info(struct strbuf *sb)\n \n \t\ta = strstr(use_message_buffer, \"\\nauthor \");\n \t\tif (!a)\n-\t\t\tdie(\"invalid commit: %s\\n\", use_message);\n+\t\t\tdie(\"invalid commit: %s\", use_message);\n \n \t\tlb = strstr(a + 8, \" <\");\n \t\trb = strstr(a + 8, \"> \");\n \t\teol = strchr(a + 8, '\\n');\n \t\tif (!lb || !rb || !eol)\n-\t\t\tdie(\"invalid commit: %s\\n\", use_message);\n+\t\t\tdie(\"invalid commit: %s\", use_message);\n \n \t\tname = xstrndup(a + 8, lb - (a + 8));\n \t\temail = xstrndup(lb + 2, rb - (lb + 2));\n@@ -488,7 +487,7 @@ static void determine_author_info(struct strbuf *sb)\n \t\tconst char *rb = strchr(force_author, '>');\n \n \t\tif (!lb || !rb)\n-\t\t\tdie(\"malformed --author parameter\\n\");\n+\t\t\tdie(\"malformed --author parameter\");\n \t\tname = xstrndup(force_author, lb - force_author);\n \t\temail = xstrndup(lb + 2, rb - (lb + 2));\n \t}\n@@ -518,7 +517,7 @@ static int parse_and_validate_options(int argc, const char *argv[])\n \tif (amend && initial_commit)\n \t\tdie(\"You have nothing to amend.\");\n \tif (amend && in_merge)\n-\t\tdie(\"You are in the middle of a merger -- cannot amend.\");\n+\t\tdie(\"You are in the middle of a merge -- cannot amend.\");\n \n \tif (use_message)\n \t\tf++;\n@@ -641,7 +640,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)\n \n \tcommit = lookup_commit(sha1);\n \tif (!commit)\n-\t\tdie(\"couldn't look up newly created commit\\n\");\n+\t\tdie(\"couldn't look up newly created commit\");\n \tif (!commit || parse_commit(commit))\n \t\tdie(\"could not parse newly created commit\");\n \n@@ -777,7 +776,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \t\tlaunch_editor(git_path(commit_editmsg), &sb, env);\n \t} else if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {\n \t\trollback_index_files();\n-\t\tdie(\"could not read commit message\\n\");\n+\t\tdie(\"could not read commit message\");\n \t}\n \tif (run_hook(index_file, \"commit-msg\", git_path(commit_editmsg))) {\n \t\trollback_index_files();\n@@ -792,7 +791,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tstripspace(&sb, 1);\n \tif (sb.len < header_len || message_is_empty(&sb, header_len)) {\n \t\trollback_index_files();\n-\t\tdie(\"* no commit message?  aborting commit.\");\n+\t\tdie(\"no commit message?  aborting commit.\");\n \t}\n \tstrbuf_addch(&sb, '\\0');\n \tif (is_encoding_utf8(git_commit_encoding) && !is_utf8(sb.buf))\n-- \n1.5.3.6.2092.gf4c21-dirty\n"}]}