git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: fix for "gitk <ambiguous-name> --"

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 3, 2007, 22:55 UTC
Message-ID
<Pine.LNX.4.64.0707032353330.4071@racer.site>
In-Reply-To
<alpine.LFD.0.98.0707031514160.9434@woody.linux-foundation.org>

If you have an ambiguous ref, i.e. a file in the working directory bears the same name, you have to use "--" at the end to disambiguate ref from file. This works with "git rev-list". Make it work with gitk, too.

Noticed by Uwe Kleine-König.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	Uwe, did your name come out right? I recently had to manually fix 
	pine, and realised only then what a tedious work it is to teach 
	pine about utf-8. Hopefully it worked out.
 gitk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitk b/gitk
index 2d6a6ef..a248f5a 100755
--- a/gitk
+++ b/gitk
@@ -7440,7 +7440,7 @@ set cmdline_files {}
 set i [lsearch -exact $revtreeargs "--"]
 if {$i >= 0} {
     set cmdline_files [lrange $revtreeargs [expr {$i + 1}] end]
-    set revtreeargs [lrange $revtreeargs 0 [expr {$i - 1}]]
+    set revtreeargs [lrange $revtreeargs 0 $i]
 } elseif {$revtreeargs ne {}} {
     if {[catch {
 	set f [eval exec git rev-parse --no-revs --no-flags $revtreeargs]
-- 
1.5.3.rc0.2640.g59df9-dirty
Previous: Johannes SchindelinNext: Gerrit Pape
Message 5 of 9 in “[BUG] gitk fails with argument that is both existing directory and branch name”
  1. Uwe Kleine-KönigJul 3, 2007
  2. Johannes SchindelinJul 3, 2007
  3. Linus TorvaldsJul 3, 2007
  4. Johannes SchindelinJul 3, 2007
  5. gitk: fix for "gitk <ambiguous-name> --"Johannes Schindelin, Jul 3, 2007
  6. Gerrit PapeJul 4, 2007
  7. Uwe Kleine-KönigJul 4, 2007
  8. Paul MackerrasJul 4, 2007
  9. Junio C HamanoJul 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.