{"thread":{"id":"1200","subject":"[PATCH] git-cvsimport-script: add \"import only\" option","startedAt":"2005-07-11T14:57:49Z","lastAt":"2005-07-11T14:57:49Z","messageCount":1,"participants":["Sven Verdoolaege"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"5955","messageId":"20050711145749.GF9370MdfPADPa@garage.linux.student.kuleuven.ac.be","threadId":"1200","inReplyTo":null,"subject":"[PATCH] git-cvsimport-script: add \"import only\" option","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2005-07-11T14:57:49Z","receivedAt":"2005-07-11T14:57:49Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"git-cvsimport-script: add \"import only\" option.\n\nAcked-by: Matthias Urlichs <smurf@smurf.noris.de>\nSigned-off-by: Sven Verdoolaege <skimo@kotnet.org>\n\n---\ncommit 1be6fbebb010083a083d8e2ee69fced7b6ae1261\ntree a69017b2d10fd0a2655070d177f7cf59ab21882f\nparent a3eb250f996bf5e12376ec88622c4ccaabf20ea8\nauthor Sven Verdoolaege <skimo@kotnet.org> Mon, 11 Jul 2005 16:17:25 +0200\ncommitter Sven Verdoolaege <skimo@kotnet.org> Mon, 11 Jul 2005 16:17:25 +0200\n\n Documentation/git-cvsimport-script.txt |    7 ++++++-\n git-cvsimport-script                   |   18 +++++++++++-------\n 2 files changed, 17 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/git-cvsimport-script.txt b/Documentation/git-cvsimport-script.txt\n--- a/Documentation/git-cvsimport-script.txt\n+++ b/Documentation/git-cvsimport-script.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n --------\n 'git-cvsimport-script' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]\n \t\t\t[ -d <CVSROOT> ] [ -p <options-for-cvsps> ]\n-\t\t\t[ -C <GIT_repository> ] [ <CVS_module> ]\n+\t\t\t[ -C <GIT_repository> ] [ -i ] [ <CVS_module> ]\n \n \n DESCRIPTION\n@@ -29,6 +29,11 @@ OPTIONS\n \tcurrently, only the :local:, :ext: and :pserver: access methods \n \tare supported.\n \n+-i::\n+\tImport-only: don't perform a checkout after importing.  This option\n+\tensures the working directory and cache remain untouched and will\n+\tnot create them if they do not exist.\n+\n -o <branch-for-HEAD>::\n \tThe 'HEAD' branch from CVS is imported to the 'origin' branch within\n \tthe git repository, as 'HEAD' already has a special meaning for git.\ndiff --git a/git-cvsimport-script b/git-cvsimport-script\n--- a/git-cvsimport-script\n+++ b/git-cvsimport-script\n@@ -28,19 +28,19 @@ use POSIX qw(strftime dup2);\n $SIG{'PIPE'}=\"IGNORE\";\n $ENV{'TZ'}=\"UTC\";\n \n-our($opt_h,$opt_o,$opt_v,$opt_d,$opt_p,$opt_C,$opt_z);\n+our($opt_h,$opt_o,$opt_v,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i);\n \n sub usage() {\n \tprint STDERR <<END;\n Usage: ${\\basename $0}     # fetch/update GIT from CVS\n        [ -o branch-for-HEAD ] [ -h ] [ -v ] [ -d CVSROOT ]\n        [ -p opts-for-cvsps ] [ -C GIT_repository ] [ -z fuzz ]\n-       [ CVS_module ]\n+       [ -i ] [ CVS_module ]\n END\n \texit(1);\n }\n \n-getopts(\"hvo:d:p:C:z:\") or usage();\n+getopts(\"hivo:d:p:C:z:\") or usage();\n usage if $opt_h;\n \n @ARGV <= 1 or usage();\n@@ -723,8 +723,10 @@ if($orig_branch) {\n \tprint \"DONE\\n\" if $opt_v;\n \tsystem(\"cp\",\"$git_dir/refs/heads/$opt_o\",\"$git_dir/refs/heads/master\")\n \t\tif $forward_master;\n-\tsystem('git-read-tree', '-m', '-u', 'CVS2GIT_HEAD', 'HEAD');\n-\tdie \"read-tree failed: $?\\n\" if $?;\n+\tunless ($opt_i) {\n+\t\tsystem('git-read-tree', '-m', '-u', 'CVS2GIT_HEAD', 'HEAD');\n+\t\tdie \"read-tree failed: $?\\n\" if $?;\n+\t}\n } else {\n \t$orig_branch = \"master\";\n \tprint \"DONE; creating $orig_branch branch\\n\" if $opt_v;\n@@ -732,7 +734,9 @@ if($orig_branch) {\n \t\tunless -f \"$git_dir/refs/heads/master\";\n \tunlink(\"$git_dir/HEAD\");\n \tsymlink(\"refs/heads/$orig_branch\",\"$git_dir/HEAD\");\n-\tsystem('git checkout');\n-\tdie \"checkout failed: $?\\n\" if $?;\n+\tunless ($opt_i) {\n+\t\tsystem('git checkout');\n+\t\tdie \"checkout failed: $?\\n\" if $?;\n+\t}\n }\n unlink(\"$git_dir/CVS2GIT_HEAD\");\n"}]}