Skip to content

Commit fe53bbc

Browse files
flichtenheldgitster
authored andcommitted
Git.pm: Always set Repository to absolute path if autodetecting
So far we only set it to absolute paths in some cases which lead to problems like wc_chdir not working. Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Petr Baudis <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent da159c7 commit fe53bbc

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

perl/Git.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ sub repository {
185185

186186
if ($dir) {
187187
$dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
188-
$opts{Repository} = $dir;
188+
$opts{Repository} = abs_path($dir);
189189

190190
# If --git-dir went ok, this shouldn't die either.
191191
my $prefix = $search->command_oneline('rev-parse', '--show-prefix');

t/t9700/test.pl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,12 @@
8686
unlink $tmpfile;
8787

8888
# paths
89-
is($r->repo_path, "./.git", "repo_path");
89+
is($r->repo_path, $abs_repo_dir . "/.git", "repo_path");
9090
is($r->wc_path, $abs_repo_dir . "/", "wc_path");
9191
is($r->wc_subdir, "", "wc_subdir initial");
9292
$r->wc_chdir("directory1");
9393
is($r->wc_subdir, "directory1", "wc_subdir after wc_chdir");
94-
TODO: {
95-
local $TODO = "commands do not work after wc_chdir";
96-
# Failure output is active even in non-verbose mode and thus
97-
# annoying. Hence we skip these tests as long as they fail.
98-
todo_skip 'config after wc_chdir', 1;
99-
is($r->config("color.string"), "value", "config after wc_chdir");
100-
}
94+
is($r->config("test.string"), "value", "config after wc_chdir");
10195

10296
# Object generation in sub directory
10397
chdir("directory2");

0 commit comments

Comments
 (0)