{"thread":{"id":"11910","subject":"[PATCH] gitk: properly deal with tag names containing / (slash)","startedAt":"2008-02-06T07:06:08Z","lastAt":"2008-02-12T02:21:12Z","messageCount":5,"participants":["Gerrit Pape","Junio C Hamano","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"67618","messageId":"20080206070608.6881.qmail@096465580ae94c.315fe32.mid.smarden.org","threadId":"11910","inReplyTo":null,"subject":"[PATCH] gitk: properly deal with tag names containing / (slash)","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2008-02-06T07:06:08Z","receivedAt":"2008-02-06T07:06:08Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"When creating a tag through gitk, and the tag name includes a slash (or\nslashes), gitk errors out in a popup window.  This patch makes gitk create\nthe necessary subdirectory(s) to successfully create the tag, and also\ncatches an error if a directory with the tag name to be created already\nexists.\n\nThe problem was reported by Fr�d�ric Bri�re through\n http://bugs.debian.org/464104\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n gitk-git/gitk |   11 +++++++++--\n 1 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 5560e4d..56a8792 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -6136,9 +6136,16 @@ proc domktag {} {\n \terror_popup [mc \"Tag \\\"%s\\\" already exists\" $tag]\n \treturn\n     }\n+    set dir [gitdir]\n+    set fname [file join $dir \"refs/tags\" $tag]\n+    if {[file isdirectory $fname]} {\n+\terror_popup [mc \"A directory with the name \\\"%s\\\" exists in \\\"refs/tags\\\"\" $tag]\n+\treturn\n+    }\n     if {[catch {\n-\tset dir [gitdir]\n-\tset fname [file join $dir \"refs/tags\" $tag]\n+\tif {[file dirname $tag] != \".\"} {\n+\t    file mkdir [file dirname $fname]\n+\t}\n \tset f [open $fname w]\n \tputs $f $id\n \tclose $f\n-- \n1.5.4\n"},{"id":"67621","messageId":"7vtzkm35d1.fsf@gitster.siamese.dyndns.org","threadId":"11910","inReplyTo":"20080206070608.6881.qmail@096465580ae94c.315fe32.mid.smarden.org","subject":"Re: [PATCH] gitk: properly deal with tag names containing / (slash)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-06T07:34:50Z","receivedAt":"2008-02-06T07:34:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> When creating a tag through gitk, and the tag name includes a slash (or\n> slashes), gitk errors out in a popup window.  This patch makes gitk create\n> the necessary subdirectory(s) to successfully create the tag, and also\n> catches an error if a directory with the tag name to be created already\n> exists.\n> ...\n> diff --git a/gitk-git/gitk b/gitk-git/gitk\n> index 5560e4d..56a8792 100644\n> --- a/gitk-git/gitk\n> +++ b/gitk-git/gitk\n> @@ -6136,9 +6136,16 @@ proc domktag {} {\n>  \terror_popup [mc \"Tag \\\"%s\\\" already exists\" $tag]\n>  \treturn\n>      }\n> +    set dir [gitdir]\n> +    set fname [file join $dir \"refs/tags\" $tag]\n> +    if {[file isdirectory $fname]} {\n> +\terror_popup [mc \"A directory with the name \\\"%s\\\" exists in \\\"refs/tags\\\"\" $tag]\n> +\treturn\n> +    }\n>      if {[catch {\n> -\tset dir [gitdir]\n> -\tset fname [file join $dir \"refs/tags\" $tag]\n> +\tif {[file dirname $tag] != \".\"} {\n> +\t    file mkdir [file dirname $fname]\n> +\t}\n\nThat's wrong.  If your refs are packed and you have an existing\ntag 'foo', you should error out on a request to create 'foo/bar'\n(and vice versa --- existing foo/bar should prevent foo from\nbeing created).\n\nYou should be calling out \"git tag\" instead of futzing with\nfiles under gitdir by hand.\n"},{"id":"67772","messageId":"20080207093415.13241.qmail@945a2ee23beef0.315fe32.mid.smarden.org","threadId":"11910","inReplyTo":"7vtzkm35d1.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] gitk: properly deal with tag names containing / (slash)","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2008-02-07T09:34:14Z","receivedAt":"2008-02-07T09:34:14Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"When creating a tag through gitk, and the tag name includes a slash (or\nslashes), gitk errors out in a popup window.  This patch makes gitk use\n'git tag' to create the tag instead of modifying files in refs/tags/,\nwhich fixes the issue; if 'git tag' throws an error, gitk pops up with\nthe error message.\n\nThe problem was reported by Fr�d�ric Bri�re through\n http://bugs.debian.org/464104\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n\nOn Tue, Feb 05, 2008 at 11:34:50PM -0800, Junio C Hamano wrote:\n> That's wrong.  If your refs are packed and you have an existing\n> tag 'foo', you should error out on a request to create 'foo/bar'\n> (and vice versa --- existing foo/bar should prevent foo from\n> being created).\n>\n> You should be calling out \"git tag\" instead of futzing with\n> files under gitdir by hand.\nDone so.\n\n gitk-git/gitk |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 5560e4d..00d791f 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -6137,11 +6137,7 @@ proc domktag {} {\n \treturn\n     }\n     if {[catch {\n-\tset dir [gitdir]\n-\tset fname [file join $dir \"refs/tags\" $tag]\n-\tset f [open $fname w]\n-\tputs $f $id\n-\tclose $f\n+\texec git tag $tag $id\n     } err]} {\n \terror_popup \"[mc \"Error creating tag:\"] $err\"\n \treturn\n-- \n1.5.4\n"},{"id":"68371","messageId":"20080211105741.16353.qmail@d33cfe7d8389ec.315fe32.mid.smarden.org","threadId":"11910","inReplyTo":"20080207093415.13241.qmail@945a2ee23beef0.315fe32.mid.smarden.org","subject":"[PATCH/UTF-8] gitk: properly deal with tag names containing / (slash)","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2008-02-11T10:57:40Z","receivedAt":"2008-02-11T10:57:40Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"When creating a tag through gitk, and the tag name includes a slash (or\nslashes), gitk errors out in a popup window.  This patch makes gitk use\n'git tag' to create the tag instead of modifying files in refs/tags/,\nwhich fixes the issue; if 'git tag' throws an error, gitk pops up with\nthe error message.\n\nThe problem was reported by Fr�d�ric Bri�re through\n http://bugs.debian.org/464104\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n gitk-git/gitk |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 5560e4d..00d791f 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -6137,11 +6137,7 @@ proc domktag {} {\n \treturn\n     }\n     if {[catch {\n-\tset dir [gitdir]\n-\tset fname [file join $dir \"refs/tags\" $tag]\n-\tset f [open $fname w]\n-\tputs $f $id\n-\tclose $f\n+\texec git tag $tag $id\n     } err]} {\n \terror_popup \"[mc \"Error creating tag:\"] $err\"\n \treturn\n-- \n1.5.4\n"},{"id":"68478","messageId":"18353.664.502848.772753@cargo.ozlabs.ibm.com","threadId":"11910","inReplyTo":"20080211105741.16353.qmail@d33cfe7d8389ec.315fe32.mid.smarden.org","subject":"Re: [PATCH/UTF-8] gitk: properly deal with tag names containing / (slash)","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-02-12T02:21:12Z","receivedAt":"2008-02-12T02:21:12Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Gerrit Pape writes:\n\n> When creating a tag through gitk, and the tag name includes a slash (or\n> slashes), gitk errors out in a popup window.  This patch makes gitk use\n> 'git tag' to create the tag instead of modifying files in refs/tags/,\n> which fixes the issue; if 'git tag' throws an error, gitk pops up with\n> the error message.\n\nThanks, applied.\n\nPaul.\n"}]}