From: Junio C Hamano <gitster@pobox.com>
To: Ken Dreyer <ktdreyer@ktdreyer.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] cvsimport: strip question marks from tags
Date: Tue, 04 Sep 2012 20:19:40 -0700 [thread overview]
Message-ID: <7vsjax6trn.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1346813618-20279-1-git-send-email-ktdreyer@ktdreyer.com> (Ken Dreyer's message of "Tue, 4 Sep 2012 20:53:38 -0600")
Ken Dreyer <ktdreyer@ktdreyer.com> writes:
> 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";
next prev parent reply other threads:[~2012-09-05 3:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 2:53 [PATCH] cvsimport: strip question marks from tags Ken Dreyer
2012-09-05 3:19 ` Junio C Hamano [this message]
2012-09-05 4:26 ` [PATCH] cvsimport: strip all inappropriate tag strings Ken Dreyer
2012-09-05 5:52 ` Junio C Hamano
2012-09-05 6:44 ` Alex Vandiver
2012-09-05 21:39 ` Ken Dreyer
2012-09-06 3:52 ` Junio C Hamano
2012-09-06 5:42 ` Ken Dreyer
2012-09-06 9:02 ` Andreas Schwab
2012-09-06 16:36 ` Ken Dreyer
2012-09-06 17:41 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vsjax6trn.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ktdreyer@ktdreyer.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).