test-dump-untracked-cache: don't modify the untracked cache

To correctly perform its testing function,
test-dump-untracked-cache should not change the state of the
untracked cache in the index.

As a previous patch makes read_index_from() change the state of
the untracked cache and as test-dump-untracked-cache indirectly
calls this function, we need a mechanism to prevent
read_index_from() from changing the untracked cache state when
it's called from test-dump-untracked-cache.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Christian Couder
2016-01-27 07:58:06 +01:00
committed by Junio C Hamano
parent 435ec090ec
commit dae6c322fa
4 changed files with 22 additions and 0 deletions

View File

@ -1599,6 +1599,10 @@ int git_config_get_untracked_cache(void)
int val = -1;
const char *v;
/* Hack for test programs like test-dump-untracked-cache */
if (ignore_untracked_cache_config)
return -1;
if (!git_config_get_maybe_bool("core.untrackedcache", &val))
return val;