threads / patch / 3815

patchfix gitk with lots of tags

Subject: [PATCH] fix gitk with lots of tags

## tl;dr

5 messages between Apr 6, 2006 and Apr 21, 2006. Diffs are folded; open one to read it.

replies: 4people: 3as markdown or json

Jim Radford· Apr 6, 2006, 20:36 UTC · lore
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.

Signed-Off-By: Jim Radford <radford@blackbean.org>
-Jim
---
Show changes to gitk +4 −12
diff --git a/gitk b/gitk
index 26fa79a..40672fb 100755
--- a/gitk
+++ b/gitk
@@ -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} {
Jim Radford· Apr 18, 2006, 18:06 UTC · re: Jim Radford · lore

[RESEND] [PATCH] 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.

Signed-Off-By: Jim Radford <radford@blackbean.org>
Show changes to gitk +4 −12
diff --git a/gitk b/gitk
index 26fa79a..40672fb 100755
--- a/gitk
+++ b/gitk
@@ -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} {
Linus Torvalds· Apr 18, 2006, 18:38 UTC · re: Jim Radford · lore

Re: [RESEND] [PATCH] fix gitk with lots of tags

On Tue, 18 Apr 2006, Jim Radford wrote:
> 
> 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
---
Show changes to gitk +1 −10
diff --git a/gitk b/gitk
index 87e7162..5d95779 100755
--- a/gitk
+++ b/gitk
@@ -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
 }
 
Paul Mackerras· Apr 21, 2006, 11:48 UTC · re: Jim Radford · lore

Re: [RESEND] [PATCH] fix gitk with lots of tags

Jim Radford writes:
> 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?

> [1] Maybe he judges people by the color of their IP address?
As in _black_bean.org? :)
>     Then again, he could just be busy.

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

Paul.
Linus Torvalds· Apr 21, 2006, 15:19 UTC · re: Paul Mackerras · lore

Re: [RESEND] [PATCH] fix gitk with lots of tags

On Fri, 21 Apr 2006, Paul Mackerras wrote:
> 
> 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

← back to recent threads