{"thread":{"id":"8842","subject":"[BUG] gitk fails with argument that is both existing directory and branch name","startedAt":"2007-07-03T20:23:01Z","lastAt":"2007-07-04T16:58:03Z","messageCount":9,"participants":["Uwe Kleine-König","Johannes Schindelin","Linus Torvalds","Gerrit Pape","Paul Mackerras","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"46404","messageId":"20070703202301.GA24071@informatik.uni-freiburg.de","threadId":"8842","inReplyTo":null,"subject":"[BUG] gitk fails with argument that is both existing directory and branch name","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-07-03T20:23:01Z","receivedAt":"2007-07-03T20:23:01Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nI have a branch named fixes in my linux repo and until I did:\n\n\tgit format-patch -o fixes linus/master \n\nthe following command worked fine:\n\t\n\tgitk ^linus/master fixes\n\nbut now that there is a directory named fixes, nothing happens when\nrunning gitk.  With rev-list I get \n\n\tzeisberg@cassiopeia:~/gsrc/linux-2.6$ git rev-list ^linus/master fixes\n\tfatal: ambiguous argument 'fixes': both revision and filename\n\tUse '--' to separate filenames from revisions\n\nbut \n\t\n\tgitk ^linus/master fixes --\n\ndoesn't work either.  I'd suspect that the call to rev-list doesn't see\nthe \"--\" and the error is lost somewhere inbetween ...?\n\nI currently have no time to look into it, so for now you only get a\nreport.\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König\n\nhttp://www.google.com/search?q=i+squared\n"},{"id":"46412","messageId":"Pine.LNX.4.64.0707032248570.4071@racer.site","threadId":"8842","inReplyTo":"20070703202301.GA24071@informatik.uni-freiburg.de","subject":"Re: [BUG] gitk fails with argument that is both existing directory and branch name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-03T21:55:22Z","receivedAt":"2007-07-03T21:55:22Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 3 Jul 2007, Uwe Kleine-K?nig wrote:\n\n> \tzeisberg@cassiopeia:~/gsrc/linux-2.6$ git rev-list ^linus/master fixes\n> \tfatal: ambiguous argument 'fixes': both revision and filename\n> \tUse '--' to separate filenames from revisions\n> \n> but \n> \t\n> \tgitk ^linus/master fixes --\n\nUmm. Why don't you just use gitk linus/master..fixes? This is how we teach \npeople to use rev-list anyway.\n\nCiao,\nDscho\n"},{"id":"46416","messageId":"alpine.LFD.0.98.0707031514160.9434@woody.linux-foundation.org","threadId":"8842","inReplyTo":"Pine.LNX.4.64.0707032248570.4071@racer.site","subject":"Re: [BUG] gitk fails with argument that is both existing directory and branch name","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-07-03T22:17:51Z","receivedAt":"2007-07-03T22:17:51Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 3 Jul 2007, Johannes Schindelin wrote:\n> \n> Umm. Why don't you just use gitk linus/master..fixes? This is how we teach \n> people to use rev-list anyway.\n\nNo, Uwe is right. There's a bug somewhere.\n\nThis _should_ work:\n\n\t# create a fake 'gitk' branch if you don't have one already\n\tgit branch gitk master\n\n\t# This should look at the 'gitk' branch\n\tgitk gitk --\n\nbut it doesn't. It just hangs for me.\n\nIt seems to be some fairly recent gitk bug, too, because I'm pretty sure \nit _used_ to work.\n\nI checked, and \"git rev-list\" works fine:\n\n\tgit rev-list --default HEAD gitk\n\nfails correctly with\n\n\tfatal: ambiguous argument 'gitk': both revision and filename\n\tUse '--' to separate filenames from revisions\n\nand the way to get it to work as a branch-name is to do\n\n\tgit rev-list --default HEAD gitk --\n\nwhich works fine.\n\n\t\t\tLinus\n"},{"id":"46419","messageId":"Pine.LNX.4.64.0707032343160.4071@racer.site","threadId":"8842","inReplyTo":"alpine.LFD.0.98.0707031514160.9434@woody.linux-foundation.org","subject":"Re: [BUG] gitk fails with argument that is both existing directory and branch name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-03T22:44:19Z","receivedAt":"2007-07-03T22:44:19Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 3 Jul 2007, Linus Torvalds wrote:\n\n> On Tue, 3 Jul 2007, Johannes Schindelin wrote:\n> \n> > Umm. Why don't you just use gitk linus/master..fixes? This is how we \n> > teach people to use rev-list anyway.\n> \n> No, Uwe is right. There's a bug somewhere.\n\nI never questioned that there is a bug. I was only wondering why he used \nthat ambiguous way to specify a range, when a range is clearly what he \nwants.\n\nAh well. I'll look into it.\n\nCiao,\nDscho\n"},{"id":"46421","messageId":"Pine.LNX.4.64.0707032353330.4071@racer.site","threadId":"8842","inReplyTo":"alpine.LFD.0.98.0707031514160.9434@woody.linux-foundation.org","subject":"[PATCH] gitk: fix for \"gitk <ambiguous-name> --\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-03T22:55:24Z","receivedAt":"2007-07-03T22:55:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nIf you have an ambiguous ref, i.e. a file in the working directory bears\nthe same name, you have to use \"--\" at the end to disambiguate ref from\nfile. This works with \"git rev-list\". Make it work with gitk, too.\n\nNoticed by Uwe Kleine-König.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tUwe, did your name come out right? I recently had to manually fix \n\tpine, and realised only then what a tedious work it is to teach \n\tpine about utf-8. Hopefully it worked out.\n\n gitk |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 2d6a6ef..a248f5a 100755\n--- a/gitk\n+++ b/gitk\n@@ -7440,7 +7440,7 @@ set cmdline_files {}\n set i [lsearch -exact $revtreeargs \"--\"]\n if {$i >= 0} {\n     set cmdline_files [lrange $revtreeargs [expr {$i + 1}] end]\n-    set revtreeargs [lrange $revtreeargs 0 [expr {$i - 1}]]\n+    set revtreeargs [lrange $revtreeargs 0 $i]\n } elseif {$revtreeargs ne {}} {\n     if {[catch {\n \tset f [eval exec git rev-parse --no-revs --no-flags $revtreeargs]\n-- \n1.5.3.rc0.2640.g59df9-dirty\n\n"},{"id":"46447","messageId":"20070704073715.31993.qmail@81358792d0c5f3.315fe32.mid.smarden.org","threadId":"8842","inReplyTo":"Pine.LNX.4.64.0707032353330.4071@racer.site","subject":"Re: [PATCH] gitk: fix for \"gitk <ambiguous-name> --\"","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2007-07-04T07:37:15Z","receivedAt":"2007-07-04T07:37:15Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On Tue, Jul 03, 2007 at 11:55:24PM +0100, Johannes Schindelin wrote:\n> If you have an ambiguous ref, i.e. a file in the working directory bears\n> the same name, you have to use \"--\" at the end to disambiguate ref from\n> file. This works with \"git rev-list\". Make it work with gitk, too.\n> \n> Noticed by Uwe Kleine-K??nig.\n\nNot sure anymore why, but I patched differently\n http://article.gmane.org/gmane.comp.version-control.git/48102\n\nRegards, Gerrit.\n"},{"id":"46455","messageId":"20070704083849.GA6970@informatik.uni-freiburg.de","threadId":"8842","inReplyTo":"Pine.LNX.4.64.0707032353330.4071@racer.site","subject":"Re: [PATCH] gitk: fix for \"gitk <ambiguous-name> --\"","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-07-04T08:38:49Z","receivedAt":"2007-07-04T08:38:49Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Johannes,\n\n> If you have an ambiguous ref, i.e. a file in the working directory bears\n> the same name, you have to use \"--\" at the end to disambiguate ref from\n> file. This works with \"git rev-list\". Make it work with gitk, too.\n\nThis fixes only one half of the problem.  Now \n\n\tgitk fixes ^linus/master --\n\nworks fine, but \n\n\tgitk fixes ^linus/master\n\nstill hangs.  \n\nI didn't try Gerrits patch yet.\n\nBTW, I don't use a range, because originally I used something like:\n\n\tgit branch | cut -b3- | grep -v ^attic/ | xargs gitk ^linus/master\n\nNow I have to think how I can add the ending \"--\" ...\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König\n\n5 out of 4 people have trouble with fractions.\n"},{"id":"46463","messageId":"18059.31237.286280.566140@cargo.ozlabs.ibm.com","threadId":"8842","inReplyTo":"Pine.LNX.4.64.0707032353330.4071@racer.site","subject":"Re: [PATCH] gitk: fix for \"gitk <ambiguous-name> --\"","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2007-07-04T10:44:21Z","receivedAt":"2007-07-04T10:44:21Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Johannes Schindelin writes:\n\n> If you have an ambiguous ref, i.e. a file in the working directory bears\n> the same name, you have to use \"--\" at the end to disambiguate ref from\n> file. This works with \"git rev-list\". Make it work with gitk, too.\n\nThis means that if you do \"gitk rev -- file\" we will end up with two\n\"--\" in the git rev-list command that gitk does.  I think we actually\nwant the patch below.\n\nJunio: there seems to be an inconsistency between git rev-list and git\nrev-parse here.  If a name is both a filename and a ref, git rev-list\nwill give a fatal error but git rev-parse will take it as a ref.\n\nPaul.\n\ndiff --git a/gitk b/gitk\nindex d509145..502a01a 100755\n--- a/gitk\n+++ b/gitk\n@@ -87,10 +87,7 @@ proc start_rev_list {view} {\n \n     set startmsecs [clock clicks -milliseconds]\n     set commitidx($view) 0\n-    set args $viewargs($view)\n-    if {$viewfiles($view) ne {}} {\n-\tset args [concat $args \"--\" $viewfiles($view)]\n-    }\n+    set args [concat $viewargs($view) \"--\" $viewfiles($view)]\n     set order \"--topo-order\"\n     if {$datemode} {\n \tset order \"--date-order\"\n"},{"id":"46497","messageId":"7v1wfohzs4.fsf@assigned-by-dhcp.cox.net","threadId":"8842","inReplyTo":"18059.31237.286280.566140@cargo.ozlabs.ibm.com","subject":"Re: [PATCH] gitk: fix for \"gitk <ambiguous-name> --\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-04T16:58:03Z","receivedAt":"2007-07-04T16:58:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Mackerras <paulus@samba.org> writes:\n\n> Junio: there seems to be an inconsistency between git rev-list and git\n> rev-parse here.  If a name is both a filename and a ref, git rev-list\n> will give a fatal error but git rev-parse will take it as a ref.\n\n\t$ rev-parse --no-revs --no-flags gitk -- gitk\n\t$ rev-parse --no-revs --no-flags -- gitk\n\nshould give you the path \"gitk\", while\n\n\t$ rev-parse --revs-only --no-flags gitk -- gitk\n\t$ rev-parse --revs-only --no-flags gitk --\n\nshould give you the revision (i.e. branch name) \"gitk\", I think.\n\nBut it is not well defined what it should do upon\n\n\t$ rev-parse --no-flags gitk\n\t$ rev-parse gitk\n\nCurrently they treat \"gitk\" as a ref.  On the other hand, as you\nsaid:\n\n\t$ rev-list gitk\n\nwould error out without leading or traiing -- to disambiguate.\n\nSo you are right that they behave differently.\n\nIt might be an improvement to make rev-parse require leading or\ntrailing -- in such a case, but I haven't thought through the\nramifications of such a change.  Quite a lot of existing users\nexpect \"rev-parse foo\" to favor a ref \"foo\" over a file \"foo\"\nand give its object name.\n"}]}