Skip to content

Commit

Permalink
Git.pm: Always set Repository to absolute path if autodetecting
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
flichtenheld authored and gitster committed May 9, 2009
1 parent da159c7 commit fe53bbc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion perl/Git.pm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ sub repository {

if ($dir) {
$dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
$opts{Repository} = $dir;
$opts{Repository} = abs_path($dir);

# If --git-dir went ok, this shouldn't die either.
my $prefix = $search->command_oneline('rev-parse', '--show-prefix');
Expand Down
10 changes: 2 additions & 8 deletions t/t9700/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,12 @@
unlink $tmpfile;

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

# Object generation in sub directory
chdir("directory2");
Expand Down

0 comments on commit fe53bbc

Please sign in to comment.