Skip to contentSkip to conversation

fix gitk with lots of tags

PATCH New Jim Radford 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix gitk with lots of tags

Hi Paul,

This fix allow gitk to be used on repositories with lots of tags. It bypasses git-rev-parse and passes its arguments to git-rev-list directly to avoid the command line length restrictions.

-Jim

---

gitk +4 -12
index 26fa79a..40672fb 100755
@@ -17,19 +17,11 @@ proc gitdir {} {
 }
 
 proc parse_args {rargs} {
-    global parsed_args
-
-    if {[catch {
-	set parse_args [concat --default HEAD $rargs]
-	set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
-    }]} {
-	# if git-rev-parse failed for some reason...
-	if {$rargs == {}} {
-	    set rargs HEAD
-	}
-	set parsed_args $rargs
+    if {$rargs == {}} {
+        return HEAD
+    } else {
+	return $rargs
     }
-    return $parsed_args
 }
 
 proc start_rev_list {rlargs} {
#1 lore raw

PATCH RESEND 1/1 fix gitk with lots of tags

Hi Junio,

I've gotten no reposnse from Paul on this patch[1]. If it seems ok to you, would you mind putting it in your queue for him? I hate to see gitk die with "argument list too long" messages. They're so 640k.

Thanks,
-Jim

[1] Maybe he judges people by the color of their IP address? Then again, he could just be busy.

---

This fix allow gitk to be used on repositories with lots of tags. It bypasses git-rev-parse and passes its arguments to git-rev-list directly to avoid tcl's argument list length restrictions.

gitk +4 -12
index 26fa79a..40672fb 100755
@@ -17,19 +17,11 @@ proc gitdir {} {
 }
 
 proc parse_args {rargs} {
-    global parsed_args
-
-    if {[catch {
-	set parse_args [concat --default HEAD $rargs]
-	set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
-    }]} {
-	# if git-rev-parse failed for some reason...
-	if {$rargs == {}} {
-	    set rargs HEAD
-	}
-	set parsed_args $rargs
+    if {$rargs == {}} {
+        return HEAD
+    } else {
+	return $rargs
     }
-    return $parsed_args
 }
 
 proc start_rev_list {rlargs} {
#2 lore raw
Quoted 4 lines · Jim Radford

I've gotten no reposnse from Paul on this patch[1]. If it seems ok to you, would you mind putting it in your queue for him? I hate to see gitk die with "argument list too long" messages. They're so 640k.

Don't do this patch. It's wrong.

However, this simpler patch might be ok.

It just depends on the fact that git-rev-list can parse everything that git-rev-parse used to do these days, and thus the git-rev-parse call really isn't needed any more (and if that isn't true for some odd argument, we should make it true).

So the only thing we need to do is to add the "--default HEAD" thing to the front of the argument list.

Linus

---

gitk +1 -10
index 87e7162..5d95779 100755
@@ -19,16 +19,7 @@ proc gitdir {} {
 proc parse_args {rargs} {
     global parsed_args
 
-    if {[catch {
-	set parse_args [concat --default HEAD $rargs]
-	set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
-    }]} {
-	# if git-rev-parse failed for some reason...
-	if {$rargs == {}} {
-	    set rargs HEAD
-	}
-	set parsed_args $rargs
-    }
+    set parsed_args [concat --default HEAD $rargs]
     return $parsed_args
 }
 
#3 lore raw
In reply to Jim Radford
Quoted 3 lines · Jim Radford

I've gotten no reposnse from Paul on this patch[1]. If it seems ok to you, would you mind putting it in your queue for him? I hate to see gitk die with "argument list too long" messages. They're so 640k.

The reservation I have about this is that I need to be able to tell the file/directory names from the tags/heads/SHA1 IDs. After the pass through git-rev-parse it's easy; I just take the things that match ^[a-f0-9]{40}$ as IDs and the rest as file/directory names or switches.

Junio, did you tell me some time ago about a flag to git-rev-parse that spits out just the file/directory names? What was it again?

Quoted 1 line

[1] Maybe he judges people by the color of their IP address?

As in _black_bean.org? :)

Quoted 1 line

Then again, he could just be busy.

Yeah. Or just returned from international travel, or something like that. :)

Paul.

#4 lore raw
Quoted 3 lines · Paul Mackerras

Junio, did you tell me some time ago about a flag to git-rev-parse that spits out just the file/directory names? What was it again?

	git-rev-parse --no-flags --no-revs "$@"

should fo what you want.

Linus