Skip to content

Commit ea9d3da

Browse files
committed
Merge branch 'ready-for-upstream'
This is the branch thicket of patches in Git for Windows that are considered ready for upstream. To keep them in a ready-to-submit shape, they are kept as close to the beginning of the branch thicket as possible.
2 parents f8b122e + 7ca6405 commit ea9d3da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+15427
-220
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CLANG build ARM64
2+
3+
on:
4+
workflow_dispatch:
5+
6+
defaults:
7+
run:
8+
shell: bash
9+
10+
jobs:
11+
clang-build:
12+
runs-on: [Windows, ARM64]
13+
env:
14+
NO_PERL: 1
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: git-for-windows/setup-git-for-windows-sdk@v1
18+
with:
19+
flavor: makepkg-git
20+
architecture: aarch64
21+
# This assumes that the job is running on a self-hosted runner,
22+
# in which case we need to cleanup SDK files.
23+
cleanup: true
24+
- name: Build Git CLANGARM64
25+
run: make -j`nproc`

.github/workflows/main.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ jobs:
169169
NO_PERL: 1
170170
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
171171
runs-on: windows-latest
172+
strategy:
173+
matrix:
174+
arch: [x64, arm64]
172175
concurrency:
173-
group: vs-build-${{ github.ref }}
176+
group: vs-build-${{ github.ref }}-${{ matrix.arch }}
174177
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
175178
steps:
176179
- uses: actions/checkout@v4
@@ -189,14 +192,14 @@ jobs:
189192
uses: microsoft/setup-msbuild@v2
190193
- name: copy dlls to root
191194
shell: cmd
192-
run: compat\vcbuild\vcpkg_copy_dlls.bat release
195+
run: compat\vcbuild\vcpkg_copy_dlls.bat release ${{ matrix.arch }}-windows
193196
- name: generate Visual Studio solution
194197
shell: bash
195198
run: |
196-
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
197-
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
199+
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows \
200+
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON -DCMAKE_GENERATOR_PLATFORM=${{ matrix.arch }} -DVCPKG_ARCH=${{ matrix.arch }}-windows -DHOST_CPU=${{ matrix.arch }}
198201
- name: MSBuild
199-
run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
202+
run: msbuild git.sln -property:Configuration=Release -property:Platform=${{ matrix.arch }} -maxCpuCount:4 -property:PlatformToolset=v142
200203
- name: bundle artifact tar
201204
shell: bash
202205
env:
@@ -210,7 +213,7 @@ jobs:
210213
- name: upload tracked files and build artifacts
211214
uses: actions/upload-artifact@v4
212215
with:
213-
name: vs-artifacts
216+
name: vs-artifacts-${{ matrix.arch }}
214217
path: artifacts
215218
vs-test:
216219
name: win+VS test
@@ -228,7 +231,7 @@ jobs:
228231
- name: download tracked files and build artifacts
229232
uses: actions/download-artifact@v4
230233
with:
231-
name: vs-artifacts
234+
name: vs-artifacts-x64
232235
path: ${{github.workspace}}
233236
- name: extract tracked files and build artifacts
234237
shell: bash
@@ -365,12 +368,6 @@ jobs:
365368
with:
366369
name: failed-tests-${{matrix.vector.jobname}}
367370
path: ${{env.FAILED_TEST_ARTIFACTS}}
368-
- name: Upload failed tests' directories
369-
if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname == 'linux32'
370-
uses: actions/upload-artifact@v1 # cannot be upgraded because Node.js Actions aren't supported in this container
371-
with:
372-
name: failed-tests-${{matrix.vector.jobname}}
373-
path: ${{env.FAILED_TEST_ARTIFACTS}}
374371
static-analysis:
375372
needs: ci-config
376373
if: needs.ci-config.outputs.enabled == 'yes'

.github/workflows/nano-server.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Windows Nano Server tests
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
DEVELOPER: 1
8+
9+
jobs:
10+
test-nano-server:
11+
runs-on: windows-2022
12+
env:
13+
WINDBG_DIR: "C:/Program Files (x86)/Windows Kits/10/Debuggers/x64"
14+
IMAGE: mcr.microsoft.com/powershell:nanoserver-ltsc2022
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: git-for-windows/setup-git-for-windows-sdk@v1
19+
- name: build Git
20+
shell: bash
21+
run: make -j15
22+
- name: pull nanoserver image
23+
shell: bash
24+
run: docker pull $IMAGE
25+
- name: run nano-server test
26+
shell: bash
27+
run: |
28+
docker run \
29+
--user "ContainerAdministrator" \
30+
-v "$WINDBG_DIR:C:/dbg" \
31+
-v "$(cygpath -aw /mingw64/bin):C:/mingw64-bin" \
32+
-v "$(cygpath -aw .):C:/test" \
33+
$IMAGE pwsh.exe -Command '
34+
# Extend the PATH to include the `.dll` files in /mingw64/bin/
35+
$env:PATH += ";C:\mingw64-bin"
36+
37+
# For each executable to test pick some no-operation set of
38+
# flags/subcommands or something that should quickly result in an
39+
# error with known exit code that is not a negative 32-bit
40+
# number, and set the expected return code appropriately.
41+
#
42+
# Only test executables that could be expected to run in a UI
43+
# less environment.
44+
#
45+
# ( Executable path, arguments, expected return code )
46+
# also note space is required before close parenthesis (a
47+
# powershell quirk when defining nested arrays like this)
48+
49+
$executables_to_test = @(
50+
("C:\test\git.exe", "", 1 ),
51+
("C:\test\scalar.exe", "version", 0 )
52+
)
53+
54+
foreach ($executable in $executables_to_test)
55+
{
56+
Write-Output "Now testing $($executable[0])"
57+
&$executable[0] $executable[1]
58+
if ($LASTEXITCODE -ne $executable[2]) {
59+
# if we failed, run the debugger to find out what function
60+
# or DLL could not be found and then exit the script with
61+
# failure The missing DLL or EXE will be referenced near
62+
# the end of the output
63+
64+
# Set a flag to have the debugger show loader stub
65+
# diagnostics. This requires running as administrator,
66+
# otherwise the flag will be ignored.
67+
C:\dbg\gflags -i $executable[0] +SLS
68+
69+
C:\dbg\cdb.exe -c "g" -c "q" $executable[0] $executable[1]
70+
71+
exit 1
72+
}
73+
}
74+
75+
exit 0
76+
'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,4 @@ Release/
248248
/git.VC.db
249249
*.dSYM
250250
/contrib/buildsystems/out
251+
CMakeSettings.json

Documentation/config.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ include::config/safe.txt[]
518518

519519
include::config/sendemail.txt[]
520520

521+
include::config/sendpack.txt[]
522+
521523
include::config/sequencer.txt[]
522524

523525
include::config/showbranch.txt[]
@@ -554,4 +556,6 @@ include::config/versionsort.txt[]
554556

555557
include::config/web.txt[]
556558

559+
include::config/windows.txt[]
560+
557561
include::config/worktree.txt[]

Documentation/config/http.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,13 @@ http.sslBackend::
218218

219219
http.schannelCheckRevoke::
220220
Used to enforce or disable certificate revocation checks in cURL
221-
when http.sslBackend is set to "schannel". Defaults to `true` if
222-
unset. Only necessary to disable this if Git consistently errors
223-
and the message is about checking the revocation status of a
224-
certificate. This option is ignored if cURL lacks support for
225-
setting the relevant SSL option at runtime.
221+
when http.sslBackend is set to "schannel" via "true" and "false",
222+
respectively. Another accepted value is "best-effort" (the default)
223+
in which case revocation checks are performed, but errors due to
224+
revocation list distribution points that are offline are silently
225+
ignored, as well as errors due to certificates missing revocation
226+
list distribution points. This option is ignored if cURL lacks
227+
support for setting the relevant SSL option at runtime.
226228

227229
http.schannelUseSSLCAInfo::
228230
As of cURL v7.60.0, the Secure Channel backend can use the
@@ -232,6 +234,11 @@ http.schannelUseSSLCAInfo::
232234
when the `schannel` backend was configured via `http.sslBackend`,
233235
unless `http.schannelUseSSLCAInfo` overrides this behavior.
234236

237+
http.sslAutoClientCert::
238+
As of cURL v7.77.0, the Secure Channel backend won't automatically
239+
send client certificates from the Windows Certificate Store anymore.
240+
To opt in to the old behavior, http.sslAutoClientCert can be set.
241+
235242
http.pinnedPubkey::
236243
Public key of the https service. It may either be the filename of
237244
a PEM or DER encoded public key file or a string starting with

Documentation/config/sendpack.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sendpack.sideband::
2+
Allows to disable the side-band-64k capability for send-pack even
3+
when it is advertised by the server. Makes it possible to work
4+
around a limitation in the git for windows implementation together
5+
with the dump git protocol. Defaults to true.

Documentation/config/windows.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
windows.appendAtomically::
2+
By default, append atomic API is used on windows. But it works only with
3+
local disk files, if you're working on a network file system, you should
4+
set it false to turn it off.

Makefile

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,11 @@ include shared.mak
467467
#
468468
# CURL_LDFLAGS=-lcurl
469469
#
470+
# Define LAZYLOAD_LIBCURL to dynamically load the libcurl; This can be useful
471+
# if Multiple libcurl versions exist (with different file names) that link to
472+
# various SSL/TLS backends, to support the `http.sslBackend` runtime switch in
473+
# such a scenario.
474+
#
470475
# === Optional library: libpcre2 ===
471476
#
472477
# Define USE_LIBPCRE if you have and want to use libpcre. Various
@@ -1325,6 +1330,7 @@ BUILTIN_OBJS += builtin/write-tree.o
13251330
# upstream unnecessarily (making merging in future changes easier).
13261331
THIRD_PARTY_SOURCES += compat/inet_ntop.c
13271332
THIRD_PARTY_SOURCES += compat/inet_pton.c
1333+
THIRD_PARTY_SOURCES += compat/mimalloc/%
13281334
THIRD_PARTY_SOURCES += compat/nedmalloc/%
13291335
THIRD_PARTY_SOURCES += compat/obstack.%
13301336
THIRD_PARTY_SOURCES += compat/poll/%
@@ -1616,10 +1622,23 @@ else
16161622
CURL_LIBCURL =
16171623
endif
16181624

1619-
ifndef CURL_LDFLAGS
1620-
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1625+
ifdef LAZYLOAD_LIBCURL
1626+
LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
1627+
OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
1628+
# The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
1629+
# declared as DLL imports
1630+
CURL_CFLAGS = -DCURL_STATICLIB
1631+
ifneq ($(uname_S),MINGW)
1632+
ifneq ($(uname_S),Windows)
1633+
CURL_LIBCURL = -ldl
1634+
endif
1635+
endif
1636+
else
1637+
ifndef CURL_LDFLAGS
1638+
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1639+
endif
1640+
CURL_LIBCURL += $(CURL_LDFLAGS)
16211641
endif
1622-
CURL_LIBCURL += $(CURL_LDFLAGS)
16231642

16241643
ifndef CURL_CFLAGS
16251644
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1640,7 +1659,7 @@ else
16401659
endif
16411660
ifdef USE_CURL_FOR_IMAP_SEND
16421661
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1643-
IMAP_SEND_BUILDDEPS = http.o
1662+
IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
16441663
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
16451664
endif
16461665
ifndef NO_EXPAT
@@ -2071,6 +2090,43 @@ ifdef USE_NED_ALLOCATOR
20712090
OVERRIDE_STRDUP = YesPlease
20722091
endif
20732092

2093+
ifdef USE_MIMALLOC
2094+
MIMALLOC_OBJS = \
2095+
compat/mimalloc/alloc-aligned.o \
2096+
compat/mimalloc/alloc.o \
2097+
compat/mimalloc/arena.o \
2098+
compat/mimalloc/bitmap.o \
2099+
compat/mimalloc/heap.o \
2100+
compat/mimalloc/init.o \
2101+
compat/mimalloc/options.o \
2102+
compat/mimalloc/os.o \
2103+
compat/mimalloc/page.o \
2104+
compat/mimalloc/random.o \
2105+
compat/mimalloc/prim/windows/prim.o \
2106+
compat/mimalloc/segment.o \
2107+
compat/mimalloc/segment-cache.o \
2108+
compat/mimalloc/segment-map.o \
2109+
compat/mimalloc/stats.o
2110+
2111+
COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2112+
COMPAT_OBJS += $(MIMALLOC_OBJS)
2113+
2114+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += -DBANNED_H
2115+
2116+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2117+
-Wno-attributes \
2118+
-Wno-unknown-pragmas \
2119+
-Wno-array-bounds
2120+
2121+
ifdef DEVELOPER
2122+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2123+
-Wno-pedantic \
2124+
-Wno-declaration-after-statement \
2125+
-Wno-old-style-definition \
2126+
-Wno-missing-prototypes
2127+
endif
2128+
endif
2129+
20742130
ifdef OVERRIDE_STRDUP
20752131
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
20762132
COMPAT_OBJS += compat/strdup.o
@@ -2831,10 +2887,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
28312887
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28322888
$(IMAP_SEND_LDFLAGS) $(LIBS)
28332889

2834-
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
2890+
git-http-fetch$X: http.o http-walker.o http-fetch.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28352891
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28362892
$(CURL_LIBCURL) $(LIBS)
2837-
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
2893+
git-http-push$X: http.o http-push.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28382894
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28392895
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28402896

@@ -2844,7 +2900,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
28442900
ln -s $< $@ 2>/dev/null || \
28452901
cp $< $@
28462902

2847-
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
2903+
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28482904
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28492905
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28502906

@@ -3734,12 +3790,15 @@ ifdef MSVC
37343790
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
37353791
$(RM) headless-git.o.pdb
37363792
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3793+
$(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
37373794
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
37383795
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
37393796
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3797+
$(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
37403798
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
37413799
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
37423800
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3801+
$(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
37433802
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
37443803
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
37453804
$(RM) compat/vcbuild/MSVC-DEFS-GEN

abspath.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ static char *strbuf_realpath_1(struct strbuf *resolved, const char *path,
9393
goto error_out;
9494
}
9595

96+
if (platform_strbuf_realpath(resolved, path))
97+
return resolved->buf;
98+
9699
strbuf_addstr(&remaining, path);
97100
get_root_part(resolved, &remaining);
98101

0 commit comments

Comments
 (0)