gitk: cache line for unreachable rev causing error
From: Thomas Rast <hidden>
Date: 2016-06-15 22:47:00
Hello,
Running gitk in one of my repositories always results in the error
can't read "arcnos()": no such element in array
can't read "arcnos()": no such element in array
while executing
"lsearch -exact $arcnos($l) $a"
(procedure "splitarc" line 21)
invoked from within
"splitarc $olds"
(procedure "getallclines" line 33)
invoked from within
"getallclines file7"
("eval" body line 1)
invoked from within
"eval $script"
(procedure "dorunq" line 11)
invoked from within
"dorunq"
("after" script)
Unfortunately, this repository contains problem sets for an ACM-style
exam that I'm working on, so I cannot share it, and rewriting+pruning
it in any way lets the bug disappear.
Thanks mostly to Ilari's help and good ideas on IRC, I was able to
nail it down to the line for a specific commit in .git/gitk.cache. It
looks like this:
e2f039d440a707c7eda6f0b741283d8efba622a6 0c6626ffec4f03b49aa15c0f8c28224a8565c3a9 0c6626ffec4f03b49aa15c0f8c28224a8565c3a9
Incidentally that's the only mention of e2f039d in the cache. (I have
attached the cache file if that helps you in any way.)
As far as I can tell there's nothing special about e2f039d or 0c6626f;
both commits are perfectly fine and 0c6626f is indeed the (only)
parent of e2f039d. It is, however, no longer reachable from any
branch tip; the reflog shows that I immediately amended it (resulting
in ff44826).
For some reason e2f039d is the main cause of trouble, as either
deleting the above line from the cache or the commit object from the
repository fixes the issue. By the latter, I mean editing the reflog
so that e2f039d is not mentioned in it any more (really just editing
out that single commit, adjusting the surrounding entries to make the
reflog contiguous again, is enough) and 'git repack -a -d; git prune'.
Perhaps as a useful data point, running with GIT_TRACE (output also
attached) shows a huge rev-list invocation that lists e2f039d as an
excluded revision:
trace: built-in: git 'rev-list' '--parents'
'08ce40933354d3652affef73387c039db1ce1543' # master
'7f6edf07183c3bbd47844ede1bffe2c924dee0d3' # t/runguard-rewrite
# ... lots more ...
'^e06d247080adf3da8adc14f1fb41f3911c9c72f9' # domjudge/configoverhaul
'^e0cd45f984abf44021b7253d94fd0eb02f82a1da' # HEAD@{97}
'^e2f039d440a707c7eda6f0b741283d8efba622a6' # HEAD@{144}
'^f4df3a10aeec248d6ffd550c609493527173adf2' # HEAD@{139}
Note the reachability on the right: the last three are not reachable
except through the reflog, and yet only one of them causes trouble.
All others, including the snipped ones, are branch heads.
I also ran gitk with GIT_TRACE after the above reflog editing and
pruning steps: in that case it still runs the above command (which
fails with "fatal: bad object e2f039d..." when invoked manually), and
then immediately follows up with 'git rev-list --parents --all'.
I am keeping a copy of the broken repository, so if you need more
information, please let me know. I just can't share any trees or
commit messages from the repo, as that would give away some of the
problems used in the exam.
- Thomas
--
Thomas Rast
trast@{inf,student}.ethz.ch