]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: fix commitdiff for root commits
authorJakub Narebski <redacted>
Sun, 6 Aug 2006 14:14:25 +0000 (16:14 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:05:47 +0000 (00:05 -0400)
After changing all "-|" open invocations to list form, commitdiff for
initial commit (without parent) got broken; it returned incorrectly
empty patch earlier.  Use '--root' option to git-diff-tree for initial
(root) commit.

No checking for empty $hash_parent in git_commitdiff_plain -- we rely
on gitweb to give correct parameters for commitdiff_plain action.

Noticed by Matthias Lederhofer (matled).

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index da3cb0b0420246c1f35869eaff6f7f585756cef4a8f631e5fe909cdec96936f9..b226166b5a9cfacaa2068b4b6f74367aa01b5e0617ce9d0b2f8b95d5e3fee893 100755 (executable)
@@ -2109,7 +2109,7 @@ sub git_commitdiff {
                die_error(undef, "Unknown commit object");
        }
        if (!defined $hash_parent) {
-               $hash_parent = $co{'parent'};
+               $hash_parent = $co{'parent'} || '--root';
        }
        open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
                or die_error(undef, "Open git-diff-tree failed");
This page took 0.347535 seconds and 4 git commands to generate.