Eric Wong <> writes:

> `git rev-parse --show-cdup` outputs nothing if GIT_DIR is set,
> so I unset GIT_DIR temporarily.
> I'm not sure why --show-cdup behaves like this, though..

Setting GIT_DIR is to say "That is the directory that has the
repository objects and refs; I am letting you know the location
explicitly because it does not have any relation with the location
of the working tree.  The $(cwd) is at the root of the working

If you want to say "That is the directory that has metainformation,
and that other one is the root of the working tree", you use
GIT_WORK_TREE to name the latter.

So by definition, if you only set GIT_DIR without setting
GIT_WORK_TREE, show-cdup must say "you are already at the top".

> Does squashing this on top of your changes fix all your failures?
> I plan on squashing both your changes together with the below:
> diff --git a/git-svn.perl b/git-svn.perl
> index c232798..e5bd292 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -332,11 +332,13 @@ if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {
>               $ENV{GIT_DIR} = command_oneline([qw/rev-parse --git-dir/]);
>       } "Unable to find .git directory\n";
>       my $cdup = undef;
> +     my $git_dir = delete $ENV{GIT_DIR};
>       git_cmd_try {
>               $cdup = command_oneline(qw/rev-parse --show-cdup/);
>               chomp $cdup if ($cdup);
>               $cdup = "." unless ($cdup && length $cdup);
> -     } "Already at toplevel, but $ENV{GIT_DIR} not found\n";
> +     } "Already at toplevel, but $git_dir not found\n";
> +     $ENV{GIT_DIR} = $git_dir;
>       chdir $cdup or die "Unable to chdir up to '$cdup'\n";
>       $_repository = Git->repository(Repository => $ENV{GIT_DIR});
>  }
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to