Re: [PATCH v5 10/11] test-dump-untracked-cache: don't modify the untracked cache
flat view
From: Christian Couder <hidden>
Date: 2016-06-15 23:07:50
On Fri, Jan 15, 2016 at 9:16 PM, Junio C Hamano [off-list ref] wrote:
Christian Couder [off-list ref] writes:quoted
diff --git a/cache.h b/cache.h index 59a15fd..89c7e10 100644 --- a/cache.h +++ b/cache.h@@ -1605,6 +1605,8 @@ extern int git_config_get_maybe_bool(const char *key, int *dest); extern int git_config_get_pathname(const char *key, const char **dest); extern int git_config_get_untracked_cache(void); +extern int ignore_untracked_cache_config; +I know you said this is a hack to support the test, but I really do not like to have a test-only global variable exposed to everybody like this, as I do not think "ignore_untracked_cache_config" should be necessary outside the context of testing [*1*]. If the config cache layer that is used by the implementation of git_config_get_untracked_cache() had a way to be told to pretend that the value of a particular configuration variable is a given value, then we could do git_config_pretend_value("core.untrackedcache", "keep"); at the beginning of the test program without harming anybody else. The above is just me "thinking aloud", without assessing if the damage to the entire codebase with that approach to extend the config layer would be larger than the damabe by this patch, and it is certainly not a suggestion to redo this patch along that line. But I am saying it aloud because it may turn out to be a good direction to go in the larger picture once this series is done--it may be a solution that is applicable to a class of similar problems in a more general way. Inside the scope of this series, can we at least add a comment next to this variable telling everybody to never use it in normal programs, or something?
Ok, the comments have been added or rewritten telling that in the v6 I just sent, thanks.