{"thread":{"id":"5377","subject":"[PATCH] cg-commit: Fix a typo that would inhibit running of post-commit script:","startedAt":"2006-08-24T18:19:54Z","lastAt":"2006-09-24T17:39:58Z","messageCount":4,"participants":["Jim Meyering","Jonas Fonseca","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"25860","messageId":"8764giro6t.fsf@rho.meyering.net","threadId":"5377","inReplyTo":null,"subject":"[PATCH] cg-commit: Fix a typo that would inhibit running of post-commit script:","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2006-08-24T18:19:54Z","receivedAt":"2006-08-24T18:19:54Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"I tried cg-commit with a commit hook, but the hook never ran.\nThe problem was a typo:\n\nFix a typo that would inhibit running the post-commit script:\ns/commit-post/post-commit/.\n\nSigned-off-by: Jim Meyering <jim@meyering.net>\n---\n cg-commit |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/cg-commit b/cg-commit\nindex 9d3b1a1..82eea60 100755\n--- a/cg-commit\n+++ b/cg-commit\n@@ -604,15 +604,16 @@ if [ \"$newhead\" ]; then\n \t\tbranchname=\"$(cat \"$_git/branch-name\")\"\n \tfi\n \t[ -z \"$branchname\" ] && [ \"$_git_head\" != \"master\" ] && branchname=\"$_git_head\"\n-\tif [ -x \"$_git/hooks/post-commit\" -a ! \"$no_hooks\" ]; then\n+\tpost_commit=\"$_git/hooks/post-commit\"\n+\tif [ -x \"$post_commit\" -a ! \"$no_hooks\" ]; then\n \t\tif [ \"$(git-repo-config --bool cogito.hooks.commit.post.allmerged)\" = \"true\" ]; then\n \t\t\t# We just hope that for the initial commit, the user didn't\n \t\t\t# manage to install the hook yet.\n \t\t\tfor merged in $(git-rev-list $newhead ^$oldhead | tac); do\n-\t\t\t\t\"$_git/hooks/post-commit\" \"$merged\" \"$branchname\"\n+\t\t\t\t\"$post_commit\" \"$merged\" \"$branchname\"\n \t\t\tdone\n \t\telse\n-\t\t\t\"$_git/hooks/post-commit\" \"$newhead\" \"$branchname\"\n+\t\t\t\"$post_commit\" \"$newhead\" \"$branchname\"\n \t\tfi\n \tfi\n \n-- \n1.4.1.1\n"},{"id":"25871","messageId":"20060825002013.GG2817@diku.dk","threadId":"5377","inReplyTo":"8764giro6t.fsf@rho.meyering.net","subject":"Re: [PATCH] cg-commit: Fix a typo that would inhibit running of post-commit script:","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2006-08-25T00:20:13Z","receivedAt":"2006-08-25T00:20:13Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Jim Meyering <jim@meyering.net> wrote Thu, Aug 24, 2006:\n> I tried cg-commit with a commit hook, but the hook never ran.\n> The problem was a typo:\n> \n> Fix a typo that would inhibit running the post-commit script:\n> s/commit-post/post-commit/.\n\nIf I remember correctly, historically, the commit-post existed before\nthe post-commit appeared. You can see that it is documented in the man\npage so it is not a typo.\n\nHowever, this should certainly be updated, but I think a better fix\nwould be to transitionally warn the user about the existence of the\ncommit-post hook before using it in favour of post-commit.\n\n> diff --git a/cg-commit b/cg-commit\n> index 9d3b1a1..82eea60 100755\n> --- a/cg-commit\n> +++ b/cg-commit\n> @@ -604,15 +604,16 @@ if [ \"$newhead\" ]; then\n>  \t\tbranchname=\"$(cat \"$_git/branch-name\")\"\n>  \tfi\n>  \t[ -z \"$branchname\" ] && [ \"$_git_head\" != \"master\" ] && branchname=\"$_git_head\"\n> -\tif [ -x \"$_git/hooks/post-commit\" -a ! \"$no_hooks\" ]; then\n> +\tpost_commit=\"$_git/hooks/post-commit\"\n> +\tif [ -x \"$post_commit\" -a ! \"$no_hooks\" ]; then\n>  \t\tif [ \"$(git-repo-config --bool cogito.hooks.commit.post.allmerged)\" = \"true\" ]; then\n>  \t\t\t# We just hope that for the initial commit, the user didn't\n>  \t\t\t# manage to install the hook yet.\n>  \t\t\tfor merged in $(git-rev-list $newhead ^$oldhead | tac); do\n> -\t\t\t\t\"$_git/hooks/post-commit\" \"$merged\" \"$branchname\"\n> +\t\t\t\t\"$post_commit\" \"$merged\" \"$branchname\"\n>  \t\t\tdone\n>  \t\telse\n> -\t\t\t\"$_git/hooks/post-commit\" \"$newhead\" \"$branchname\"\n> +\t\t\t\"$post_commit\" \"$newhead\" \"$branchname\"\n>  \t\tfi\n>  \tfi\n\nThe patch looks more like a refactoring of a previous commit that did\nthe commit-post -> post-commit replacement.\n\n-- \nJonas Fonseca\n"},{"id":"27002","messageId":"87ac4zq237.fsf@rho.meyering.net","threadId":"5377","inReplyTo":"20060825002013.GG2817@diku.dk","subject":"Re: [PATCH] cg-commit: Fix a typo that would inhibit running of post-commit script:","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2006-09-16T15:10:36Z","receivedAt":"2006-09-16T15:10:36Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"Jonas Fonseca <fonseca@diku.dk> wrote:\n> Jim Meyering <jim@meyering.net> wrote Thu, Aug 24, 2006:\n>> I tried cg-commit with a commit hook, but the hook never ran.\n>> The problem was a typo:\n>>\n>> Fix a typo that would inhibit running the post-commit script:\n>> s/commit-post/post-commit/.\n>\n> If I remember correctly, historically, the commit-post existed before\n> the post-commit appeared. You can see that it is documented in the man\n> page so it is not a typo.\n>\n> However, this should certainly be updated, but I think a better fix\n> would be to transitionally warn the user about the existence of the\n> commit-post hook before using it in favour of post-commit.\n\nHow about this?\nCheck for both and if there's exactly one, use that.\nIf it's the old one, give a diagnostic suggesting to rename it.\nIf both exist, execute neither, give a diagnostic and fail.\n\nIf you like this, I'll prepare a patch.\n\n>> diff --git a/cg-commit b/cg-commit\n>> index 9d3b1a1..82eea60 100755\n>> --- a/cg-commit\n>> +++ b/cg-commit\n>> @@ -604,15 +604,16 @@ if [ \"$newhead\" ]; then\n>>  \t\tbranchname=\"$(cat \"$_git/branch-name\")\"\n>>  \tfi\n>>  \t[ -z \"$branchname\" ] && [ \"$_git_head\" != \"master\" ] && branchname=\"$_git_head\"\n>> -\tif [ -x \"$_git/hooks/post-commit\" -a ! \"$no_hooks\" ]; then\n>> +\tpost_commit=\"$_git/hooks/post-commit\"\n>> +\tif [ -x \"$post_commit\" -a ! \"$no_hooks\" ]; then\n>>  \t\tif [ \"$(git-repo-config --bool cogito.hooks.commit.post.allmerged)\" = \"true\" ]; then\n>>  \t\t\t# We just hope that for the initial commit, the user didn't\n>>  \t\t\t# manage to install the hook yet.\n>>  \t\t\tfor merged in $(git-rev-list $newhead ^$oldhead | tac); do\n>> -\t\t\t\t\"$_git/hooks/post-commit\" \"$merged\" \"$branchname\"\n>> +\t\t\t\t\"$post_commit\" \"$merged\" \"$branchname\"\n>>  \t\t\tdone\n>>  \t\telse\n>> -\t\t\t\"$_git/hooks/post-commit\" \"$newhead\" \"$branchname\"\n>> +\t\t\t\"$post_commit\" \"$newhead\" \"$branchname\"\n>>  \t\tfi\n>>  \tfi\n>\n> The patch looks more like a refactoring of a previous commit that did\n> the commit-post -> post-commit replacement.\n\nExactly :)\n"},{"id":"27566","messageId":"20060924173958.GV20017@pasky.or.cz","threadId":"5377","inReplyTo":"87ac4zq237.fsf@rho.meyering.net","subject":"Re: [PATCH] cg-commit: Fix a typo that would inhibit running of post-commit script:","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-24T17:39:58Z","receivedAt":"2006-09-24T17:39:58Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, Sep 16, 2006 at 05:10:36PM CEST, I got a letter\nwhere Jim Meyering <jim@meyering.net> said that...\n> Jonas Fonseca <fonseca@diku.dk> wrote:\n> > Jim Meyering <jim@meyering.net> wrote Thu, Aug 24, 2006:\n> >> I tried cg-commit with a commit hook, but the hook never ran.\n> >> The problem was a typo:\n> >>\n> >> Fix a typo that would inhibit running the post-commit script:\n> >> s/commit-post/post-commit/.\n> >\n> > If I remember correctly, historically, the commit-post existed before\n> > the post-commit appeared. You can see that it is documented in the man\n> > page so it is not a typo.\n> >\n> > However, this should certainly be updated, but I think a better fix\n> > would be to transitionally warn the user about the existence of the\n> > commit-post hook before using it in favour of post-commit.\n> \n> How about this?\n> Check for both and if there's exactly one, use that.\n> If it's the old one, give a diagnostic suggesting to rename it.\n> If both exist, execute neither, give a diagnostic and fail.\n> \n> If you like this, I'll prepare a patch.\n\nThat would be awesome. :-)\n\nThanks in advance,\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"}]}