]> git.ipfire.org Git - thirdparty/git.git/commit
Git.pm: use "rev-parse --absolute-git-dir" rather than perl code
authorJeff King <peff@peff.net>
Thu, 12 Sep 2024 22:37:25 +0000 (18:37 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Sep 2024 17:42:22 +0000 (10:42 -0700)
commitd3edb0bddec29c97fb0314d9b1ee77d2e7d22382
treef8534fdc60eb0a76e192908a816a443bff1d0e74
parente4b353d0a138f946b2321efa7ba9094cf747dd34
Git.pm: use "rev-parse --absolute-git-dir" rather than perl code

When we open a repository with the "Directory" option, we use "rev-parse
--git-dir" to get the path relative to that directory, and then use
Cwd::abs_path() to make it absolute (since our process working directory
may not be the same).

These days we can just ask for "--absolute-git-dir" instead, which saves
us a little code. That option was added in Git v2.13.0 via a2f5a87626
(rev-parse: add '--absolute-git-dir' option, 2017-02-03). I don't think
we make any promises about running mismatched versions of git and
Git.pm, but even if somebody tries it, that's sufficiently old that it
should be OK.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
perl/Git.pm