git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t/Makefile: make sure that file names are truly platform-independent

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 16, 2016, 09:53 UTC
Message-ID
<xmqqmvkddoqi.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<alpine.DEB.2.20.1608161035320.4924@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 6 quoted lines
>> > > By the way, doesn't ls-files take pathspec glob, saving one extra
>> > > process to run grep?
>> 
>> I specifically did not do that, sorry for omitting the rationale from the
>> commit message. The reason why I have that grep is so that the backslash
>> can also catch non-ASCII characters, such as "Hellö-Jüniö".

That's clever and I did miss that. It deserves an in-code comment next to the use of separate grep to prevent others from making the same mistake in the future. Having an explanation in the log message would help but not sufficient for a subtle construct like this.

The trick to catch non-ascii depends on core.quotepath set to true (which is the default). You would need to run ls-files with an explicit "-c core.quotepath=false" to be safe.

It also means that the addition of HT to the grep pattern I suggested is not necessary, because ls-files will always use "a\tb" form for a pathname with HT, and you will catch it by looking for the backslash. You can lose '"' from the grep pattern for the same reason.

Two other tricky things are
 (1) the test may be run inside a tarball extract and "git ls-files"
     may not report the pathnames in t/.
 (2) the user may not have a working Git yet in her path.

The invocation of "git -c core.quotepath=false ls-files" needs to at least have 2>/dev/null to squelch an unnecessary error message. In such a scenario, we may miss a new offending pathname, but we will not have false positive and I think that is the best we can do.

Thanks.
Previous: Johannes SchindelinNext: Junio C Hamano
Message 12 of 17 in “t/Makefile: make sure that file names are truly platform-independent”
  1. t/Makefile: make sure that file names are truly platform-independentJohannes Schindelin, Aug 15, 2016
  2. Junio C HamanoAug 15, 2016
  3. Junio C HamanoAug 15, 2016
  4. Jeff KingAug 15, 2016
  5. Johannes SchindelinAug 16, 2016
  6. Jeff KingAug 16, 2016
  7. Johannes SchindelinAug 16, 2016
  8. Jeff KingAug 16, 2016
  9. Junio C HamanoAug 15, 2016
  10. Johannes SchindelinAug 16, 2016
  11. Johannes SchindelinAug 16, 2016
  12. Junio C HamanoAug 16, 2016
  13. Junio C HamanoAug 16, 2016
  14. Johannes SchindelinAug 16, 2016
  15. Johannes SixtAug 16, 2016
  16. t/Makefile: make sure that paths can be checked out on platforms we careJohannes Schindelin, Aug 16, 2016
  17. t/Makefile: ensure that paths are valid on platforms we careJohannes Schindelin, Aug 16, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.