* Fix diff page empty when revision is first commit.

This commit is contained in:
zhaoke
2023-08-23 11:14:44 +08:00
parent 9fcd721315
commit 6ebd99717b
+3 -1
View File
@@ -310,7 +310,9 @@ class GitRepo
if(strpos($fromRevision, '^') !== false)
{
$list = execCmd(escapeCmd("$this->client log -2 $toRevision --pretty=format:%H -- $path"), 'array');
if(isset($list[1])) $fromRevision = $list[1];
if(!isset($list[1])) return execCmd(escapeCmd("$this->client show HEAD"), 'array');
$fromRevision = $list[1];
}
$lines = execCmd(escapeCmd("$this->client diff $fromRevision $toRevision -- $path"), 'array');
return $lines;