]> Sergey Matveev's repositories - public-inbox.git/commit
git: shorten --git-dir= in CLI with chdir in spawn
authorEric Wong <e@80x24.org>
Wed, 29 Sep 2021 21:25:20 +0000 (21:25 +0000)
committerEric Wong <e@80x24.org>
Wed, 29 Sep 2021 21:37:46 +0000 (21:37 +0000)
commit56ab6cba3ee89fdf47aa4e088d3c8a2d0bdab8d7
treeb66c91757d62abee75a70f2cdf2c03bd85aea913
parentf7e29ec64a0cbba63c4df244e916848f75bc9346
git: shorten --git-dir= in CLI with chdir in spawn

Long pathnames are difficult to read and distinguish in ps(1)
output.  Deep paths can also slow down pathname resolution
when dealing with loose objects, so we put "cat-file --batch"
deeper into the directory tree.

Since v2 processes are in the form of $INBOXDIR/all.git, keep
the basename of $INBOXDIR in --git-dir= so it's easy to
distinguish between processes just by looking at ps(1).

While "git -C" also exists, it's only present in git 1.8.5+.
We also need to keep in mind the "directory" pointed to by
--git-dir= need not be a directory (nor a symlink pointing
to one).

This reduces pathname resolution overhead for v1 and v2 inbox
git processes, but unfortunately not for extindex since that
needs to store alternates as absolute paths.
lib/PublicInbox/Git.pm