Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-svn: make it play nicely with submodules
author
Ramkumar Ramachandra
<artagnon@gmail.com>
Sat, 10 Jan 2015 14:55:11 +0000
(09:55 -0500)
committer
Eric Wong
<normalperson@yhbt.net>
Thu, 15 Jan 2015 08:35:55 +0000
(08:35 +0000)
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>
git-svn.perl
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
9a2bb05
)
diff --git
a/git-svn.perl
b/git-svn.perl
index 60f8814cc52fdfea17be989228a56a951cc0e867..32d109ebdf89399ac0d834cc98393324dfca7850 100755
(executable)
--- a/
git-svn.perl
+++ b/
git-svn.perl
@@
-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 {