git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Change git-cvsimport to handle slashes in CVS tags
@ 2005-10-28 18:46 Wayne Scott
  2005-10-28 18:58 ` Johannes Schindelin
  2005-10-28 19:10 ` Linus Torvalds
  0 siblings, 2 replies; 5+ messages in thread
From: Wayne Scott @ 2005-10-28 18:46 UTC (permalink / raw)
  To: git

The Tcl/Tk CVS tree contains some tags like this one:
  dev-stubs-merge-8-1-3/9/99

CVS doesn't mind that tag, but git can't handle the slash
characters in the tag.  Just change those to underscore
so imports can complete.

Signed-off-by: Wayne Scott <wsc9tt@gmail.com>
---

 git-cvsimport.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

applies-to: cf6439199f61d87dbb70fd7b43144e41462a359d
225c95454711467fc889c15cb3f7ca3230fce58d
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index bbb83fb..d71c30c 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -636,6 +636,7 @@ my $commit = sub {
                my($xtag) = $tag;
                $xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and *
* FUNKY **
                $xtag =~ tr/_/\./ if ( $opt_u );
+               $xtag =~ tr/\//_/;

                my $pid = open2($in, $out, 'git-mktag');
                print $out "object $cid\n".
---
0.99.8.GIT

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Change git-cvsimport to handle slashes in CVS tags
  2005-10-28 18:46 [PATCH] Change git-cvsimport to handle slashes in CVS tags Wayne Scott
@ 2005-10-28 18:58 ` Johannes Schindelin
  2005-10-28 19:10 ` Linus Torvalds
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2005-10-28 18:58 UTC (permalink / raw)
  To: Wayne Scott; +Cc: git

Hi,

http://www.gelato.unsw.edu.au/archives/git/0508/7825.html

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Change git-cvsimport to handle slashes in CVS tags
  2005-10-28 18:46 [PATCH] Change git-cvsimport to handle slashes in CVS tags Wayne Scott
  2005-10-28 18:58 ` Johannes Schindelin
@ 2005-10-28 19:10 ` Linus Torvalds
  2005-10-28 20:29   ` Junio C Hamano
  2005-10-28 20:47   ` H. Peter Anvin
  1 sibling, 2 replies; 5+ messages in thread
From: Linus Torvalds @ 2005-10-28 19:10 UTC (permalink / raw)
  To: Wayne Scott, Junio C Hamano; +Cc: Git Mailing List


Hmm.. git can certainly handle slashes in tags, but you'd need to 
basically "mkdir" the path up to there before creating them. 

That's probably not the right thing to do for a tag that comes from the 
outside, since in git, the slashes work like in a filesystem, and should 
imply grouping (ie you might have a family of tags that is named by 
usage, and be called something like "release/xyz" or whatever).

Is "_" the right thing to replace it with, though? To me, "_" replaces 
either a space or a dash, while a slash could be replaced by something 
more like a special character.

Maybe it's just me, but your example "dev-stubs-merge-8-1-3/9/99" might
look nicer either of these ways:

 - dev-stubs-merge-8-1-3|9|99 (but "|" is hard to use with shell)
 - dev-stubs-merge-8-1-3.9.99 (CVS tags can't contain '.', right?)
 - dev-stubs-merge-8-1-3:9:99 (confuse with time?)
 - dev-stubs-merge-8-1-3+9+99 (one arithmetic op replaced by another)
 - dev-stubs-merge-8-1-3#9#99 (that's pretty ugly)
 - dev-stubs-merge-8-1-3?9?99 (Wayne might be right after all)
 - dev-stubs-merge-8-1-3_9_99 (maybe Wayne _is_ right?)

I dunno. But maybe we do want the option of just keeping it as a slash, 
and teach git-cvsimport to create the proper subdirectory prefixes.

I have no idea how to do that in perl, though. Right now it just does

	open(C,">$git_dir/refs/tags/$xtag")

how would you do "create file with all path components"?

		Linus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Change git-cvsimport to handle slashes in CVS tags
  2005-10-28 19:10 ` Linus Torvalds
@ 2005-10-28 20:29   ` Junio C Hamano
  2005-10-28 20:47   ` H. Peter Anvin
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2005-10-28 20:29 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

Linus Torvalds <torvalds@osdl.org> writes:

> I dunno. But maybe we do want the option of just keeping it as a slash, 
> and teach git-cvsimport to create the proper subdirectory prefixes.

How about doing both?

I think patch by Johannes to allow replacing slash to arbitrary
string is a reasonable thing to have, but somebody who uses
cvsimport needs to sign that off for me -- I do not regularly
use git-ANYimport myself.

> I have no idea how to do that in perl, though. Right now it just does
>
> 	open(C,">$git_dir/refs/tags/$xtag")
>
> how would you do "create file with all path components"?

Something like this? 

use File::Path;
my $file = "$git_dir/refs/tags/$xtag";
my ($dir) =  $file =~ m/(.*)\//;
mkpath($dir) && open C, ">$file";

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Change git-cvsimport to handle slashes in CVS tags
  2005-10-28 19:10 ` Linus Torvalds
  2005-10-28 20:29   ` Junio C Hamano
@ 2005-10-28 20:47   ` H. Peter Anvin
  1 sibling, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2005-10-28 20:47 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Wayne Scott, Junio C Hamano, Git Mailing List

Linus Torvalds wrote:
> 
> Is "_" the right thing to replace it with, though? To me, "_" replaces 
> either a space or a dash, while a slash could be replaced by something 
> more like a special character.
> 

If nothing else it creates a nice symmetry, since CVS can't use '.' in 
tags (which only is the most common character in nearly all versioning 
schemes), and which is commonly replaced by '_'.  We already have the -m 
option to change that back to dots, so we'd go:

'/' -> '_' -> '.'

... which at least means no info loss.

	-hpa

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-28 20:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-28 18:46 [PATCH] Change git-cvsimport to handle slashes in CVS tags Wayne Scott
2005-10-28 18:58 ` Johannes Schindelin
2005-10-28 19:10 ` Linus Torvalds
2005-10-28 20:29   ` Junio C Hamano
2005-10-28 20:47   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).