For rare cases where we rely on `-c' to override temporary
options, we also chdir(2) to `/' to avoid hitting a users'
$worktree/.git/config. Thus, the config file must be given as
as an absolute path. While the majority of or code assumes
absolute paths are used for config files, it's possible we end
up on some strange setups where $ENV{HOME} is a relative path.
my %env;
my $opt = { 2 => $lei->{2} // 2 };
if (@opt_c) {
- unshift(@opt_c, '-c', "include.path=$file") if defined($file);
+ if (defined $file) {
+ $file = rel2abs_collapsed($file); # for $opt->{-C}
+ unshift @opt_c, '-c', "include.path=$file";
+ }
tmp_cmd_opt(\%env, $opt);
}
my @cmd = (git_exe, @opt_c, qw(config -z -l --includes));