summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2015-01-10 14:55:11 (GMT)
committerEric Wong <normalperson@yhbt.net>2015-01-15 08:35:55 (GMT)
commita94655dcfedc6b266ba32a3d32b0d52a1ce6a928 (patch)
treeaf148a7688eaab3a22e871ad5519de50addc0971 /git-svn.perl
parent9a2bb059e76b1368392f86ecf7af2ba188e3cac5 (diff)
downloadgit-a94655dcfedc6b266ba32a3d32b0d52a1ce6a928.zip
git-a94655dcfedc6b266ba32a3d32b0d52a1ce6a928.tar.gz
git-a94655dcfedc6b266ba32a3d32b0d52a1ce6a928.tar.bz2
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>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl6
1 files changed, 6 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 60f8814..32d109e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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 {