Merge branch 'jc/send-email-sensible-encoding'
[gitweb.git] / git-svn.perl
index 60f8814cc52fdfea17be989228a56a951cc0e867..32d109ebdf89399ac0d834cc98393324dfca7850 100755 (executable)
@@ -337,6 +337,12 @@ sub term_init {
 # 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 {