Reputation: 2755
I always got the "argument list too long" error when I try to use "gitk" to open the GUI of the history for some large repo. Even using "gitk -n" didn't solve the problem. Does anybody here have same issue? Thanks,
couldn't execute "git": argument list too long
couldn't execute "git": argument list too long
while executing
"open [concat $cmd $ids] r"
(procedure "getallcommits" line 47)
invoked from within
"getallcommits"
(procedure "readcache" line 80)
invoked from within
"readcache file13"
("eval" body line 1)
invoked from within
"eval $script"
(procedure "dorunq" line 11)
invoked from within
"dorunq"
("after" script)
Upvotes: 6
Views: 12416
Reputation: 6660
I consistently had this error on a repo with a large number of references (50k+ remote branches).
The solution is twofold:
Obviously, deleting merged branches is a good practice, as well is keeping the total number of refs to a reasonable value.
In my case I had no control on the remote and therefore couldn’t do so at the source. So I used git’s ability to filter remote refs by setting the remote.<name>.fetch
configuration option through the git remote set-branches
command:
git remote set-branches $REMOTE $BRANCH0 $BRANCH1 $BRANCH2 # List only the few branches I’m interested in.
for REMOTE_BRANCH in $(git branch -r); do
git branch -rd "${REMOTE_BRANCH}" # Clear the branches I already know about
done
git fetch $REMOTE # Fetch again the branches I selected on the first line.
Once the total number of refs existings in .git/refs
is low enough, you should clear all gitk’s caches with:
find .git -name gitk.cache -delete
Upvotes: 0
Reputation: 61
Adding on to the answer above: If you are using worktrees, bear in mind that there are other gitk.cache
files too, like so:
.git/worktrees/dev-2/gitk.cache
You may have to delete those too.
Upvotes: 3
Reputation: 9997
I've found a workaroung here and it worked for me: just remove .git/gitk.cache
file.
Upvotes: 13
Reputation: 189689
"Argument list too long" is a kernel error when you pass in too many arguments on a command line.
Probably your repo contains something which causes $ids
(I'm purely speculating here) to exceed the ARG_MAX
limit of your platform.
This is basically a bug in Gitk, but if you can figure out which resource is causing this, you can probably work around the problem by limiting or pruning it somehow.
Upvotes: 2