On Thu, 15 May 2014 02:32:32 +0800 罗勇刚(Yonggang Luo) <luoyongg...@gmail.com> wrote:
> > > I report to here because it's not a problem of msysgit, I was ask > > > git do the following things: > > > when commit newly added files, check the filename if its can be > > > used under multiple environment. > > > such as | for example is illegal under Windows. > > > > This requirement has no sense: Git can potentially work on an > > unbounded number of filesystems so there's no sensible way to > > implement such a check in Git itself. > > Another thing to consider is that if a developer knows up front that > > their code will ever be worked with on systems having only, say, > > POSIX-compliant filesystems (which only prohibit NUL and '/' in the > > pathnames of the files they store), > they might as well decide to use "|" > Cause posix is not the only things in the world, we should accept > exist of other things. Please stop thinking about POSIX. What I mean is that hard-coding a list of prohibited characters has two problems: * There might potentially exist (or come into existence at any time) filesystems which run on already existing OSes, and which have their own requirements for file names, different from those of POSIX and Windows filesystems. So the task of blacklisting characters for pathnames is principally insoluble. * Those who don't need/want to deal with the legacy crap carried over from CP/M to recent versions of Windows must not be handicapped. Please note that while I prefer POSIX approach to filesystems more than that of Windows, I think that allowing all the lower part of the ASCII chart, except NUL, to occur in them is idiotic. So it's not like I'm some soft of POSIX zealot or Windows hater. To me, all this means that the best solution to the problem is policy. If your project wants to be portable, use portable filenames; otherwise do whatever you want with them. What exactly is a "portable filename" might be decided on a project-by-project basis. On the other hand, what *might* work (and, IMO, is possibly worth bringing up with the Git devs) is some *user-configurable* knobs. Consider two imaginary Git configuration settings: * core.pathInvalidCharacters Could be assigned a string of characters to be considered invalid when checking the pathname of the destination file when an operation such as `git add` or `git mv` is run. The default value is "\000". * core.pathMaxLength Maximum length of the relative pathname (as stored in Git index). Could help cope with Windows limit of 260 characters per pathname. This won't be exactly bullet-proof (because the user is still able to check the project out under a directory having an insanely long name like "C:\Documents and Setting\Karl Marx\My Documents\My Projects \My Pet Project" but still... -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.