diff options
author | Eric Wong <e@80x24.org> | 2016-01-16 03:21:06 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-04-05 18:58:27 +0000 |
commit | 8ceeea662e01a65951d5d07fc9993087242d6206 (patch) | |
tree | bdada3bd8391ee5f43bb3a99fca30a9031b537a7 /lib | |
parent | ff5d4363edb4fd30830826742acfc3f1c9fa5864 (diff) | |
download | public-inbox-8ceeea662e01a65951d5d07fc9993087242d6206.tar.gz |
We will use core.abbrev=12 by default if unset, as the git default of 7 is too low for long-term usability of links. Some of our callers used 16, which was probably excessive.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Feed.pm | 2 | ||||
-rw-r--r-- | lib/PublicInbox/Git.pm | 5 | ||||
-rw-r--r-- | lib/PublicInbox/RepobrowseGitCommit.pm | 4 | ||||
-rw-r--r-- | lib/PublicInbox/RepobrowseGitLog.pm | 2 | ||||
-rw-r--r-- | lib/PublicInbox/RepobrowseGitPlain.pm | 2 | ||||
-rw-r--r-- | lib/PublicInbox/RepobrowseGitTree.pm | 2 |
6 files changed, 11 insertions, 6 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 54fa6e5d..d014434f 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -216,7 +216,7 @@ sub each_recent_blob { # 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 diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index ac556426..23a3e6c7 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -13,6 +13,11 @@ use POSIX qw(dup2); 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 diff --git a/lib/PublicInbox/RepobrowseGitCommit.pm b/lib/PublicInbox/RepobrowseGitCommit.pm index 5c8407b2..64d0b607 100644 --- a/lib/PublicInbox/RepobrowseGitCommit.pm +++ b/lib/PublicInbox/RepobrowseGitCommit.pm @@ -122,8 +122,8 @@ sub call_git_commit { 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 diff --git a/lib/PublicInbox/RepobrowseGitLog.pm b/lib/PublicInbox/RepobrowseGitLog.pm index 36664171..197d2cb1 100644 --- a/lib/PublicInbox/RepobrowseGitLog.pm +++ b/lib/PublicInbox/RepobrowseGitLog.pm @@ -25,7 +25,7 @@ sub call_git_log { 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']]); diff --git a/lib/PublicInbox/RepobrowseGitPlain.pm b/lib/PublicInbox/RepobrowseGitPlain.pm index 89788a10..01919895 100644 --- a/lib/PublicInbox/RepobrowseGitPlain.pm +++ b/lib/PublicInbox/RepobrowseGitPlain.pm @@ -57,7 +57,7 @@ sub git_tree_plain { $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']]); diff --git a/lib/PublicInbox/RepobrowseGitTree.pm b/lib/PublicInbox/RepobrowseGitTree.pm index e8012dde..7c5ae60d 100644 --- a/lib/PublicInbox/RepobrowseGitTree.pm +++ b/lib/PublicInbox/RepobrowseGitTree.pm @@ -141,7 +141,7 @@ sub git_blob_show { 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"); |