# leave us with filenames with spaces in them..
my $git = $ctx->{git} ||= PublicInbox::Git->new($ctx->{git_dir});
my $log = $git->popen(qw/log --no-notes --no-color --raw -r
- --abbrev=16 --abbrev-commit/,
+ --abbrev-commit/, $git->abbrev,
"--format=%h%x00%ct%x00%an%x00%s%x00",
$range);
my %deleted; # only an optimization at this point
require IO::Handle;
use PublicInbox::Spawn qw(spawn popen_rd);
+# Documentation/SubmittingPatches recommends 12 (Linux v4.4)
+my $abbrev = `git config core.abbrev` || 12;
+
+sub abbrev { "--abbrev=$abbrev" }
+
sub new {
my ($class, $git_dir) = @_;
bless { git_dir => $git_dir }, $class
my $id = $q->{id};
$id eq '' and $id = 'HEAD';
my $git = $req->{repo_info}->{git};
- my @cmd = qw(show -z --numstat -p --encoding=UTF-8
- --no-notes --no-color --abbrev=10 -c);
+ my @cmd = (qw(show -z --numstat -p --encoding=UTF-8
+ --no-notes --no-color -c), $git->abbrev);
my @path;
# kill trailing slash
my $git = $repo_info->{git};
my $log = $git->popen(qw(log --no-notes --no-color --abbrev-commit),
- $LOG_FMT, "-$max", $h, '--');
+ $git->abbrev, $LOG_FMT, "-$max", $h, '--');
sub {
my ($res) = @_; # Plack callback
my $fh = $res->([200, ['Content-Type'=>'text/html']]);
$pfx = "$last/";
}
}
- my $ls = $git->popen(qw(ls-tree --name-only -z --abbrev=12), $hex);
+ my $ls = $git->popen(qw(ls-tree --name-only -z), $git->abbrev, $hex);
sub {
my ($res) = @_;
my $fh = $res->([ 200, ['Content-Type' => 'text/html']]);
sub git_tree_show {
my ($req, $fh, $git, $hex, $q) = @_;
$fh->write('<pre>');
- my $ls = $git->popen(qw(ls-tree --abbrev=16 -l -z), $hex);
+ my $ls = $git->popen(qw(ls-tree -l -z), $git->abbrev, $hex);
my $t = cur_path($req, $q);
my $pfx;
$fh->write("path: $t\n\n");