Re: [PATCH] Re: Gitk --all error when there are more than 797 refs in a repository
From: Johannes Sixt <hidden>
Date: 2016-06-15 22:47:25
Pat Thoyts schrieb:
"Murphy, John" [off-list ref] writes:quoted
There is a error when running gitk --all when there are more than 797 refs in a repository. We get an error message: Error reading commits: fatal ambiguous argument '3': unknown revision or path not in the working tree. Use '--' to separate paths from revisions. I believe issue is with this line of the code in proc parseviewrevs: if {[catch {set ids [eval exec git rev-parse "$revs"]} err]} When there are more than 797 refs the output of git rev-parse is too large to fit into the string, ids. 797 refs = 32,677 bytes. 798 refs = 32,718 bytes my guess is a little too close for comfort to 32,768 bytes. As I was deleting refs locally the error message would change from '3' to any char [A-Z,0-9].
I cannot reproduce the error. I have a repository with 100 commits in a linear history and 5000 refs (50 refs per commit). They are named refs/heads/branch-XXXX. I don't see any problems with 'gitk --all'.
+proc git-rev-parse {args} {
+ set ids {}
+ set pipe [open |[linsert $args 0 git rev-parse] r]
+ while {[gets $pipe line] != -1} {
+ lappend ids $line
+ }
+ close $pipe
+ return $ids
+}
+
proc parseviewrevs {view revs} {
global vposids vnegids
if {$revs eq {}} {
set revs HEAD
}
- if {[catch {set ids [eval exec git rev-parse $revs]} err]} {
+ if {[catch {set ids [git-rev-parse $revs]} err]} {Sorry, but you are changing the wrong end of git rev-parse. The limit is on the command line, but if you run 'gitk --all', then $revs is simply "--all" - no limit is exceeded. You changed the output of rev-parse, but there is no limit on how much Tcl can eat of rev-parse's output. The error must be in some other git invocation. -- Hannes