Re: [PATCH] t/Makefile: make sure that file names are truly platform-independent
From: Johannes Schindelin <hidden>
Date: 2016-08-16 13:13:44
Hi Peff & Junio, On Mon, 15 Aug 2016, Jeff King wrote:
On Mon, Aug 15, 2016 at 09:57:52AM -0700, Junio C Hamano wrote:quoted
I wonder if we already have a good mechanism to allow a project and its participants (say, "me") to declare "in this project, pathnames must conform to this rule" and help them avoid creating a tree that violates the rule customized to their project. I guess "write_index_as_tree()" would be one of the central places to hook into and that covers an individual contributor or a patch applier who ends up adding offending paths to the project, as well as a merge made in response to a pull request (unless it is a fast-forward) [*1*]. The pre-receive hook can also be used to inspect and reject an attempt to push an offending tree into the history.
FWIW I think it should be at a different level. See below for more details.
quoted
Such a mechanism would allow a project that wants participation by folks with case insensitive filesystems to ensure that they do not create a directory that has both xt_TCPMSS.h and xt_tcpmss.h at the same time, for example, but the mechanism needs to allow visibility into more than just a single path when the custom check is made (e.g. a hook run in "write_index_as_tree()" can see all entries in the index to make the decision; if we were to also hook into "add_to_index()", the hook must be able to see other entries in the index to which the new entry is being added).I am not convinced this mechanism needs to be built into git. Because it happens to be about filenames, git at least has a hope of making sense of the various project rules.
Both of you gentle people may recall a conversation in December 2014 when we scrambled to plug a hole where maliciously-chosen file names would have allowed to wreak havoc with a local Git repository's config (among other things). We did plug it, but not before I proposed to exclude many more file names than just maliciously-chosen ones. For example, I wanted to exclude all file names that are illegal on Windows when core.protectNTFS was set to true. If we were to implement this "let's help cross-platform projects" functionality, it would be at that same level. However, I have to agree with Junio that Git is *not* targeting *all* platforms. Conversely, any solution we implement to try to be helpful by pointing out unportable file names will certainly fall short of *some* project's requirement. Given that we have no shortage of problems to solve, I would vote for addressing portability only as far as Git and its intended target platforms are concerned. Ciao, Dscho