I've recently looked into how core.longpaths
Git options works and how it's related to Enable Win32 long paths Windows option. Turns out they are not related, and longpaths is both clever and hacky.
Many Windows wide char APIs support longer than MAX_PATH
paths through the
file namespace prefix (\\?\
or \\?\UNC\
) followed by an absolute path. When long paths support is enabled via 'core.longpaths' option, handle_long_path function expands long paths using the '\?' file namespace prefix. See this commit message for detailed explantion.