git-svn: multi-init saves and reuses --tags and --branches arguments
This should make it much easier to track newly added tags and branches. Re-running multi-init without command-line arguments should now detect new-tags and branches. --trunk shouldn't change often, but running multi-init on it is now idempotent. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric Wong committed
Oct 11, 2006 at 11:53 UTC
c35b96e7851e417a24c1e255e353c67b31955466
1 file changed
+14
-4
git-svn.perl
+14
-4
@@ -682,12 +682,17 @@ sub multi_init {
682
}
683
$_trunk = $url . $_trunk;
684
}
685
+ my $ch_id;
686
if ($GIT_SVN eq 'git-svn') {
686
- print "GIT_SVN_ID set to 'trunk' for $_trunk\n";
687
+ $ch_id = 1;
688
$GIT_SVN = $ENV{GIT_SVN_ID} = 'trunk';
689
}
690
init_vars();
690
- init($_trunk);
691
+ unless (-d $GIT_SVN_DIR) {
692
+ print "GIT_SVN_ID set to 'trunk' for $_trunk\n" if $ch_id;
693
+ init($_trunk);
694
+ sys('git-repo-config', 'svn.trunk', $_trunk);
695
+ }
696
complete_url_ls_init($url, $_branches, '--branches/-b', '');
697
complete_url_ls_init($url, $_tags, '--tags/-t', 'tags/');
698
}
@@ -937,16 +942,21 @@ sub complete_url_ls_init {
942
print STDERR "W: Unrecognized URL: $u\n";
943
die "This should never happen\n";
944
}
945
+ # don't try to init already existing refs
946
my $id = $pfx.$1;
941
- print "init $u => $id\n";
947
$GIT_SVN = $ENV{GIT_SVN_ID} = $id;
948
init_vars();
944
- init($u);
949
+ unless (-d $GIT_SVN_DIR) {
950
+ print "init $u => $id\n";
951
+ init($u);
952
+ }
953
}
954
exit 0;
955
}
956
waitpid $pid, 0;
957
croak $? if $?;
958
+ my ($n) = ($switch =~ /^--(\w+)/);
959
+ sys('git-repo-config', "svn.$n", $var);
960
}
961
962
sub common_prefix {