git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2nd try] Also handle CVS branches with a '/' in their name

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 17, 2005, 09:19 UTC
Message-ID
<Pine.LNX.4.63.0508171118500.4997@wgmdd8.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7vbr3x10rr.fsf@assigned-by-dhcp.cox.net>

I track a CVS project which has a branch with a '/' in the branch name. Since git wants the branch name to be a file name at the same time, substitute that character to a '-' by default (override with "-s <subst>"). This should work well, despite the fact that a division and a difference are completely different :-)

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 Documentation/git-cvsimport-script.txt |    6 +++++-
 git-cvsimport-script                   |    8 +++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
b4327595f6cd2a0a4e573ceb12983765321f4790
diff --git a/Documentation/git-cvsimport-script.txt b/Documentation/git-cvsimport-script.txt
--- a/Documentation/git-cvsimport-script.txt
+++ b/Documentation/git-cvsimport-script.txt
@@ -11,7 +11,8 @@ SYNOPSIS
 --------
 'git-cvsimport-script' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]
 			[ -d <CVSROOT> ] [ -p <options-for-cvsps> ]
-			[ -C <GIT_repository> ] [ -i ] [ -k ] [ <CVS_module> ]
+			[ -C <GIT_repository> ] [ -i ] [ -k ]
+			[ -s <subst> ] [ <CVS_module> ]
 
 
 DESCRIPTION
@@ -69,6 +70,9 @@ OPTIONS
 -z <fuzz>::
         Pass the timestamp fuzz factor to cvsps.
 
+-s <subst>::
+	Substitute the character "/" in branch names with <subst>
+
 OUTPUT
 ------
 If '-v' is specified, the script reports what it is doing.
diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -28,19 +28,19 @@ use POSIX qw(strftime dup2);
 $SIG{'PIPE'}="IGNORE";
 $ENV{'TZ'}="UTC";
 
-our($opt_h,$opt_o,$opt_v,$opt_k,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i);
+our($opt_h,$opt_o,$opt_v,$opt_k,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_s);
 
 sub usage() {
 	print STDERR <<END;
 Usage: ${\basename $0}     # fetch/update GIT from CVS
        [ -o branch-for-HEAD ] [ -h ] [ -v ] [ -d CVSROOT ]
        [ -p opts-for-cvsps ] [ -C GIT_repository ] [ -z fuzz ]
-       [ -i ] [ -k ] [ CVS_module ]
+       [ -i ] [ -k ] [-s subst] [ CVS_module ]
 END
 	exit(1);
 }
 
-getopts("hivko:d:p:C:z:") or usage();
+getopts("hivko:d:p:C:z:s:") or usage();
 usage if $opt_h;
 
 @ARGV <= 1 or usage();
@@ -59,6 +59,7 @@ if($opt_d) {
 	die "CVSROOT needs to be set";
 }
 $opt_o ||= "origin";
+$opt_s ||= "-";
 my $git_tree = $opt_C;
 $git_tree ||= ".";
 
@@ -621,6 +622,7 @@ while(<CVS>) {
 		$state = 4;
 	} elsif($state == 4 and s/^Branch:\s+//) {
 		s/\s+$//;
+		s/[\/]/$opt_s/g;
 		$branch = $_;
 		$state = 5;
 	} elsif($state == 5 and s/^Ancestor branch:\s+//) {
Previous: Junio C Hamano
Message 5 of 5 in “Also handle CVS branches with a '/' in their name”
  1. Also handle CVS branches with a '/' in their nameJohannes Schindelin, Aug 17, 2005
  2. Junio C HamanoAug 17, 2005
  3. Johannes SchindelinAug 17, 2005
  4. Junio C HamanoAug 17, 2005
  5. Also handle CVS branches with a '/' in their nameJohannes Schindelin, Aug 17, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.