From: Eric Wong Date: Mon, 18 Jan 2016 07:29:04 +0000 (+0000) Subject: repobrowse: use symbolic-ref instead of ugly rev-parse match X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b89e53a37e14f5f659c94f8c880e2cf4b7efe1b4;p=thirdparty%2Fpublic-inbox.git repobrowse: use symbolic-ref instead of ugly rev-parse match Oops, forgot about this old command :x --- diff --git a/lib/PublicInbox/RepobrowseGitSummary.pm b/lib/PublicInbox/RepobrowseGitSummary.pm index db601ad98..0dffd5cc7 100644 --- a/lib/PublicInbox/RepobrowseGitSummary.pm +++ b/lib/PublicInbox/RepobrowseGitSummary.pm @@ -29,7 +29,7 @@ sub emit_summary { # n.b. we would use %(HEAD) in for-each-ref --format if we could # rely on git 1.9.0+, but it's too soon for that in early 2016... - chomp(my $head_ref = $git->qx(qw(rev-parse HEAD~0))); + chomp(my $head_ref = $git->qx(qw(symbolic-ref HEAD))); my $refs = $git->popen(qw(for-each-ref --sort=-creatordate), EACH_REF_FMT, "--count=$count", @@ -43,6 +43,7 @@ sub emit_summary { my $rel = $req->{relcmd}; foreach (<$refs>) { my ($ref, $type, $hex, $date, $s) = split(' ', $_, 5); + my $x = $ref eq $head_ref ? ' (HEAD)' : ''; $ref =~ s!\Arefs/(?:heads|tags)/!!; $ref = PublicInbox::Hval->utf8($ref); my $h = $ref->as_html; @@ -60,7 +61,6 @@ sub emit_summary { next; } chomp $s; - my $x = $hex eq $head_ref ? ' (HEAD)' : ''; $fh->write(qq($h$x) . qq($date ) . utf8_html($s) . '');