Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-svn: allow a local target directory to be specified for init
author
Eric Wong
<normalperson@yhbt.net>
Sat, 1 Jul 2006 04:42:53 +0000
(21:42 -0700)
committer
Junio C Hamano
<junkio@cox.net>
Sat, 1 Jul 2006 05:50:47 +0000
(22:50 -0700)
git-svn init url://to/the/repo local-repo
will create the local-repo dirrectory if doesn't exist yet and
populate it as expected.
Original patch by Luca Barbato, cleaned up and made to work for
the current version of git-svn by me (Eric Wong).
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/git-svn/git-svn.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
560b25a
)
diff --git
a/contrib/git-svn/git-svn.perl
b/contrib/git-svn/git-svn.perl
index b3d3f479da727241034001491ad0e9b3b999335a..1e19aa19b2930aa21008e5547858a821de666c67 100755
(executable)
--- a/
contrib/git-svn/git-svn.perl
+++ b/
contrib/git-svn/git-svn.perl
@@
-264,9
+264,19
@@
sub rebuild {
}
sub init {
}
sub init {
-
$SVN_URL
= shift or die "SVN repository location required " .
+
my $url
= shift or die "SVN repository location required " .
"as a command-line argument\n";
"as a command-line argument\n";
- $SVN_URL =~ s!/+$!!; # strip trailing slash
+ $url =~ s!/+$!!; # strip trailing slash
+
+ if (my $repo_path = shift) {
+ unless (-d $repo_path) {
+ mkpath([$repo_path]);
+ }
+ $GIT_DIR = $ENV{GIT_DIR} = $repo_path . "/.git";
+ init_vars();
+ }
+
+ $SVN_URL = $url;
unless (-d $GIT_DIR) {
my @init_db = ('git-init-db');
push @init_db, "--template=$_template" if defined $_template;
unless (-d $GIT_DIR) {
my @init_db = ('git-init-db');
push @init_db, "--template=$_template" if defined $_template;