I tried the below,
when I am individually running ./pre-receive its working, but when I try to
push even If am not giving jirs issue its pushing to remote.
Please help me on this
#!/usr/bin/perl
# Force JIRA ticket in commit messages
my $errors = 0;
chomp(my @commits = `git rev-parse --abbrev-ref HEAD`);
if ($?) {
warn "git rev-list $old..$new failed\n";
++$errors, next;
}
foreach my $sha1 (@commits) {
my $msg = `git cat-file commit $sha1`;
if ($?) {
warn "git cat-file commit $sha1 failed";
++$errors, next;
}
$msg =~ s/\A.+? ^$ \s+//smx;
unless ($msg =~ /^[A-Z]+-[0-9]/) {
warn "The git commit message for $sha1\n";
warn "must be prepended with a valid JIRA key.\n";
warn "Use CAPS for the project key.\n";
warn "For example:\n";
warn " KEY-123: $msg\n";
warn "Use \"git commit --amend -m\" to fix the message or\n";
warn "\"git rebase\" if you are pushing multiple commits.\n";
++$errors, next;
}
}
exit $errors == 0 ? 0 : 1;
On Wednesday, December 7, 2016 at 4:05:20 PM UTC+5:30, Konstantin Khomoutov
wrote:
>
> On Wed, 7 Dec 2016 02:27:12 -0800 (PST)
> [email protected] <javascript:> wrote:
>
> > I am looking for this code.
> > Can you provide me the full script/code after doing this changes
>
> No. I don't have any.
>
> But what have you tried [1] before asking for it?
>
> 1. http://whathaveyoutried.com
>
> > On Thursday, September 5, 2013 at 3:32:27 PM UTC+5:30, Konstantin
> > Khomoutov wrote:
> > >
> > > On Wed, 4 Sep 2013 11:39:21 -0700 (PDT)
> > > Ling <[email protected] <javascript:>> wrote:
> > >
> > > > Thanks Konstantin, Yes I tried git log $newname $(git merge-base
> > > > $oldname $newname) and it works fine.
> > >
> > > That is not quite correct a call -- the proper one is
> > >
> > > git log $newname ^$basename
> > >
> > > or, expanded,
> > >
> > > git log $newname ^$(git merge-base $oldname $newname)
> > >
> > > Notice the "^" character in front of the second commit -- it's
> > > meaning is to exclude all commits reachable from the following
> > > revision specification from the set of commits defined by the first
> > > revision specification.
> > >
> > > See the "Specifying Ranges" section of the gitrevisions manual [1].
> > >
> > > I, indeed, did not use "^" for the $basename argument in my
> > > previous e-mail to this thread (from which you seem to have finally
> > > copied the code), as I was in a hurry. My apologies for confusion.
> > >
> > > 1.
> > > https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html
> > >
>
--
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.