I have a directory that is tracked by git
on linux and I copied it to mac OS. On git status
multiple files are untracked because of a filename: File name too long
error. One filename (with its relative path) is 393 characters. Isn't there a limit 4096 characters (except on Windows)? [Reference] My core.longpaths
setting is set to true. (Also so is core.precomposeunicode
set to true, but probably irrelevant). Any advice?
OS X has NAME_MAX
(bytes in a path name component) set to 255:
$ grep NAME_MAX /usr/include/sys/syslimits.h
#define NAME_MAX 255 /* max bytes in a file name */
#define CHARCLASS_NAME_MAX 14 /* max character class name size */
Is that 393 byte name a single component, or the entire path? (Example: "foo/bar/baz"
has 3 components that are each 3 bytes, and the entire path is 11 or 12 bytes depending on whether you count the terminating '\0'
. The NAME_MAX
constant here does not count a terminating '\0'
.)