{"thread":{"id":"24982","subject":"[PATCH] Make commit help text more accurate for --verbose","startedAt":"2010-09-05T09:53:03Z","lastAt":"2010-09-14T09:08:39Z","messageCount":4,"participants":["Ramana Kumar","Thiago Farina","Ævar Arnfjörð Bjarmason"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"149963","messageId":"1283680383-12495-1-git-send-email-ramana.kumar@gmail.com","threadId":"24982","inReplyTo":null,"subject":"[PATCH] Make commit help text more accurate for --verbose","fromName":"Ramana Kumar","fromEmail":"ramana.kumar@gmail.com","sentAt":"2010-09-05T09:53:03Z","receivedAt":"2010-09-05T09:53:03Z","isPatch":true,"sender":{"key":"ramana.kumar@gmail.com","avatar":"https://gravatar.com/avatar/c1e354b4b3844c33709698d3c6491eb791f04384343001b78b4816b6ba3fa8a9?d=mp&s=160"},"body":"Commit message help text says lines starting with '#' will be ignored.\nThe diff lines added by --verbose are also ignored, although they don't\nstart with '#'s. Extend help text to describe behavior on diff lines\nwhen relevant.\n\nSigned-off-by: Ramana Kumar <ramana.kumar@gmail.com>\n---\n builtin/commit.c |   25 ++++++++++++++++++-------\n 1 files changed, 18 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 66fdd22..b49fd7a 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -658,17 +658,28 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\tfprintf(fp,\n \t\t\t\"\\n\"\n \t\t\t\"# Please enter the commit message for your changes.\");\n-\t\tif (cleanup_mode == CLEANUP_ALL)\n+\t\tif (cleanup_mode == CLEANUP_ALL && !verbose)\n \t\t\tfprintf(fp,\n \t\t\t\t\" Lines starting\\n\"\n \t\t\t\t\"# with '#' will be ignored, and an empty\"\n \t\t\t\t\" message aborts the commit.\\n\");\n-\t\telse /* CLEANUP_SPACE, that is. */\n-\t\t\tfprintf(fp,\n-\t\t\t\t\" Lines starting\\n\"\n-\t\t\t\t\"# with '#' will be kept; you may remove them\"\n-\t\t\t\t\" yourself if you want to.\\n\"\n-\t\t\t\t\"# An empty message aborts the commit.\\n\");\n+    else {\n+      if (cleanup_mode == CLEANUP_ALL)\n+        fprintf(fp,\n+          \" Lines starting\\n\"\n+          \"# with '#' will be ignored, as will\"\n+          \" the diff and anything below it.\\n\");\n+      else { /* CLEANUP_SPACE, that is. */\n+        fprintf(fp,\n+          \" Lines starting\\n\"\n+          \"# with '#' will be kept; you may remove them\"\n+          \" yourself if you want to.\\n\");\n+        if (verbose)\n+          fprintf(fp,\n+            \"# The diff and anything below it will be ignored.\\n\");\n+      }\n+      fprintf(fp, \"# An empty message aborts the commit.\\n\");\n+    }\n \t\tif (only_include_assumed)\n \t\t\tfprintf(fp, \"# %s\\n\", only_include_assumed);\n \n-- \n1.7.2.2\n"},{"id":"149968","messageId":"AANLkTinEZ92S_XB4zrnb26eVR-MFsDQcSPAZ3RXj6ofH@mail.gmail.com","threadId":"24982","inReplyTo":"1283680383-12495-1-git-send-email-ramana.kumar@gmail.com","subject":"Re: [PATCH] Make commit help text more accurate for --verbose","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2010-09-05T15:06:33Z","receivedAt":"2010-09-05T15:06:33Z","isPatch":true,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"Hi Ramana,\n\nSome *style* comments below.\nOn Sun, Sep 5, 2010 at 6:53 AM, Ramana Kumar <ramana.kumar@gmail.com> wrote:\n>                fprintf(fp,\n>                        \"\\n\"\n>                        \"# Please enter the commit message for your changes.\");\n> -               if (cleanup_mode == CLEANUP_ALL)\n> +               if (cleanup_mode == CLEANUP_ALL && !verbose)\n>                        fprintf(fp,\n>                                \" Lines starting\\n\"\n>                                \"# with '#' will be ignored, and an empty\"\n>                                \" message aborts the commit.\\n\");\nThe Documentation/CodingStyle says to avoid using braces unncessary.\nBut since this is not a single line statement, like:\nif (foo)\n  foo = x;\n\nCould you wrapp this into { } ?\n\n> -               else /* CLEANUP_SPACE, that is. */\n> -                       fprintf(fp,\n> -                               \" Lines starting\\n\"\n> -                               \"# with '#' will be kept; you may remove them\"\n> -                               \" yourself if you want to.\\n\"\n> -                               \"# An empty message aborts the commit.\\n\");\n> +    else {\n> +      if (cleanup_mode == CLEANUP_ALL)\n> +        fprintf(fp,\n> +          \" Lines starting\\n\"\n> +          \"# with '#' will be ignored, as will\"\n> +          \" the diff and anything below it.\\n\");\n\nSame thing here (and below) as pointed above.\n\n> +      else { /* CLEANUP_SPACE, that is. */\n> +        fprintf(fp,\n> +          \" Lines starting\\n\"\n> +          \"# with '#' will be kept; you may remove them\"\n> +          \" yourself if you want to.\\n\");\n> +        if (verbose)\n> +          fprintf(fp,\n> +            \"# The diff and anything below it will be ignored.\\n\");\n> +      }\n> +      fprintf(fp, \"# An empty message aborts the commit.\\n\");\n> +    }\n>                if (only_include_assumed)\n>                        fprintf(fp, \"# %s\\n\", only_include_assumed);\n>\n"},{"id":"149972","messageId":"AANLkTikLTykbgUjCK4H0cbF0QXZHOPYbLdptEKe4-rD5@mail.gmail.com","threadId":"24982","inReplyTo":"AANLkTinEZ92S_XB4zrnb26eVR-MFsDQcSPAZ3RXj6ofH@mail.gmail.com","subject":"Re: [PATCH] Make commit help text more accurate for --verbose","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-09-05T16:30:25Z","receivedAt":"2010-09-05T16:30:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sun, Sep 5, 2010 at 15:06, Thiago Farina <tfransosi@gmail.com> wrote:\n> Hi Ramana,\n>\n> Some *style* comments below.\n> On Sun, Sep 5, 2010 at 6:53 AM, Ramana Kumar <ramana.kumar@gmail.com> wrote:\n>>                fprintf(fp,\n>>                        \"\\n\"\n>>                        \"# Please enter the commit message for your changes.\");\n>> -               if (cleanup_mode == CLEANUP_ALL)\n>> +               if (cleanup_mode == CLEANUP_ALL && !verbose)\n>>                        fprintf(fp,\n>>                                \" Lines starting\\n\"\n>>                                \"# with '#' will be ignored, and an empty\"\n>>                                \" message aborts the commit.\\n\");\n> The Documentation/CodingStyle says to avoid using braces unncessary.\n> But since this is not a single line statement, like:\n> if (foo)\n>  foo = x;\n>\n> Could you wrapp this into { } ?\n\nThe braces are still unncessary if the function call is spread across\na few lines. I haven't seen anything in the source that indicates that\nwe prefer braces when a braceless if/else has an associated statement\nthat exceeds 1 line.\n"},{"id":"150668","messageId":"AANLkTin0W3HOwSQVFR_cm9oJzYib2yULkUc19Pg4yJD6@mail.gmail.com","threadId":"24982","inReplyTo":"AANLkTikLTykbgUjCK4H0cbF0QXZHOPYbLdptEKe4-rD5@mail.gmail.com","subject":"Re: [PATCH] Make commit help text more accurate for --verbose","fromName":"Ramana Kumar","fromEmail":"ramana.kumar@gmail.com","sentAt":"2010-09-14T09:08:39Z","receivedAt":"2010-09-14T09:08:39Z","isPatch":true,"sender":{"key":"ramana.kumar@gmail.com","avatar":"https://gravatar.com/avatar/c1e354b4b3844c33709698d3c6491eb791f04384343001b78b4816b6ba3fa8a9?d=mp&s=160"},"body":"On Mon, Sep 6, 2010 at 2:30 AM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> On Sun, Sep 5, 2010 at 15:06, Thiago Farina <tfransosi@gmail.com> wrote:\n>> Hi Ramana,\n>>\n>> Some *style* comments below.\n>> On Sun, Sep 5, 2010 at 6:53 AM, Ramana Kumar <ramana.kumar@gmail.com> wrote:\n>>>                fprintf(fp,\n>>>                        \"\\n\"\n>>>                        \"# Please enter the commit message for your changes.\");\n>>> -               if (cleanup_mode == CLEANUP_ALL)\n>>> +               if (cleanup_mode == CLEANUP_ALL && !verbose)\n>>>                        fprintf(fp,\n>>>                                \" Lines starting\\n\"\n>>>                                \"# with '#' will be ignored, and an empty\"\n>>>                                \" message aborts the commit.\\n\");\n>> The Documentation/CodingStyle says to avoid using braces unncessary.\n>> But since this is not a single line statement, like:\n>> if (foo)\n>>  foo = x;\n>>\n>> Could you wrapp this into { } ?\n>\n> The braces are still unncessary if the function call is spread across\n> a few lines. I haven't seen anything in the source that indicates that\n> we prefer braces when a braceless if/else has an associated statement\n> that exceeds 1 line.\n\nAny other suggestions to improve this patch?\n"}]}