Commit 7a3a4c7
mingw: respect core.longPaths when initializing a new gitdir
Use case:
Allow git to checkout a repository or submodule in a directory with a long
path when core.longpaths = true.
Example:
> ./git.exe config --global core.longpaths true
> ./git.exe clone https://github.com/git/git.git --recurse-submodules \
/c/eval/git_test/loooooooooooooooooooooooooooooooooooooooooooooooooooooooo\
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\
oooooooong
Context:
$ sh --version
GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
$ ./git.exe --version --build-options
git version 2.36.1.windows.1
cpu: x86_64
built from commit: e2ff68a
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
Error:
fatal: '$GIT_DIR' too big.
Problem analysis:
setup_explicit_git_dir in setup.c uses PATH_MAX to check if the git dir is
to long. On Windows PATH_MAX is set by limit.h to 260 and
setup_explicit_git_dir ignores core.longpaths.
Solution:
The implementation is based on the solution proposed by Johannes
Schindelin, see:
#3372 (comment)
* Refactor the part of trace2_initialize() that reads the config.
* Make tr2_sysenv_cb() a public function.
* No longer calling it from trace2_initialize(), but from a static callback
function in common-main.c.
* Calling read_very_early_config() explicitly in main(), with that static
callback function that calls into tr2_sysenv_cb().
* Extend the static callback function for Windows, and parse core.longPaths
in that function.
* Extend startup_info struct in cache.h with 'int max_long_path' so we can
use it in setup_explicit_git_dir instead of PATH_MAX.
This fixes #3372
Signed-off-by: Kevin Worm <kevin.worm_1@signify.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent 3b059de commit 7a3a4c7
4 files changed
+15
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
555 | 561 | | |
556 | 562 | | |
557 | 563 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
375 | 379 | | |
376 | 380 | | |
377 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
878 | | - | |
| 878 | + | |
879 | 879 | | |
880 | 880 | | |
881 | 881 | | |
| |||
0 commit comments