From c3288fb27efcca73ba87e27c2c2b41b4a1dfbd46 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 26 Jan 2017 04:27:02 +0000 Subject: repobrowse: simplify command generation for git commands This shortens the code quite a bit at a negligible performance cost, and the diffstat agrees. --- lib/PublicInbox/RepobrowseGitLog.pm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'lib/PublicInbox/RepobrowseGitLog.pm') diff --git a/lib/PublicInbox/RepobrowseGitLog.pm b/lib/PublicInbox/RepobrowseGitLog.pm index 21c23fd3..85593cb8 100644 --- a/lib/PublicInbox/RepobrowseGitLog.pm +++ b/lib/PublicInbox/RepobrowseGitLog.pm @@ -130,15 +130,8 @@ sub call_git_log { my $h = $q->{h}; $h eq '' and $h = 'HEAD'; my $git = $repo_info->{git}; - my $git_dir = $git->{git_dir}; - - # n.b. no need to escape $h, this -debug line will never - # be seen if $h is invalid - # XXX but we should probably validate refnames before execve... - $req->{-debug} = "git log --git-dir=$git_dir $h --"; - my $cmd = [ 'git', "--git-dir=$git_dir", - qw(log --no-notes --no-color --abbrev-commit), - $git->abbrev, $LOG_FMT, "-$max", $h, '--' ]; + my $cmd = $git->cmd(qw(log --no-notes --no-color --abbrev-commit), + $git->abbrev, $LOG_FMT, "-$max", $h, '--'); my $rdr = { 2 => $git->err_begin }; my $title = "log: $repo_info->{repo} (" . utf8_html($h). ')'; $req->{lhtml} = $self->html_start($req, $title) . "\n\n"; -- cgit v1.2.3-24-ge0c7