1
0
mirror of https://github.com/git/git.git synced 2024-09-28 03:00:25 +02:00

git-svn: make it play nicely with submodules

It's a simple matter of opening the directory specified in the gitfile.

[ew: tweaked check to avoid open() on directories]

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
Ramkumar Ramachandra 2015-01-10 09:55:11 -05:00 committed by Eric Wong
parent 9a2bb059e7
commit a94655dcfe

View File

@ -337,6 +337,12 @@ for (my $i = 0; $i < @ARGV; $i++) {
# make sure we're always running at the top-level working directory
if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {
$ENV{GIT_DIR} ||= ".git";
# catch the submodule case
if (-f $ENV{GIT_DIR}) {
open(my $fh, '<', $ENV{GIT_DIR}) or
die "failed to open $ENV{GIT_DIR}: $!\n";
$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;
}
} else {
my ($git_dir, $cdup);
git_cmd_try {