Re: [PATCH] gitk: properly deal with tag names containing / (slash)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gerrit Pape <pape@xxxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux