{"thread":{"id":"1521","subject":"[PATCH] Add -k kill keyword expansion option to git-cvsimport - revised","startedAt":"2005-08-15T11:32:36Z","lastAt":"2005-08-15T11:32:36Z","messageCount":1,"participants":["Martin Langhoff"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7298","messageId":"46a038f905081504327a8bfb38@mail.gmail.com","threadId":"1521","inReplyTo":"20050815113123.BDEA03300AD@ng.eduforge.org","subject":"[PATCH] Add -k kill keyword expansion option to git-cvsimport - revised","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2005-08-15T11:32:36Z","receivedAt":"2005-08-15T11:32:36Z","isPatch":true,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"[PATCH] Add -k kill keyword expansion option to git-cvsimport - revised\n\nEarly versions of git-cvsimport defaulted to using preexisting keyword\nexpansion settings. This change preserves compatibility with existing cvs\nimports and allows new repository migrations to kill keyword expansion.\n\nAfter exploration of the different -k modes in the cvs protocol, we use -kk\nwhich kills keyword expansion wherever possible. Against the protocol\nspec, -ko and -kb will sometimes expand keywords.\n\nShould improve our chances of detecting merges and reduce imported\nrepository size.\n\nSigned-off: Martin Langhoff <martin.langhoff@gmail.com>\n---\n\n Documentation/git-cvsimport-script.txt |    7 ++++++-\n git-cvsimport-script                   |   12 +++++++-----\n 2 files changed, 13 insertions(+), 6 deletions(-)\n\nb30d52a3327183d371416661fc2c7d168791b3bd\ndiff --git a/Documentation/git-cvsimport-script.txt\nb/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                        [ -d <CVSROOT> ] [ -p <options-for-cvsps> ]\n-                       [ -C <GIT_repository> ] [ -i ] [ <CVS_module> ]\n+                       [ -C <GIT_repository> ] [ -i ] [ -k ] [ <CVS_module> ]\n\n\n DESCRIPTION\n@@ -34,6 +34,11 @@ OPTIONS\n        ensures the working directory and cache remain untouched and will\n        not create them if they do not exist.\n\n+-k::\n+       Kill keywords: will extract files with -kk from the CVS archive\n+       to avoid noisy changesets. Highly recommended, but off by default\n+       to preserve compatibility with early imported trees.\n+\n -o <branch-for-HEAD>::\n        The 'HEAD' branch from CVS is imported to the 'origin' branch within\n        the 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,$opt_i);\n+our($opt_h,$opt_o,$opt_v,$opt_k,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i);\n\n sub usage() {\n        print 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-       [ -i ] [ CVS_module ]\n+       [ -i ] [ -k ] [ CVS_module ]\n END\n        exit(1);\n }\n\n-getopts(\"hivo:d:p:C:z:\") or usage();\n+getopts(\"hivko:d:p:C:z:\") or usage();\n usage if $opt_h;\n\n @ARGV <= 1 or usage();\n@@ -218,8 +218,10 @@ sub _file {\n        my($self,$fn,$rev) = @_;\n        $self->{'socketo'}->write(\"Argument -N\\n\") or return undef;\n        $self->{'socketo'}->write(\"Argument -P\\n\") or return undef;\n-       # $self->{'socketo'}->write(\"Argument -ko\\n\") or return undef;\n-       # -ko: Linus' version doesn't use it\n+       # -kk: Linus' version doesn't use it - defaults to off\n+       if ($opt_k) {\n+           $self->{'socketo'}->write(\"Argument -kk\\n\") or return undef;\n+       }\n        $self->{'socketo'}->write(\"Argument -r\\n\") or return undef;\n        $self->{'socketo'}->write(\"Argument $rev\\n\") or return undef;\n        $self->{'socketo'}->write(\"Argument --\\n\") or return undef;\n"}]}