Skip to content

Commit a94655d

Browse files
artagnonEric Wong
authored andcommitted
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 <[email protected]> Signed-off-by: Eric Wong <[email protected]>
1 parent 9a2bb05 commit a94655d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

git-svn.perl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ sub term_init {
337337
# make sure we're always running at the top-level working directory
338338
if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {
339339
$ENV{GIT_DIR} ||= ".git";
340+
# catch the submodule case
341+
if (-f $ENV{GIT_DIR}) {
342+
open(my $fh, '<', $ENV{GIT_DIR}) or
343+
die "failed to open $ENV{GIT_DIR}: $!\n";
344+
$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;
345+
}
340346
} else {
341347
my ($git_dir, $cdup);
342348
git_cmd_try {

0 commit comments

Comments
 (0)