summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Eric Wong <normalperson@yhbt.net>2006-03-03 01:20:09 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-03-03 11:27:29 -0800
commit6f0783cf9473feaaadf2ebc59167f84f0b1172bd (patch)
tree5da75296af4d915bdb71254fd77ddfd038c3b85e
parentcontrib/git-svn: avoid re-reading the repository uuid, it never changes (diff)
downloadtgif-6f0783cf9473feaaadf2ebc59167f84f0b1172bd.tar.xz
contrib/git-svn: add --id/-i=$GIT_SVN_ID command-line switch
I ended up using GIT_SVN_ID far more than I ever thought I would. Typing less is good. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xcontrib/git-svn/git-svn.perl19
1 files changed, 11 insertions, 8 deletions
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 041791b3ce..db199a3648 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -10,13 +10,6 @@ use vars qw/ $AUTHOR $VERSION
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
$VERSION = '0.10.0';
$GIT_DIR = $ENV{GIT_DIR} || "$ENV{PWD}/.git";
-$GIT_SVN = $ENV{GIT_SVN_ID} || 'git-svn';
-$GIT_SVN_INDEX = "$GIT_DIR/$GIT_SVN/index";
-$ENV{GIT_DIR} ||= $GIT_DIR;
-$SVN_URL = undef;
-$REV_DIR = "$GIT_DIR/$GIT_SVN/revs";
-$SVN_WC = "$GIT_DIR/$GIT_SVN/tree";
-
# make sure the svn binary gives consistent output between locales and TZs:
$ENV{TZ} = 'UTC';
$ENV{LC_ALL} = 'C';
@@ -78,7 +71,17 @@ foreach (keys %cmd) {
my %opts;
%opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
-GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version ) or exit 1;
+GetOptions(%opts, 'help|H|h' => \$_help,
+ 'version|V' => \$_version,
+ 'id|i=s' => \$GIT_SVN) or exit 1;
+
+$GIT_SVN ||= $ENV{GIT_SVN_ID} || 'git-svn';
+$GIT_SVN_INDEX = "$GIT_DIR/$GIT_SVN/index";
+$ENV{GIT_DIR} ||= $GIT_DIR;
+$SVN_URL = undef;
+$REV_DIR = "$GIT_DIR/$GIT_SVN/revs";
+$SVN_WC = "$GIT_DIR/$GIT_SVN/tree";
+
usage(0) if $_help;
version() if $_version;
usage(1) unless defined $cmd;