Skip to content

Commit

Permalink
git-svn: make it play nicely with submodules
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ramkumar Ramachandra authored and Eric Wong committed Jan 15, 2015
1 parent 9a2bb05 commit a94655d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a94655d

Please sign in to comment.