]> git.ipfire.org Git - thirdparty/git.git/commit
userdiff: skip textconv caching when not in a repository
authorJeff King <peff@peff.net>
Mon, 26 Feb 2024 10:27:29 +0000 (05:27 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Feb 2024 17:40:55 +0000 (09:40 -0800)
commitaffe355fe706d79ce6959277c39a7f1b1ec35f58
tree6aeacb4da9b5db0b66591de6349b8112907e11f0
parent0d464a4e6a5a19bd8fbea1deae22d48d14dccb01
userdiff: skip textconv caching when not in a repository

The textconv caching system uses git-notes to store its cache entries.
But if you're using "diff --no-index" outside of a repository, then
obviously that isn't going to work.

Since caching is just an optimization, it's OK for us to skip it.
However, the current behavior is much worse: we call notes_cache_init()
which tries to look up the ref, and the low-level ref code hits a BUG(),
killing the program. Instead, we should notice before setting up the
cache that it there's no repository, and just silently skip it.

Reported-by: Paweł Dominiak <dominiak.pawel@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4042-diff-textconv-caching.sh
userdiff.c