Skip to content

Rebase to v2.49.0-rc2 #5478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 413 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
413 commits
Select commit Hold shift + click to select a range
a0d9eba
hash-object --stdin: verify that it works with >4GB/LLP64
PhilipOakley Dec 6, 2021
dc7a0ae
hash-object: add another >4GB/LLP64 test case
PhilipOakley Dec 6, 2021
d72ac16
setup: properly use "%(prefix)/" when in WSL
derrickstolee Apr 13, 2022
4e53e83
hash-object: add a >4GB/LLP64 test case using filtered input
PhilipOakley Dec 7, 2021
a37cf6e
compat/mingw.c: do not warn when failing to get owner
derrickstolee Apr 13, 2022
7e994f9
mingw: $env:TERM="xterm-256color" for newer OSes
rkitover Apr 12, 2022
b769506
winansi: check result and Buffer before using Name
1480c1 May 28, 2022
461b256
Add config option `windows.appendAtomically`
sunzhuoshi Jan 15, 2022
7fabd87
mingw: change core.fsyncObjectFiles = 1 by default
dscho Sep 4, 2017
1d2d350
MinGW: link as terminal server aware
rimrul Jul 10, 2022
da7eb94
config.mak.uname: add support for clangarm64
dennisameling Oct 4, 2022
3fd5dff
msvc: do handle builds on Windows/ARM64
dscho Feb 25, 2025
e52c273
Fix Windows version resources
Mortein Nov 2, 2022
dd00e9b
bswap.h: add support for built-in bswap functions
dennisameling Oct 4, 2022
cba5b4b
mingw(arm64): do move the `/etc/git*` location
dscho Feb 25, 2025
e7f0009
status: fix for old-style submodules with commondir
sceptical-coder Oct 28, 2022
fd6be1d
windows: skip linking `git-<command>` for built-ins
dscho Jan 27, 2023
1dd6dc8
http: optionally load libcurl lazily
dscho May 6, 2023
dbc9b92
http: support lazy-loading libcurl also on Windows
dscho May 7, 2023
c937d81
http: when loading libcurl lazily, allow for multiple SSL backends
dscho May 7, 2023
cbd8781
windows: fix Repository>Explore Working Copy
dscho Mar 21, 2023
1300c44
mingw: do load libcurl dynamically by default
dscho May 7, 2023
a6e6c53
Add a GitHub workflow to verify that Git/Scalar work in Nano Server
dscho Nov 2, 2022
b7300e3
mingw: suggest `windows.appendAtomically` in more cases
dsl101 Jul 28, 2023
fbfeb1a
win32: use native ANSI sequence processing, if possible
dscho Nov 22, 2023
412c6b0
git.rc: include winuser.h
rimrul Dec 2, 2023
38429d9
common-main.c: fflush stdout buffer upon exit
chengzhuo5 Apr 8, 2024
07bb892
t5601/t7406(mingw): do run tests with symlink support
dscho Apr 9, 2024
ac4bc06
win32: ensure that `localtime_r()` is declared even in i686 builds
dscho May 21, 2024
ceb530a
revision: create mark_trees_uninteresting_dense()
derrickstolee Sep 6, 2024
9e0b936
pack-objects: extract should_attempt_deltas()
derrickstolee Sep 24, 2024
ff75aa0
pack-objects: add --path-walk option
derrickstolee Sep 5, 2024
26fe7cd
pack-objects: introduce GIT_TEST_PACK_PATH_WALK
derrickstolee Sep 6, 2024
d4de651
repack: add --path-walk option
derrickstolee Sep 5, 2024
aa3935a
pack-objects: enable --path-walk via config
derrickstolee Sep 5, 2024
442c147
scalar: enable path-walk during push via config
derrickstolee Sep 5, 2024
01f3d7a
pack-objects: refactor path-walk delta phase
derrickstolee Sep 18, 2024
ea98510
survey: stub in new experimental 'git-survey' command
Apr 29, 2024
e4926c1
Fallback to AppData if XDG_CONFIG_HOME is unset
ariellourenco Jul 2, 2024
24000e5
run-command: be helpful with Git LFS fails on Windows 7
dscho Jul 4, 2024
9010c8e
pack-objects: thread the path-based compression
derrickstolee Sep 18, 2024
bc957df
ci: work around a problem with HTTP/2 vs libcurl v8.10.0
dscho Sep 24, 2024
5e757f3
survey: add command line opts to select references
Apr 29, 2024
2474c18
survey: start pretty printing data in table form
derrickstolee Sep 1, 2024
da5dcd0
survey: add object count summary
derrickstolee Sep 2, 2024
2d78225
survey: summarize total sizes by object type
derrickstolee Sep 2, 2024
4727c24
survey: show progress during object walk
derrickstolee Sep 2, 2024
2504287
survey: add ability to track prioritized lists
derrickstolee Sep 2, 2024
bf0e64d
survey: add report of "largest" paths
derrickstolee Sep 2, 2024
a7084e7
survey: add --top=<N> option and config
derrickstolee Sep 23, 2024
6c5ad8b
mingw: make sure `errno` is set correctly when socket operations fail
dscho Nov 14, 2019
ca4e6a8
survey: clearly note the experimental nature in the output
dscho Jul 1, 2024
aa86f6a
compat/mingw: handle WSA errors in strerror
rimrul Dec 22, 2024
6792f63
compat/mingw: drop outdated comment
rimrul Dec 22, 2024
0627578
t0301: actually test credential-cache on Windows
rimrul Dec 29, 2024
72848f7
credential-cache: handle ECONNREFUSED gracefully
rimrul Dec 22, 2024
82276d4
mingw_open_existing: handle directories better
rimrul Jan 4, 2025
6aa67f6
Merge branch 'ci-fixes'
dscho Feb 11, 2021
e578edb
Merge 'remote-hg-prerequisites' into HEAD
dscho Jun 8, 2018
2c35e3f
Merge branch 'drive-prefix'
dscho Jun 8, 2018
9863110
Merge branch 'dont-clean-junctions'
dscho Jul 30, 2019
0bfa6ae
Merge branch 'msys2-python'
dscho May 31, 2019
0cee190
mingw: drop Windows 7-specific work-around
dscho Mar 4, 2025
789c416
Merge branch 'mimalloc-v2.0.9'
dscho Sep 8, 2022
f56ccca
Merge pull request #2375 from assarbad/reintroduce-sideband-config
dscho Oct 30, 2019
6e22132
Merge pull request #2449 from dscho/mingw-getcwd-and-symlinks
dscho Jan 3, 2020
624e3e8
Merge pull request #2488 from bmueller84/master
dscho Jan 22, 2020
a994b01
Merge pull request #2501 from jeffhostetler/clink-debug-curl
dscho Jan 30, 2020
6a89524
Merge pull request #2504 from dscho/access-repo-via-junction
dscho Feb 1, 2020
20af844
Merge pull request #2506 from dscho/issue-2283
dscho Feb 11, 2020
d36a590
Merge pull request #2535 from dscho/schannel-revoke-best-effort
dscho Mar 4, 2020
d5059ed
Merge pull request #2618 from dscho/avoid-d/f-conflict-in-vs/master
dscho May 9, 2020
dfa64ab
Merge 'add-p-many-files'
dscho Jun 8, 2018
eb460bd
Merge pull request #2730 from dscho/crlf-aware-git-add-i
dscho Jul 2, 2020
21931e0
Merge pull request #2714 from lbonanomi/crlf-scissors
dscho Jul 3, 2020
b68e112
Merge pull request #2655 from jglathe/jg/t0014_trace_extra_info
dscho Oct 9, 2020
4bd5d84
Merge 'git-gui/js/intent-to-add'
dscho Oct 18, 2020
a447615
Merge pull request #2974 from derrickstolee/maintenance-and-headless
dscho Jan 11, 2021
c157cba
cmake: install headless-git. (#4338)
dscho Mar 13, 2023
cb4b8cb
Merge pull request #2351 from PhilipOakley/vcpkg-tip
dscho Oct 7, 2019
8b328bd
Merge pull request #2915 from dennisameling/windows-arm64-support
dscho Dec 9, 2020
2de597f
Merge pull request #3327 from dennisameling/fix-host-cpu
dscho Jul 19, 2021
ec52de7
Merge pull request #3165 from dscho/increase-allowed-length-of-interp…
dscho Apr 3, 2021
0b32ca4
Merge pull request #3220 from dscho/there-is-no-vs/master-anymore
dscho May 17, 2021
9e2ca85
Merge pull request #3293 from pascalmuller/http-support-automatically…
dscho Jun 24, 2021
432a99d
Merge pull request #3349 from vdye/feature/ci-subtree-tests
dscho Aug 10, 2021
8d469ec
Merge pull request #3306 from PhilipOakley/vs-sln
dscho Oct 12, 2021
ff1e686
Merge pull request #3417 from dscho/initialize-core.symlinks-earlier
dscho Oct 13, 2021
1e2ecf3
Merge pull request #3533 from PhilipOakley/hashliteral_t
dscho Dec 15, 2021
35bbf91
Merge pull request #3791: Various fixes around `safe.directory`
derrickstolee Apr 13, 2022
5eca760
Merge pull request #3751 from rkitover/native-term
dscho Apr 21, 2022
134b65b
Merge pull request #3875 from 1480c1/wine/detect_msys_tty
dscho May 30, 2022
f16a8c1
Merge branch 'optionally-dont-append-atomically-on-windows'
dscho Jun 23, 2022
6a1c45f
Merge branch 'fsync-object-files-always'
dscho Oct 11, 2018
d54d656
Merge pull request #3942 from rimrul/mingw-tsaware
dscho Jul 27, 2022
2dfc2c2
Fix Windows version resources (#4092)
dscho Nov 3, 2022
36a53e2
Merge branch 'builtin-swap-functions'
dscho Nov 23, 2022
35fa3f7
Add support for CLANGARM64 target (#3916)
dscho Oct 28, 2022
e2a1420
Fix global repository field not being cleared (#4083)
dscho Dec 20, 2022
8a4727f
Skip linking the "dashed" `git-<command>`s for built-ins (#4252)
dscho Jan 31, 2023
366e978
Git GUI: fix Repository>Explore Working Copy (#4357)
dscho Mar 21, 2023
00e1de2
Lazy load libcurl, allowing for an SSL/TLS backend-specific libcurl (…
dscho May 15, 2023
c119a2b
Merge branch 'nano-server'
dscho Aug 7, 2023
6143ba6
Additional error checks for issuing the windows.appendAtomically warn…
dscho Aug 7, 2023
2a17d47
win32: use native ANSI sequence processing, if possible (#4700)
dscho Dec 2, 2023
12c33dd
ARM64: Embed manifest properly (#4718)
dscho Dec 7, 2023
51805e1
common-main.c: fflush stdout buffer when exit (#4901)
dscho Apr 12, 2024
4541728
Merge branch 'run-t5601-and-t7406-with-symlinks-on-windows-10'
dscho Jul 12, 2024
e6da80c
Merge branch 'Fix-i686-build-with-GCC-v14'
dscho Jul 12, 2024
11e803f
Merge branch 'Fallback-to-AppData-if-XDG-CONFIG-HOME-is-unset'
dscho Jul 12, 2024
b896376
Merge branch 'run-command-be-helpful-when-Git-LFS-fails-on-Windows-7'
dscho Jul 12, 2024
29b799b
pack-objects: create new name-hash algorithm (#5157)
dscho Sep 24, 2024
0eb81bd
Add path walk API and its use in 'git pack-objects' (#5171)
derrickstolee Sep 25, 2024
e8bf185
Add experimental 'git survey' builtin (#5174)
dscho Sep 26, 2024
eb0491d
credential-cache: handle ECONNREFUSED gracefully (#5329)
dscho Jan 1, 2025
0f7dcf9
mingw_open_existing: handle directories better (#5342)
dscho Jan 23, 2025
a697e4c
Drop support for `core.restrictInheritedHandles`, as it targeted Wind…
dscho Mar 4, 2025
01418e6
git-gui--askyesno: fix funny text wrapping
dscho Sep 20, 2017
ccade01
git-gui: provide question helper for retry fallback on Windows
hvoigt Feb 21, 2010
3537dc1
git-gui--askyesno: allow overriding the window title
dscho Sep 20, 2017
09be28b
git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
dscho Jul 23, 2010
b3b002d
git-gui--askyesno (mingw): use Git for Windows' icon, if available
dscho Sep 20, 2017
7973139
Merge 'git-gui' into HEAD
dscho Jun 7, 2018
da3e449
Merge branch 'git-gui-askyesno'
dscho Jun 8, 2018
2670086
Merge branch 'ready-for-upstream'
dscho Oct 11, 2018
687e89c
Win32: make FILETIME conversion functions public
kblees Jul 6, 2013
b065c8a
Win32: dirent.c: Move opendir down
kblees Sep 8, 2013
10aedc2
mingw: make the dirent implementation pluggable
kblees Sep 8, 2013
3ee12ed
Win32: make the lstat implementation pluggable
kblees Sep 8, 2013
15afbab
mingw: add infrastructure for read-only file system level caches
kblees Sep 8, 2013
5dcdd49
mingw: add a cache below mingw's lstat and dirent implementations
kblees Oct 1, 2013
f224832
fscache: load directories only once
kblees Jun 24, 2014
eaf83e3
fscache: add key for GIT_TRACE_FSCACHE
jeffhostetler Jan 24, 2017
70306d2
fscache: remember not-found directories
jeffhostetler Dec 13, 2016
eec3ccc
fscache: add a test for the dir-not-found optimization
dscho Jan 25, 2017
ed90bb5
add: use preload-index and fscache for performance
jeffhostetler Nov 22, 2016
26c0ce0
dir.c: make add_excludes aware of fscache during status
jeffhostetler Nov 1, 2017
b8e1a65
fscache: make fscache_enabled() public
jeffhostetler Dec 20, 2017
fb29483
dir.c: regression fix for add_excludes with fscache
jeffhostetler Dec 20, 2017
7b74947
fetch-pack.c: enable fscache for stats under .git/objects
Nov 22, 2017
cf583a8
checkout.c: enable fscache for checkout again
Jan 30, 2018
fd86e80
Enable the filesystem cache (fscache) in refresh_index().
benpeart Sep 7, 2018
8cd9936
fscache: use FindFirstFileExW to avoid retrieving the short name
benpeart Oct 23, 2018
61936c5
fscache: add GIT_TEST_FSCACHE support
benpeart Oct 4, 2018
285899f
fscache: add fscache hit statistics
benpeart Sep 25, 2018
37f6dfe
unpack-trees: enable fscache for sparse-checkout
derrickstolee Jun 12, 2019
b271a13
status: disable and free fscache at the end of the status command
benpeart Nov 1, 2018
b876541
mem_pool: add GIT_TRACE_MEMPOOL support
benpeart Oct 4, 2018
d4232b6
fscache: fscache takes an initial size
benpeart Nov 2, 2018
685bd9c
fscache: update fscache to be thread specific instead of global
benpeart Oct 4, 2018
f258d66
fscache: teach fscache to use mempool
benpeart Nov 2, 2018
ed29eea
fscache: remember the reparse tag for each entry
dscho Dec 11, 2018
c406ca8
fscache: make fscache_enable() thread safe
benpeart Nov 16, 2018
b317341
fscache: implement an FSCache-aware is_mount_point()
dscho Dec 11, 2018
526ab1a
fscache: teach fscache to use NtQueryDirectoryFile
benpeart Nov 15, 2018
3c02560
clean: make use of FSCache
dscho Dec 11, 2018
52fa403
Merge branch 'fscache'
dscho Nov 15, 2018
9a60bde
Merge pull request #1909 from benpeart/free-fscache-after-status-gfw
dscho Nov 5, 2018
8782f09
Merge remote-tracking branch 'benpeart/fscache-per-thread-gfw'
dscho Nov 16, 2018
f211a3b
Merge branch 'dont-clean-junctions-fscache'
dscho Jul 23, 2019
8b56854
pack-objects (mingw): demonstrate a segmentation fault with large deltas
vangdfang Jan 9, 2014
505ceb9
mingw: support long paths
kblees Jul 28, 2015
2e24067
strbuf_readlink: don't call readlink twice if hint is the exact link …
kblees May 11, 2015
5d5cda0
Win32: fix 'lstat("dir/")' with long paths
kblees Jul 4, 2014
e0bf95d
strbuf_readlink: support link targets that exceed PATH_MAX
kblees May 11, 2015
d6b17d1
win32(long path support): leave drive-less absolute paths intact
dscho Sep 6, 2023
0cb2520
mingw: Support `git_terminal_prompt` with more terminals
kblees Mar 19, 2015
e6228e6
lockfile.c: use is_dir_sep() instead of hardcoded '/' checks
kblees May 11, 2015
33549e8
compat/fsmonitor/fsm-*-win32: support long paths
jeffhostetler Mar 25, 2022
f7d94bc
compat/terminal.c: only use the Windows console if bash 'read -r' fails
kblees May 9, 2015
625770c
Win32: don't call GetFileAttributes twice in mingw_lstat()
kblees May 12, 2015
e4534c8
clean: suggest using `core.longPaths` if paths are too long to remove
mathstuf Apr 22, 2022
a16d7f3
mingw (git_terminal_prompt): do fall back to CONIN$/CONOUT$ method
dscho Feb 23, 2018
f88737f
Win32: implement stat() with symlink support
kblees May 15, 2015
b32eff9
Win32: remove separate do_lstat() function
kblees May 11, 2015
c3e4ddb
Win32: let mingw_lstat() error early upon problems with reparse points
kblees May 23, 2015
aec0db1
mingw: teach fscache and dirent about symlinks
kblees Jan 10, 2017
8ea6248
Win32: lstat(): return adequate stat.st_size for symlinks
kblees May 15, 2015
dba1473
Win32: factor out retry logic
kblees May 19, 2015
da08b17
Win32: change default of 'core.symlinks' to false
kblees May 23, 2015
e493bf7
Win32: add symlink-specific error codes
kblees May 15, 2015
468b5d4
Win32: mingw_unlink: support symlinks to directories
kblees May 23, 2015
a831f01
Win32: mingw_rename: support renaming symlinks
kblees May 19, 2015
12e7db5
Win32: mingw_chdir: change to symlink-resolved directory
kblees May 23, 2015
2fa3264
Win32: implement readlink()
kblees May 23, 2015
1b4cc06
mingw: lstat: compute correct size for symlinks
billziss-gh May 28, 2020
52e622d
Win32: implement basic symlink() functionality (file symlinks only)
kblees May 23, 2015
afa8cb7
Win32: symlink: add support for symlinks to directories
kblees May 23, 2015
5093624
mingw: introduce code to detect whether we're inside a Windows container
ZCube Apr 23, 2018
3b895a5
mingw: try to create symlinks without elevated permissions
dscho May 30, 2017
b453d77
mingw: when running in a Windows container, try to rename() harder
ZCube Apr 23, 2018
804727e
mingw: emulate stat() a little more faithfully
dscho Mar 2, 2020
72b99df
mingw: move the file_attr_to_st_mode() function definition
ZCube Apr 23, 2018
9d2ba10
Win32: symlink: move phantom symlink creation to a separate function
piscisaureus Oct 26, 2018
d207441
mingw: special-case index entries for symlinks with buggy size
dscho Jun 4, 2020
97f1cec
mingw: Windows Docker volumes are *not* symbolic links
dscho Apr 23, 2018
2e6f9cb
mingw: work around rename() failing on a read-only file
dsl101 Jul 28, 2023
a1e3aae
Introduce helper to create symlinks that knows about index_state
dscho Feb 11, 2019
49145fc
mingw: allow to specify the symlink type in .gitattributes
piscisaureus Oct 26, 2018
f7645c1
mingw: explicitly specify with which cmd to prefix the cmdline
dscho Jul 20, 2017
e8b98fa
Win32: symlink: add test for `symlink` attribute
piscisaureus Oct 26, 2018
33bca21
mingw: when path_lookup() failed, try BusyBox
dscho Jul 20, 2017
797f87a
test-lib: avoid unnecessary Perl invocation
dscho Aug 5, 2017
d1ce5f6
test-tool: learn to act as a drop-in replacement for `iconv`
dscho Jul 20, 2017
abeeea5
tests(mingw): if `iconv` is unavailable, use `test-helper --iconv`
dscho Jul 20, 2017
dcaab7c
gitattributes: mark .png files as binary
dscho Oct 11, 2018
64c5feb
tests: move test PNGs into t/lib-diff/
dscho Aug 5, 2017
dac85a4
tests: only override sort & find if there are usable ones in /usr/bin/
dscho Jul 17, 2017
4290814
tests: use the correct path separator with BusyBox
dscho Nov 19, 2018
c91e5d1
mingw: only use Bash-ism `builtin pwd -W` when available
dscho Jun 29, 2017
079e4ef
tests (mingw): remove Bash-specific pwd option
dscho Jun 30, 2017
d3e383b
test-lib: add BUSYBOX prerequisite
dscho Jul 19, 2017
7ad9402
t5003: use binary file from t/lib-diff/
dscho Aug 5, 2017
cbfab2a
t5532: workaround for BusyBox on Windows
dscho Jul 21, 2017
fb0fcdf
t5605: special-case hardlink test for BusyBox-w32
dscho Jul 21, 2017
af78209
t5813: allow for $PWD to be a Windows path
dscho Jul 5, 2017
1a75300
t9200: skip tests when $PWD contains a colon
dscho Jul 7, 2017
59c590e
mingw: add a Makefile target to copy test artifacts
dscho Jul 19, 2017
14ca6f6
mingw: optionally enable wsl compability file mode bits
swigger Jun 7, 2023
4443a99
mingw: kill child processes in a gentler way
dscho May 17, 2017
60a21f8
mingw: really handle SIGINT
dscho Apr 22, 2018
3188788
mingw: do not call xutftowcs_path in mingw_mktemp
neerajsi-msft Oct 27, 2021
37059ad
Partially un-revert "editor: save and reset terminal after calling ED…
dscho Nov 25, 2021
ece8847
reset: reinstate support for the deprecated --stdin option
dscho Dec 10, 2019
66978e3
Describe Git for Windows' architecture [no ci]
dscho Feb 13, 2023
2b6eed6
Add a GitHub workflow to monitor component updates
dscho Sep 29, 2020
8a0b66a
Modify the Code of Conduct for Git for Windows
dscho Oct 11, 2019
783beaf
Merge branch 'gitk-and-git-gui-patches'
dscho Oct 11, 2018
93b924e
fsmonitor: reintroduce core.useBuiltinFSMonitor
vdye Apr 4, 2022
d2f3bcf
dependabot: help keeping GitHub Actions versions up to date
dscho Feb 6, 2024
4e9a794
CONTRIBUTING.md: add guide for first-time contributors
derrickstolee Mar 1, 2018
2ead0ee
Merge branch 'long-paths'
dscho Nov 15, 2018
be643e1
Merge branch 'msys2'
dscho Nov 15, 2018
1e0931d
Merge branch 'kblees/kb/symlinks'
dscho Nov 15, 2018
21d73d3
Merge 'docker-volumes-are-no-symlinks'
dscho Oct 12, 2018
eed76ee
mingw: try resetting the read-only bit if rename fails (#4527)
dscho Aug 7, 2023
112f26b
Merge pull request #1897 from piscisaureus/symlink-attr
dscho Oct 31, 2018
7409e9b
Merge branch 'busybox-w32'
dscho Feb 7, 2019
af9dfb6
Merge branch 'wsl-file-mode-bits'
dscho Aug 7, 2023
adb63a2
Merge pull request #1170 from dscho/mingw-kill-process
dscho Oct 11, 2018
da88a28
Merge pull request #3492 from dscho/ns/batched-fsync
vdye Oct 28, 2021
9b2e5a9
Merge branch 'un-revert-editor-save-and-reset'
dscho Jan 15, 2022
5332fc4
Merge branch 'phase-out-reset-stdin'
dscho Jun 8, 2018
5662725
Merge branch 'deprecate-core.useBuiltinFSMonitor'
dscho Jan 24, 2023
7b887c1
Merge pull request #2837 from dscho/monitor-component-updates
dscho Oct 7, 2020
bd5a661
README.md: Add a Windows-specific preamble
dscho Jan 10, 2014
6aee99a
Add an issue template
shiftkey Feb 18, 2016
ce03085
Modify the GitHub Pull Request template (to reflect Git for Windows)
Dec 22, 2017
280cbf2
SECURITY.md: document Git for Windows' policies
dscho Aug 23, 2019
1b2030c
Merge 'readme' into HEAD
dscho Jun 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
http: support lazy-loading libcurl also on Windows
This implements the Windows-specific support code, because everything is
slightly different on Windows, even loading shared libraries.

Note: I specifically do _not_ use the code from
`compat/win32/lazyload.h` here because that code is optimized for
loading individual functions from various system DLLs, while we
specifically want to load _many_ functions from _one_ DLL here, and
distinctly not a system DLL (we expect libcurl to be located outside
`C:\Windows\system32`, something `INIT_PROC_ADDR` refuses to work with).
Also, the `curl_easy_getinfo()`/`curl_easy_setopt()` functions are
declared as vararg functions, which `lazyload.h` cannot handle. Finally,
we are about to optionally override the exact file name that is to be
loaded, which is a goal contrary to `lazyload.h`'s design.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Mar 11, 2025
commit dbc9b922faaffaef2e66fb0fca13f5679adc1445
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,11 @@ else
# The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
# declared as DLL imports
CURL_CFLAGS = -DCURL_STATICLIB
ifneq ($(uname_S),MINGW)
ifneq ($(uname_S),Windows)
CURL_LIBCURL = -ldl
endif
endif
else
ifndef CURL_LDFLAGS
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
Expand Down
52 changes: 52 additions & 0 deletions compat/lazyload-curl.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "../git-compat-util.h"
#include "../git-curl-compat.h"
#ifndef WIN32
#include <dlfcn.h>
#endif

/*
* The ABI version of libcurl is encoded in its shared libraries' file names.
Expand All @@ -11,6 +13,7 @@

typedef void (*func_t)(void);

#ifndef WIN32
#ifdef __APPLE__
#define LIBCURL_FILE_NAME(base) base "." LIBCURL_ABI_VERSION ".dylib"
#else
Expand All @@ -35,6 +38,55 @@ static func_t load_function(void *handle, const char *name)
*(void **)&f = dlsym(handle, name);
return f;
}
#else
#define LIBCURL_FILE_NAME(base) base "-" LIBCURL_ABI_VERSION ".dll"

static void *load_library(const char *name)
{
size_t name_size = strlen(name) + 1;
const char *path = getenv("PATH");
char dll_path[MAX_PATH];

while (path && *path) {
const char *sep = strchrnul(path, ';');
size_t len = sep - path;

if (len && len + name_size < sizeof(dll_path)) {
memcpy(dll_path, path, len);
dll_path[len] = '/';
memcpy(dll_path + len + 1, name, name_size);

if (!access(dll_path, R_OK)) {
wchar_t wpath[MAX_PATH];
int wlen = MultiByteToWideChar(CP_UTF8, 0, dll_path, -1, wpath, ARRAY_SIZE(wpath));
void *res = wlen ? (void *)LoadLibraryExW(wpath, NULL, 0) : NULL;
if (!res) {
DWORD err = GetLastError();
char buf[1024];

if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ARGUMENT_ARRAY |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, LANG_NEUTRAL,
buf, sizeof(buf) - 1, NULL))
xsnprintf(buf, sizeof(buf), "last error: %ld", err);
error("LoadLibraryExW() failed with: %s", buf);
}
return res;
}
}

path = *sep ? sep + 1 : NULL;
}

return NULL;
}

static func_t load_function(void *handle, const char *name)
{
return (func_t)GetProcAddress((HANDLE)handle, name);
}
#endif

typedef struct curl_version_info_data *(*curl_version_info_type)(CURLversion version);
static curl_version_info_type curl_version_info_func;
Expand Down