{"thread":{"id":"33242","subject":"[PATCH] git-am: fix \"Applying\" message when applypatch-hook was run","startedAt":"2013-03-20T23:18:29Z","lastAt":"2013-03-21T02:40:17Z","messageCount":4,"participants":["Simon Ruderich","Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"211833","messageId":"b978a77f8a37c47b2d6c2201d1f7cfffa01f8443.1363820289.git.simon@ruderich.org","threadId":"33242","inReplyTo":null,"subject":"[PATCH] git-am: fix \"Applying\" message when applypatch-hook was run","fromName":"Simon Ruderich","fromEmail":"simon@ruderich.org","sentAt":"2013-03-20T23:18:29Z","receivedAt":"2013-03-20T23:18:29Z","isPatch":true,"sender":{"key":"simon@ruderich.org","avatar":"https://avatars.githubusercontent.com/u/390994?v=4"},"body":"---\nHello,\n\nThis patch fixes a minor issue with git-am. When the\napplypatch-hook modifies the commit message, git-am displays the\noriginal message. This patch updates the message to use the\nmodified version.\n\nRegards\nSimon\n\n git-am.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 202130f..0997077 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -795,6 +795,14 @@ To restore the original branch and stop patching run \\\"\\$cmdline --abort\\\".\"\n \tthen\n \t\t\"$GIT_DIR\"/hooks/applypatch-msg \"$dotest/final-commit\" ||\n \t\tstop_here $this\n+\n+\t\t# applypatch-msg can update the commit message.\n+\t\tif test -f \"$dotest/final-commit\"\n+\t\tthen\n+\t\t\tFIRSTLINE=$(sed 1q \"$dotest/final-commit\")\n+\t\telse\n+\t\t\tFIRSTLINE=\"\"\n+\t\tfi\n \tfi\n \n \tsay \"$(eval_gettext \"Applying: \\$FIRSTLINE\")\"\n-- \n1.8.2\n\n-- \n+ privacy is necessary\n+ using gnupg http://gnupg.org\n+ public key id: 0x92FEFDB7E44C32F9\n"},{"id":"211834","messageId":"vpqli9hmyov.fsf@grenoble-inp.fr","threadId":"33242","inReplyTo":"b978a77f8a37c47b2d6c2201d1f7cfffa01f8443.1363820289.git.simon@ruderich.org","subject":"Re: [PATCH] git-am: fix \"Applying\" message when applypatch-hook was run","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-03-20T23:36:00Z","receivedAt":"2013-03-20T23:36:00Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Simon Ruderich <simon@ruderich.org> writes:\n\n> ---\n> Hello,\n>\n> This patch fixes a minor issue with git-am. When the\n> applypatch-hook modifies the commit message, git-am displays the\n> original message. This patch updates the message to use the\n> modified version.\n\nPlease, read SubmittingPatches in the Documentation directory of Git's\nsource tree. Your text above should be a commit message (hence, no\nhello), and should not be below the --- line.\n\nAlso, read about signed-off-by in the same document.\n\n> diff --git a/git-am.sh b/git-am.sh\n> index 202130f..0997077 100755\n> --- a/git-am.sh\n> +++ b/git-am.sh\n> @@ -795,6 +795,14 @@ To restore the original branch and stop patching run \\\"\\$cmdline --abort\\\".\"\n>  \tthen\n>  \t\t\"$GIT_DIR\"/hooks/applypatch-msg \"$dotest/final-commit\" ||\n>  \t\tstop_here $this\n> +\n> +\t\t# applypatch-msg can update the commit message.\n> +\t\tif test -f \"$dotest/final-commit\"\n> +\t\tthen\n> +\t\t\tFIRSTLINE=$(sed 1q \"$dotest/final-commit\")\n> +\t\telse\n> +\t\t\tFIRSTLINE=\"\"\n> +\t\tfi\n>  \tfi\n\nThis copy/paste a piece of code that is already a few lines above. Is\nthere any reason not to _move_ the assignment to FIRSTLINE after the \"if\ntest -x \"$GIT_DIR\"/hooks/applypatch-msg\", to avoid duplicating?\n\nThanks,\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"211835","messageId":"7v1ub9d3xw.fsf@alter.siamese.dyndns.org","threadId":"33242","inReplyTo":"vpqli9hmyov.fsf@grenoble-inp.fr","subject":"Re: [PATCH] git-am: fix \"Applying\" message when applypatch-hook was run","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-03-20T23:52:43Z","receivedAt":"2013-03-20T23:52:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Please, read SubmittingPatches in the Documentation directory of Git's\n> source tree. Your text above should be a commit message (hence, no\n> hello), and should not be below the --- line.\n>\n> Also, read about signed-off-by in the same document.\n> ...\n> This copy/paste a piece of code that is already a few lines above. Is\n> there any reason not to _move_ the assignment to FIRSTLINE after the \"if\n> test -x \"$GIT_DIR\"/hooks/applypatch-msg\", to avoid duplicating?\n\nMore importantly, is this change even desirable?\n\nThe original motivation behind the \"Applying:\" message was to help\nthe user identify which one of the 100+ patches being fed to the\ncommand, and it was not about showing what we ended up committing.\nWhen you are running the command interactively, we do grab the\nedited result since f23272f3fd84 (git-am -i: report rewritten title,\n2007-12-04), but I tend to feel that the automated munging done by\napplypatch-msg falls into a different category.\n"},{"id":"211836","messageId":"20130321024017.GA17205@ruderich.org","threadId":"33242","inReplyTo":"7v1ub9d3xw.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-am: fix \"Applying\" message when applypatch-hook was run","fromName":"Simon Ruderich","fromEmail":"simon@ruderich.org","sentAt":"2013-03-21T02:40:17Z","receivedAt":"2013-03-21T02:40:17Z","isPatch":true,"sender":{"key":"simon@ruderich.org","avatar":"https://avatars.githubusercontent.com/u/390994?v=4"},"body":"applypatch-hook can modify the commit message. Display the updated\ncommit message instead of the original one.\n\nSigned-off-by: Simon Ruderich <simon@ruderich.org>\n---\n\nOn Thu, Mar 21, 2013 at 12:36:00AM +0100, Matthieu Moy wrote:\n> Please, read SubmittingPatches in the Documentation directory of Git's\n> source tree. Your text above should be a commit message (hence, no\n> hello), and should not be below the --- line.\n>\n> Also, read about signed-off-by in the same document.\n\nHello Matthieu,\n\nThank you for the suggestions. I've adapted the patch message and\nadded the signed-off.\n\n> This copy/paste a piece of code that is already a few lines above. Is\n> there any reason not to _move_ the assignment to FIRSTLINE after the \"if\n> test -x \"$GIT_DIR\"/hooks/applypatch-msg\", to avoid duplicating?\n\nNo, there wasn't a reason not to move the code. I just wasn't\nsure if it had any side effects. But I rechecked and it should\nwork fine. Updating version attached.\n\nOn Wed, Mar 20, 2013 at 04:52:43PM -0700, Junio C Hamano wrote:\n> More importantly, is this change even desirable?\n>\n> The original motivation behind the \"Applying:\" message was to help\n> the user identify which one of the 100+ patches being fed to the\n> command, and it was not about showing what we ended up committing.\n> When you are running the command interactively, we do grab the\n> edited result since f23272f3fd84 (git-am -i: report rewritten title,\n> 2007-12-04), but I tend to feel that the automated munging done by\n> applypatch-msg falls into a different category.\n\nWhen I first used the applypatch-msg hook I was confused because\nthe messages were different and I thought the hook wasn't\nworking, hence the patch.\n\nI'm not sure how extensive most applypatch-msg hooks modify the\ncommit message (in my case just a number prepended), but I think\nit's more natural and less confusing to see the message which is\nbeing applied.\n\nIf the original behaviour is preferred, a short comment in\ngithooks(5) should prevent any confusion.\n\nRegards\nSimon\n\n git-am.sh | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 202130f..c092855 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -778,13 +778,6 @@ To restore the original branch and stop patching run \\\"\\$cmdline --abort\\\".\"\n \t    action=yes\n \tfi\n \n-\tif test -f \"$dotest/final-commit\"\n-\tthen\n-\t\tFIRSTLINE=$(sed 1q \"$dotest/final-commit\")\n-\telse\n-\t\tFIRSTLINE=\"\"\n-\tfi\n-\n \tif test $action = skip\n \tthen\n \t\tgo_next\n@@ -797,6 +790,13 @@ To restore the original branch and stop patching run \\\"\\$cmdline --abort\\\".\"\n \t\tstop_here $this\n \tfi\n \n+\tif test -f \"$dotest/final-commit\"\n+\tthen\n+\t\tFIRSTLINE=$(sed 1q \"$dotest/final-commit\")\n+\telse\n+\t\tFIRSTLINE=\"\"\n+\tfi\n+\n \tsay \"$(eval_gettext \"Applying: \\$FIRSTLINE\")\"\n \n \tcase \"$resolved\" in\n-- \n1.8.2\n\n-- \n+ privacy is necessary\n+ using gnupg http://gnupg.org\n+ public key id: 0x92FEFDB7E44C32F9\n"}]}