{"thread":{"id":"11496","subject":"[PATCH] Make commit, cherry-pick and revert more silent.","startedAt":"2008-01-06T15:43:21Z","lastAt":"2008-01-07T08:55:09Z","messageCount":3,"participants":["Gabriel","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"64592","messageId":"1199634201-26013-1-git-send-email-g2p.code@gmail.com","threadId":"11496","inReplyTo":null,"subject":"[PATCH] Make commit, cherry-pick and revert more silent.","fromName":"Gabriel","fromEmail":"g2p.code@gmail.com","sentAt":"2008-01-06T15:43:21Z","receivedAt":"2008-01-06T15:43:21Z","isPatch":true,"sender":{"key":"g2p.code@gmail.com","avatar":null},"body":"Commit now obeys --quiet more.\nCherry-pick and revert call commit as --quiet.\nPrevents us from displaying working-tree status once or even twice.\n---\n builtin-commit.c |    4 +++-\n builtin-revert.c |    6 ++++--\n 2 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 73f1e35..96ace77 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -759,7 +759,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \n \tif (!prepare_log_message(index_file, prefix) && !in_merge &&\n \t    !allow_empty && !(amend && is_a_merge(head_sha1))) {\n-\t\trun_status(stdout, index_file, prefix, 0);\n+\t\tfprintf(stderr, \"There are no changes, not committing.\\n\");\n+\t\tif (!quiet)\n+\t\t\trun_status(stdout, index_file, prefix, 0);\n \t\trollback_index_files();\n \t\tunlink(commit_editmsg);\n \t\treturn 1;\ndiff --git a/builtin-revert.c b/builtin-revert.c\nindex 4bf8eb2..b925358 100644\n--- a/builtin-revert.c\n+++ b/builtin-revert.c\n@@ -392,9 +392,11 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n \n \tif (!no_commit) {\n \t\tif (edit)\n-\t\t\treturn execl_git_cmd(\"commit\", \"-n\", NULL);\n+\t\t\treturn execl_git_cmd(\"commit\", \"--quiet\",\n+\t\t\t\t\"-n\", NULL);\n \t\telse\n-\t\t\treturn execl_git_cmd(\"commit\", \"-n\", \"-F\", defmsg, NULL);\n+\t\t\treturn execl_git_cmd(\"commit\", \"--quiet\",\n+\t\t\t\t\"-n\", \"-F\", defmsg, NULL);\n \t}\n \tif (reencoded_message)\n \t\tfree(reencoded_message);\n-- \n1.5.4.rc2.39.g00d2\n"},{"id":"64609","messageId":"7vir2636tq.fsf@gitster.siamese.dyndns.org","threadId":"11496","inReplyTo":"1199634201-26013-1-git-send-email-g2p.code@gmail.com","subject":"Re: [PATCH] Make commit, cherry-pick and revert more silent.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-06T22:52:33Z","receivedAt":"2008-01-06T22:52:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gabriel <g2p.code@gmail.com> writes:\n\n> Commit now obeys --quiet more.\n> Cherry-pick and revert call commit as --quiet.\n> Prevents us from displaying working-tree status once or even twice.\n\nWell, you also need to defend that it is a good thing not to\nshow the status information during cherry-pick or revert much\nbetter, especially when we are this late into the -rc cycle.\n\n> diff --git a/builtin-commit.c b/builtin-commit.c\n> index 73f1e35..96ace77 100644\n> --- a/builtin-commit.c\n> +++ b/builtin-commit.c\n> @@ -759,7 +759,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n>  \n>  \tif (!prepare_log_message(index_file, prefix) && !in_merge &&\n>  \t    !allow_empty && !(amend && is_a_merge(head_sha1))) {\n> -\t\trun_status(stdout, index_file, prefix, 0);\n> +\t\tfprintf(stderr, \"There are no changes, not committing.\\n\");\n> +\t\tif (!quiet)\n> +\t\t\trun_status(stdout, index_file, prefix, 0);\n\nEspecially if you are introducing a change to a command you do\nnot even mention in the topic line of the patch.\n\nHaving said that, I think it is a good change, if the UI change\nto cherry-pick and revert only triggers when the operation did\nnot have any effect.\n\nIt is much harder to know for a user if a cherry-pick or revert\nwill result in such a situation before actually running these\ncommands, than when making his own commit.  And the status\noutput from underlying git-commit only distracts him by\nobscuring the punch-line \"nothing added to commit\", which is\ncurrently the only clue.  I'd agree that is a UI bug in the\ncurrent implementation of cherry-pick/revert.\n\nSo a more convincing presentation would be:\n\n * A single patch to \"git commit\".  The commit log message would\n   read:\n\n   When there is nothing to commit, \"git commit --quiet\" still\n   shows the status output before saying \"nothing added to\n   commit...\".  This patch makes it less verbose.\n\n * Another patch on top of it that runs \"git commit\" with\n   the \"--quiet\" option from cherry-pick and revert.  The commit\n   log message would read:\n\n   When cherry-pick or revert results in no change at all\n   (e.g. the user cherry-picked an ancestor of the current\n   commit), the command correctly refuses to create a new\n   commit, but it responds by showing the status output and\n   \"nothing added to commit\" message.\n\n   This is a very roundabout way to tell the user that the\n   cherry-pick or revert was unnecessary.  Especially because it\n   is much harder to know for a user if a cherry-pick or revert\n   will result in such a situation before actually running these\n   commands, than when making his own commit.\n\n   This patch makes cherry-pick and revert call \"git commit\"\n   with --quiet option to make the output much less confusing.\n\nAfter I wrote all that, I realized that the patch is not\nacceptable as is.\n\nWhy?\n\nThis makes a successful cherry-pick way too silent.  With your\npatch, we will see:\n\n * \"Auto-merged ...\" messages that shows what paths are affected\n   by the cherry-pick/revert (which I do not think we would want\n   to squelch),\n\n * \"Finished one cherry-pick.\"\n\nBut we will lose the \"Created commit ...: <msg>\" and \"<num>\nfiles changed...\"  summary, neither of which we would want to\nlose.\n\nAlso sign your patch (see Documentation/SubmittingPatches),\nplease, when you try the second round.\n\nThanks.\n"},{"id":"64632","messageId":"flspdc$4aa$1@ger.gmane.org","threadId":"11496","inReplyTo":"7vir2636tq.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Make commit, cherry-pick and revert more silent.","fromName":"Gabriel","fromEmail":"g2p.code@gmail.com","sentAt":"2008-01-07T08:55:09Z","receivedAt":"2008-01-07T08:55:09Z","isPatch":true,"sender":{"key":"g2p.code@gmail.com","avatar":null},"body":"Le Sun, 06 Jan 2008 14:52:33 -0800, Junio C Hamano a écrit :\n\n> So a more convincing presentation would be:\n> ...\nWill split.\n\n> After I wrote all that, I realized that the patch is not acceptable as\n> is.\n> \n> Why?\n> \n> This makes a successful cherry-pick way too silent.  With your patch, we\n> will see:\n> \n>  * \"Auto-merged ...\" messages that shows what paths are affected\n>    by the cherry-pick/revert (which I do not think we would want to\n>    squelch),\n> \n>  * \"Finished one cherry-pick.\"\n> \n> But we will lose the \"Created commit ...: <msg>\" and \"<num> files\n> changed...\"  summary, neither of which we would want to lose.\n\nI'll have a look.\nThis seems to require refactoring the interface between cherry-pick/\nrevert and commit.\n\n> Also sign your patch (see Documentation/SubmittingPatches), please, when\n> you try the second round.\n> \n> Thanks.\n\nThanks, I appreciate the review.\n"}]}