git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] gitk: prevent overly long command lines

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 24, 2023, 15:38 UTC
Message-ID
<xmqqv8kwhrja.fsf@gitster.g>
In-Reply-To
<89fe0380cd3a373e7e23d663b506466fd6cb5fb6.1674559397.git.gitgitgadget@gmail.com>

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 8 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> To avoid running into command line limitations, some of Git's commands
> support the `--stdin` option.
>
> Let's use exactly this option in the three rev-list/log invocations in
> gitk that would otherwise possibly run the danger of trying to invoke a
> too-long command line.

Makes perfect sense. I do not know the point of saying exactly here, though.

Show 6 quoted lines
> While it is easy to redirect either stdin or stdout in Tcl/Tk scripts,
> what we need here is both. We need to capture the output, yet we also
> need to pipe in the revs/files arguments via stdin (because stdin does
> not have any limit, unlike the command line). To help this, we use the
> neat Tcl feature where you can capture stdout and at the same time feed
> a fixed string as stdin to the spawned process.

Nice, so this is not about "we may have too many args to fit in our memory", but about "we may have too many args for system to spawn the subprocess with".

> One non-obvious aspect about this change is that the `--stdin` option
> allows to specify revs, the double-dash, and files, but *no* other
> options such as `--not`.

It sounds like a design mistake, which may want to be fixed, but of course gitk cannot depend on Git it runs with having such a fix, and use of "^" prefix is a good alternative (after all, "--not" was invented to save us writing ^ in front of many revs).

Good.
Previous: Johannes Schindelin via GitGitGadgetNext: Nico Rieck via GitGitGadget
Message 3 of 10 in “gitk: handle long command-lines”
  1. 0/2 gitk: handle long command-linesJohannes Schindelin via GitGitGadget, Jan 24, 2023
  2. 1/2 gitk: prevent overly long command linesJohannes Schindelin via GitGitGadget, Jan 24, 2023
  3. Junio C HamanoJan 24, 2023
  4. 2/2 gitk: escape file paths before piping to git logNico Rieck via GitGitGadget, Jan 24, 2023
  5. Johannes SchindelinMar 27, 2023
  6. Felipe ContrerasMar 27, 2023
  7. Philip OakleyMay 6, 2023
  8. New canonical gitk urlFelipe Contreras, May 7, 2023
  9. Junio C HamanoMay 8, 2023
  10. Felipe ContrerasMay 9, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.