{"thread":{"id":"1551","subject":"[PATCH] Also handle CVS branches with a '/' in their name","startedAt":"2005-08-17T06:39:31Z","lastAt":"2005-08-17T09:19:20Z","messageCount":5,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7425","messageId":"Pine.LNX.4.63.0508170839030.27628@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1551","inReplyTo":null,"subject":"[PATCH] Also handle CVS branches with a '/' in their name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-17T06:39:31Z","receivedAt":"2005-08-17T06:39:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"I track a CVS project which has a branch with a '/' in the branch name.\nSince git wants the branch name to be a file name at the same time,\ntranslate that character to a '-'. This should work well, despite the\nfact that a division and a difference are completely different :-)\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n\n git-cvsimport-script |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\n787879e1e16d6cece75dc4744358ba0073e908cc\ndiff --git a/git-cvsimport-script b/git-cvsimport-script\n--- a/git-cvsimport-script\n+++ b/git-cvsimport-script\n@@ -621,6 +621,7 @@ while(<CVS>) {\n \t\t$state = 4;\n \t} elsif($state == 4 and s/^Branch:\\s+//) {\n \t\ts/\\s+$//;\n+\t\ts/\\//-/g;\n \t\t$branch = $_;\n \t\t$state = 5;\n \t} elsif($state == 5 and s/^Ancestor branch:\\s+//) {\n"},{"id":"7428","messageId":"7vk6il11wi.fsf@assigned-by-dhcp.cox.net","threadId":"1551","inReplyTo":"Pine.LNX.4.63.0508170839030.27628@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Also handle CVS branches with a '/' in their name","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-17T07:02:53Z","receivedAt":"2005-08-17T07:02:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> I track a CVS project which has a branch with a '/' in the branch name.\n> Since git wants the branch name to be a file name at the same time,\n> translate that character to a '-'. This should work well, despite the\n> fact that a division and a difference are completely different :-)\n\nMy feeling is that there should be nothing to prevent you from\nhaving a non-flat namespace in .git/refs/heads; i.e. we should\nallow \".git/refs/heads/foo/bar\".  Some of the existing tools may\nbe forgetting to call either \"mkdir -p $(dirname $ref)\" if they\nare written in shell, or safe_create_leading_directories(ref) in\nC, but I consider that is a bug.\n"},{"id":"7429","messageId":"Pine.LNX.4.63.0508170906480.10754@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1551","inReplyTo":"7vk6il11wi.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Also handle CVS branches with a '/' in their name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-17T07:09:54Z","receivedAt":"2005-08-17T07:09:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 17 Aug 2005, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > I track a CVS project which has a branch with a '/' in the branch name.\n> > Since git wants the branch name to be a file name at the same time,\n> > translate that character to a '-'. This should work well, despite the\n> > fact that a division and a difference are completely different :-)\n> \n> My feeling is that there should be nothing to prevent you from\n> having a non-flat namespace in .git/refs/heads; i.e. we should\n> allow \".git/refs/heads/foo/bar\".\n\nThat may be true, but CVS branches being named \"Hänsel/Gretel\" do not \nlogically denote hierarchies. I never ever saw hierarchical CVS branch \nnames with a \"/\" separator. I saw some with a \".\" separator.\n\nMy feeling is that it would be wrong to map CVS branch names to a \nhierarchy.\n\nCiao,\nDscho\n"},{"id":"7430","messageId":"7vbr3x10rr.fsf@assigned-by-dhcp.cox.net","threadId":"1551","inReplyTo":"Pine.LNX.4.63.0508170906480.10754@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Also handle CVS branches with a '/' in their name","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-17T07:27:20Z","receivedAt":"2005-08-17T07:27:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> That may be true, but CVS branches being named \"Hänsel/Gretel\" do not \n> logically denote hierarchies. I never ever saw hierarchical CVS branch \n> names with a \"/\" separator. I saw some with a \".\" separator.\n>\n> My feeling is that it would be wrong to map CVS branch names to a \n> hierarchy.\n\nAlthough I've used / in CVS branch names to denote hierarchy,\nI now agree with you for a different reason.  A CVS repository\ncan have branches \"Hnsel\" and \"Hnsel/Gretel\" at the same time,\nwhich we cannot express it with '/'.\n\nHowever, this may make CVS tags Hnsel/Gretel and Hnsel-Gretel\nclash, so maybe the name mangling should be made somehow\nconfigurable?\n"},{"id":"7437","messageId":"Pine.LNX.4.63.0508171118500.4997@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1551","inReplyTo":"7vbr3x10rr.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH 2nd try] Also handle CVS branches with a '/' in their name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-17T09:19:20Z","receivedAt":"2005-08-17T09:19:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nI track a CVS project which has a branch with a '/' in the branch name.\nSince git wants the branch name to be a file name at the same time,\nsubstitute that character to a '-' by default (override with \"-s <subst>\").\nThis should work well, despite the fact that a division and a difference\nare completely different :-)\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n\n Documentation/git-cvsimport-script.txt |    6 +++++-\n git-cvsimport-script                   |    8 +++++---\n 2 files changed, 10 insertions(+), 4 deletions(-)\n\nb4327595f6cd2a0a4e573ceb12983765321f4790\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,8 @@ 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> ] [ -i ] [ -k ] [ <CVS_module> ]\n+\t\t\t[ -C <GIT_repository> ] [ -i ] [ -k ]\n+\t\t\t[ -s <subst> ] [ <CVS_module> ]\n \n \n DESCRIPTION\n@@ -69,6 +70,9 @@ OPTIONS\n -z <fuzz>::\n         Pass the timestamp fuzz factor to cvsps.\n \n+-s <subst>::\n+\tSubstitute the character \"/\" in branch names with <subst>\n+\n OUTPUT\n ------\n If '-v' is specified, the script reports what it is doing.\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_k,$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,$opt_s);\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-       [ -i ] [ -k ] [ CVS_module ]\n+       [ -i ] [ -k ] [-s subst] [ CVS_module ]\n END\n \texit(1);\n }\n \n-getopts(\"hivko:d:p:C:z:\") or usage();\n+getopts(\"hivko:d:p:C:z:s:\") or usage();\n usage if $opt_h;\n \n @ARGV <= 1 or usage();\n@@ -59,6 +59,7 @@ if($opt_d) {\n \tdie \"CVSROOT needs to be set\";\n }\n $opt_o ||= \"origin\";\n+$opt_s ||= \"-\";\n my $git_tree = $opt_C;\n $git_tree ||= \".\";\n \n@@ -621,6 +622,7 @@ while(<CVS>) {\n \t\t$state = 4;\n \t} elsif($state == 4 and s/^Branch:\\s+//) {\n \t\ts/\\s+$//;\n+\t\ts/[\\/]/$opt_s/g;\n \t\t$branch = $_;\n \t\t$state = 5;\n \t} elsif($state == 5 and s/^Ancestor branch:\\s+//) {\n"}]}