On Fri, Jul 17, 2015 at 11:58 AM, Garbageyard <varuag.chhabra@xxxxxxxxx> wrote: > We have a pre-receive hook that checks for JIRA ID whenever someone pushes > code to Git server. I'm trying to avoid this check when someone is applying > a tag. Here's the link for the script: http://pastebin.com/VnMQp5ar > > This is the link for output: http://pastebin.com/tBGmYaZF > > Problem is that if i run the following command, the output that i get on > command line is 0 > > git describe --exact-match ac28ca721e67adc04078786164939989a5112d98 2>&1 | > grep -o fatal | wc -w > > So i'm wondering why it's not entering the IF block (as confirmed in the > output link) > Probably due to environment variables set by the git hook. But.. this is definitely not at *ALL* what you want to do. Junio has a good explanation below. This doesn't make even any sense at all to me... > I agree this is a bad implementation (and i will change it soon) for > checking tags and can be easily done by just checking whether $refname > starts with refs/tags/ but i'll really appreciate if someone could tell me > the mistake i'm committing. I've spent few hours banging my head on this. > > > Ok, so the issue I believe is this: you're running git describe on the local side. But the pre-receive hook hasn't actually accepted the ref yet so git-describe on the server will fail. This is why you should just check refs/tags/* as regular pre-receive hook examples do. Regards, Jake > -- > View this message in context: http://git.661346.n2.nabble.com/Git-tag-pre-receive-hook-issue-tp7635764.html > Sent from the git mailing list archive at Nabble.com. > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html