Re: [PATCH] t3703: add test cases for pathspec magic
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 7, 2011, 18:56 UTC
- Message-ID
- <7vwri2wd8x.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1304764507-27547-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> That was the intention, but it raises a question: what do we do if a > file happens to have the same name with the given magic pathspec, as > in the last two tests?
I would have expected that in such a case the user would pass a "\:" or even ":::" to match the file ":", and "\:(rubbish)" to match the file ":(rubbish)". The whole ":" is special thing comes from the observation that a path that begins with a colon is rare, so it is Ok to require the user to do some more work (typing an extra backslash) when he really wants to match with such a thing.
A script that takes a pathname that is meant to be a literal from the user in its variable $x would pass ":(noglob)$x" when it wants to be strict. A script that lets the user say whatever and wants to pass would just pass "$x" along the callchain.
I do not expect this to be an issue in practice, though. Have you seen a script that tries to quote all the possible globbing characters in "$x" before calling into git with the current codebase without this magic?