gitk says "file name too long"

The problem seems to be that for some reason gitk is launching "git
rev-list" (in $cmd) with a ton of IDs (in $ids), resulting in a command
line that is too long. So the error message does not come from gitk /
tk, but from git rev-list. I'm getting the same error (argument list too
long) if I manually enter the command at the shell.

Is anyone else experiencing this and has a solution? Is the problem
rather that the list of IDs is wrong (and thus too long), or do we need
to find a work-around to pass auch long command lines to git rev-list?