forked from lix-project/hydra
Pass the abbreviated Git revision
The abbreviated Git revision hash (e.g. "267480b") is typically contained in ‘gitTag’ as well, but the latter can contain other elements as well, e.g., the delta to the closest tag. That may be undesirable in version strings, so this is an alternative.
This commit is contained in:
parent
b1da85140d
commit
9fe8c43437
|
@ -401,12 +401,15 @@ sub fetchInputGit {
|
||||||
}
|
}
|
||||||
|
|
||||||
# For convenience in producing readable version names, pass the
|
# For convenience in producing readable version names, pass the
|
||||||
# number of commits in the history of this revision (‘revCount‘)
|
# number of commits in the history of this revision (‘revCount’)
|
||||||
# and the output of git-describe (‘gitTag’).
|
# the output of git-describe (‘gitTag’), and the abbreviated
|
||||||
|
# revision (‘shortRev’).
|
||||||
my $revCount = `git rev-list $revision | wc -l`; chomp $revCount;
|
my $revCount = `git rev-list $revision | wc -l`; chomp $revCount;
|
||||||
die "git rev-list failed" if $? != 0;
|
die "git rev-list failed" if $? != 0;
|
||||||
my $gitTag = `git describe --always $revision`; chomp $gitTag;
|
my $gitTag = `git describe --always $revision`; chomp $gitTag;
|
||||||
die "git describe failed" if $? != 0;
|
die "git describe failed" if $? != 0;
|
||||||
|
my $shortRev = `git rev-parse --short $revision`; chomp $shortRev;
|
||||||
|
die "git rev-parse failed" if $? != 0;
|
||||||
|
|
||||||
return
|
return
|
||||||
{ uri => $uri
|
{ uri => $uri
|
||||||
|
@ -415,6 +418,7 @@ sub fetchInputGit {
|
||||||
, revision => $revision
|
, revision => $revision
|
||||||
, revCount => int($revCount)
|
, revCount => int($revCount)
|
||||||
, gitTag => $gitTag
|
, gitTag => $gitTag
|
||||||
|
, shortRev => $shortRev
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,6 +638,7 @@ sub inputsToArgs {
|
||||||
(defined $alt->{revision} ? "; rev = \"" . $alt->{revision} . "\"" : "") .
|
(defined $alt->{revision} ? "; rev = \"" . $alt->{revision} . "\"" : "") .
|
||||||
(defined $alt->{revCount} ? "; revCount = " . $alt->{revCount} . "" : "") .
|
(defined $alt->{revCount} ? "; revCount = " . $alt->{revCount} . "" : "") .
|
||||||
(defined $alt->{gitTag} ? "; gitTag = \"" . $alt->{gitTag} . "\"" : "") .
|
(defined $alt->{gitTag} ? "; gitTag = \"" . $alt->{gitTag} . "\"" : "") .
|
||||||
|
(defined $alt->{shortRev} ? "; shortRev = \"" . $alt->{shortRev} . "\"" : "") .
|
||||||
(defined $alt->{version} ? "; version = \"" . $alt->{version} . "\"" : "") .
|
(defined $alt->{version} ? "; version = \"" . $alt->{version} . "\"" : "") .
|
||||||
";}"
|
";}"
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue