Re: [PATCH] Demonstrate failure of 'core.ignorecase = true'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 23, 2012, 17:47 UTC
- Message-ID
- <7v62dvus3f.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <87pqc3ei08.fsf@thomas.inf.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
> How about trying to read "HEAD" as "head" instead when core.ignorecase > is true? That would allow us to catch such misconfiguration (which I > imagine can also happen accidentally if you mv a repository across FS > boundaries) and tell the user about it.
Do you mean something like this?
I do not like it. It essentially amounts to checking with the FS every time we run Git.
config.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/config.c b/config.c index 68d3294..8783937 100644 --- a/config.c +++ b/config.c @@ -575,7 +575,16 @@ static int git_default_core_config(const char *var, const char *value) } if (!strcmp(var, "core.ignorecase")) { + static int true_case; /* 0: unknown, 1: sensitive, 2: fat */ ignore_case = git_config_bool(var, value); + if (ignore_case) { + if (!true_case) { + true_case = fs_is_case_sensitive() ? 1 : 2; + if (true_case == 2) + warn("Whoa"); + } + ignore_case = true_case >> 1; + } return 0; }