git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Gerrit Pape <pape@smarden.org>
Cc: git@vger.kernel.org, Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH] gitk: properly deal with tag names containing / (slash)
Date: Tue, 05 Feb 2008 23:34:50 -0800	[thread overview]
Message-ID: <7vtzkm35d1.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080206070608.6881.qmail@096465580ae94c.315fe32.mid.smarden.org> (Gerrit Pape's message of "Wed, 6 Feb 2008 07:06:08 +0000")

Gerrit Pape <pape@smarden.org> writes:

> When creating a tag through gitk, and the tag name includes a slash (or
> slashes), gitk errors out in a popup window.  This patch makes gitk create
> the necessary subdirectory(s) to successfully create the tag, and also
> catches an error if a directory with the tag name to be created already
> exists.
> ...
> diff --git a/gitk-git/gitk b/gitk-git/gitk
> index 5560e4d..56a8792 100644
> --- a/gitk-git/gitk
> +++ b/gitk-git/gitk
> @@ -6136,9 +6136,16 @@ proc domktag {} {
>  	error_popup [mc "Tag \"%s\" already exists" $tag]
>  	return
>      }
> +    set dir [gitdir]
> +    set fname [file join $dir "refs/tags" $tag]
> +    if {[file isdirectory $fname]} {
> +	error_popup [mc "A directory with the name \"%s\" exists in \"refs/tags\"" $tag]
> +	return
> +    }
>      if {[catch {
> -	set dir [gitdir]
> -	set fname [file join $dir "refs/tags" $tag]
> +	if {[file dirname $tag] != "."} {
> +	    file mkdir [file dirname $fname]
> +	}

That's wrong.  If your refs are packed and you have an existing
tag 'foo', you should error out on a request to create 'foo/bar'
(and vice versa --- existing foo/bar should prevent foo from
being created).

You should be calling out "git tag" instead of futzing with
files under gitdir by hand.

  reply	other threads:[~2008-02-06  7:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-06  7:06 [PATCH] gitk: properly deal with tag names containing / (slash) Gerrit Pape
2008-02-06  7:34 ` Junio C Hamano [this message]
2008-02-07  9:34   ` Gerrit Pape
2008-02-11 10:57     ` [PATCH/UTF-8] " Gerrit Pape
2008-02-12  2:21       ` Paul Mackerras

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=7vtzkm35d1.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pape@smarden.org \
    --cc=paulus@samba.org \
    /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).