mirror of
https://github.com/git/git.git
synced 2024-11-01 23:07:55 +01:00
fix: Use of uninitialized value
The subroutine did not check the case where HEAD does not verify. Patch from Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
f76ddc2015
commit
2c5c008b46
1 changed files with 5 additions and 4 deletions
|
@ -404,12 +404,13 @@ sub git_read_head {
|
||||||
if (open my $fd, "-|", "$gitbin/git-rev-parse", "--verify", "HEAD") {
|
if (open my $fd, "-|", "$gitbin/git-rev-parse", "--verify", "HEAD") {
|
||||||
my $head = <$fd>;
|
my $head = <$fd>;
|
||||||
close $fd;
|
close $fd;
|
||||||
chomp $head;
|
if (defined $head && $head =~ /^([0-9a-fA-F]{40})$/) {
|
||||||
if ($head =~ m/^[0-9a-fA-F]{40}$/) {
|
$retval = $1;
|
||||||
$retval = $head;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ENV{'GIT_DIR'} = $oENV;
|
if (defined $oENV) {
|
||||||
|
$ENV{'GIT_DIR'} = $oENV;
|
||||||
|
}
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue