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

Re: [PATCH] cvsimport: strip question marks from tags

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 5, 2012, 03:19 UTC
Message-ID
<7vsjax6trn.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1346813618-20279-1-git-send-email-ktdreyer@ktdreyer.com>
Ken Dreyer <ktdreyer@ktdreyer.com> writes:
Show 22 quoted lines
> The "?" character can be present in a CVS tag name, but git's
> bad_ref_char does not allow question marks in git tags. If
> git-cvsimport encounters a CVS tag with a question mark, it will error
> and refuse to continue the import beyond that point.
>
> When importing CVS tags, strip "?" characters from the tag names as we
> translate them to git tag names.
>
> Signed-off-by: Ken Dreyer <ktdreyer@ktdreyer.com>
> ---
>  git-cvsimport.perl | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/git-cvsimport.perl b/git-cvsimport.perl
> index 8d41610..36f59fe 100755
> --- a/git-cvsimport.perl
> +++ b/git-cvsimport.perl
> @@ -890,6 +890,7 @@ sub commit {
>  		$xtag =~ tr/_/\./ if ( $opt_u );
>  		$xtag =~ s/[\/]/$opt_s/g;
>  		$xtag =~ s/\[//g;
> +		$xtag =~ s/\?//g;

I do not think this is a right and sustainable approach. The next patch would probably be to strip "~" and then another patch that strips "^", and yet another that squashes ".." into one would surely follow.

How about extending the s/\[//g we can see in the context to cover everything that are unacceptable (see refs.c:bad_ref_char()) once and for all? The result needs to be further massaged to avoid component that has two or more dots in a row, a dot at the beginning or at the end (see the comment at the beginning of refs.c, and also refs.c:check_refname_component()).

>  		system('git' , 'tag', '-f', $xtag, $cid) == 0
>  			or die "Cannot create tag $xtag: $!\n";
Previous: Ken DreyerNext: Ken Dreyer
Message 2 of 11 in “cvsimport: strip question marks from tags”
  1. cvsimport: strip question marks from tagsKen Dreyer, Sep 5, 2012
  2. Junio C HamanoSep 5, 2012
  3. cvsimport: strip all inappropriate tag stringsKen Dreyer, Sep 5, 2012
  4. Junio C HamanoSep 5, 2012
  5. Alex VandiverSep 5, 2012
  6. cvsimport: strip all inappropriate tag stringsKen Dreyer, Sep 5, 2012
  7. Junio C HamanoSep 6, 2012
  8. cvsimport: strip all inappropriate tag stringsKen Dreyer, Sep 6, 2012
  9. Andreas SchwabSep 6, 2012
  10. cvsimport: strip all inappropriate tag stringsKen Dreyer, Sep 6, 2012
  11. Junio C HamanoSep 6, 2012

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.