diff options
author | Martin Ågren <martin.agren@gmail.com> | 2022-07-22 23:22:32 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-07-22 23:51:00 +0200 |
commit | 4447d4129d944eb136fd5c35014cc2b370a2d752 (patch) | |
tree | 69dce76dac38dbd628f1daf395037242c317d145 /t/t7063-status-untracked-cache.sh | |
parent | untracked-cache: support '--untracked-files=all' if configured (diff) | |
download | git-4447d4129d944eb136fd5c35014cc2b370a2d752.tar.xz git-4447d4129d944eb136fd5c35014cc2b370a2d752.zip |
read-cache: make `do_read_index()` always set up `istate->repo`
If there is no index file, e.g., because the repository has just been
created, we return zero early (unless `must_exist` makes us die
instead.)
This early return means we do not set up `istate->repo`. With
`core.untrackedCache=true`, the recent e6a653554b ("untracked-cache:
support '--untracked-files=all' if configured", 2022-03-31) will
eventually pass down `istate->repo` as a null pointer to
`repo_config_get_string()`, causing a segmentation fault.
If we do hit this early return, set up `istate->repo` similar to when we
actually read the index.
Reported-by: Joey Hess <id@joeyh.name>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-x | t/t7063-status-untracked-cache.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh index 9936cc329e..c1f0d95036 100755 --- a/t/t7063-status-untracked-cache.sh +++ b/t/t7063-status-untracked-cache.sh @@ -985,4 +985,9 @@ test_expect_success '"status" after file replacement should be clean with UC=fal status_is_clean ' +test_expect_success 'empty repo (no index) and core.untrackedCache' ' + git init emptyrepo && + git -C emptyrepo -c core.untrackedCache=true write-tree +' + test_done |