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

Re: Bug: diff --no-index with cachetextconv crashes

From
PDPaweł Dominiak <dominiak.pawel@gmail.com>
Date
Feb 26, 2024, 07:56 UTC
Message-ID
<CACeVQwRkoJejrWvym_BAZE-OWi+q3RZfyEpwAwA+0hGUBCeD=Q@mail.gmail.com>
In-Reply-To
<20240226072248.GC780982@coredump.intra.peff.net>
> OK, I would say that this failing is semi-expected. :) The caching
> system works using "git notes", which are stored in refs in the
> repository. And since you are running "diff --no-index" outside of a
> repository, there is nowhere to put them.

I have not mentioned this specifically, but my goal is a general diff command, which internally uses text conversions, pager etc. as configured for git. It makes sense to cache the textconv results when used in a repository, but I don't think it should fail when not in one. I think the default behavior should be to silently skip caching in such situations but produce a diff otherwise.

> Of course any time we see a BUG something has gone wrong. What I think
> _should_ happen is that we should quietly disable the caching (which,
> after all, is just an optimization) and otherwise complete the command.
In my script I currently disable caching explicitly for all drivers:

keys=$(git config --name-only --get-regexp '^diff\.\w+\.cachetextconv$') config=(); for key in $keys; do config+=(-c "$key=false"); done

git "${config[@]}" diff --no-index --no-prefix "$@"

But it seems like something git should handle on its own, so that diff would accommodate use in different circumstances with the same config.

-Pawel
Previous: Jeff KingNext: Jeff King
Message 3 of 5 in “Bug: diff --no-index with cachetextconv crashes”
  1. Paweł DominiakFeb 26, 2024
  2. Jeff KingFeb 26, 2024
  3. Paweł DominiakFeb 26, 2024
  4. userdiff: skip textconv caching when not in a repositoryJeff King, Feb 26, 2024
  5. Junio C HamanoFeb 26, 2024

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.