Skip to content

Commit 177090d

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 9f5d736 + f666aac commit 177090d

Some content is hidden

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

93 files changed

+15941
-219
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@v3
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: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,11 @@ jobs:
152152
NO_PERL: 1
153153
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
154154
runs-on: windows-latest
155+
strategy:
156+
matrix:
157+
arch: [x64, arm64]
155158
concurrency:
156-
group: vs-build-${{ github.ref }}
159+
group: vs-build-${{ github.ref }}-${{ matrix.arch }}
157160
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
158161
steps:
159162
- uses: actions/checkout@v3
@@ -164,26 +167,22 @@ jobs:
164167
repository: 'microsoft/vcpkg'
165168
path: 'compat/vcbuild/vcpkg'
166169
- name: download vcpkg artifacts
167-
shell: powershell
168-
run: |
169-
$urlbase = "https://dev.azure.com/git/git/_apis/build/builds"
170-
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
171-
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl
172-
(New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip")
173-
Expand-Archive compat.zip -DestinationPath . -Force
174-
Remove-Item compat.zip
170+
uses: git-for-windows/get-azure-pipelines-artifact@v0
171+
with:
172+
repository: git/git
173+
definitionId: 9
175174
- name: add msbuild to PATH
176175
uses: microsoft/setup-msbuild@v1
177176
- name: copy dlls to root
178177
shell: cmd
179-
run: compat\vcbuild\vcpkg_copy_dlls.bat release
178+
run: compat\vcbuild\vcpkg_copy_dlls.bat release ${{ matrix.arch }}-windows
180179
- name: generate Visual Studio solution
181180
shell: bash
182181
run: |
183-
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
184-
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
182+
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows \
183+
-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 }}
185184
- name: MSBuild
186-
run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
185+
run: msbuild git.sln -property:Configuration=Release -property:Platform=${{ matrix.arch }} -maxCpuCount:4 -property:PlatformToolset=v142
187186
- name: bundle artifact tar
188187
shell: bash
189188
env:
@@ -197,7 +196,7 @@ jobs:
197196
- name: upload tracked files and build artifacts
198197
uses: actions/upload-artifact@v3
199198
with:
200-
name: vs-artifacts
199+
name: vs-artifacts-${{ matrix.arch }}
201200
path: artifacts
202201
vs-test:
203202
name: win+VS test
@@ -215,7 +214,7 @@ jobs:
215214
- name: download tracked files and build artifacts
216215
uses: actions/download-artifact@v3
217216
with:
218-
name: vs-artifacts
217+
name: vs-artifacts-x64
219218
path: ${{github.workspace}}
220219
- name: extract tracked files and build artifacts
221220
shell: bash

.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@v3
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
@@ -245,3 +245,4 @@ Release/
245245
/git.VC.db
246246
*.dSYM
247247
/contrib/buildsystems/out
248+
CMakeSettings.json

Documentation/config.txt

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

508508
include::config/sendemail.txt[]
509509

510+
include::config/sendpack.txt[]
511+
510512
include::config/sequencer.txt[]
511513

512514
include::config/showbranch.txt[]
@@ -543,4 +545,6 @@ include::config/versionsort.txt[]
543545

544546
include::config/web.txt[]
545547

548+
include::config/windows.txt[]
549+
546550
include::config/worktree.txt[]

Documentation/config/http.txt

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

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

198200
http.schannelUseSSLCAInfo::
199201
As of cURL v7.60.0, the Secure Channel backend can use the
@@ -203,6 +205,11 @@ http.schannelUseSSLCAInfo::
203205
when the `schannel` backend was configured via `http.sslBackend`,
204206
unless `http.schannelUseSSLCAInfo` overrides this behavior.
205207

208+
http.sslAutoClientCert::
209+
As of cURL v7.77.0, the Secure Channel backend won't automatically
210+
send client certificates from the Windows Certificate Store anymore.
211+
To opt in to the old behavior, http.sslAutoClientCert can be set.
212+
206213
http.pinnedPubkey::
207214
Public key of the https service. It may either be the filename of
208215
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: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,11 @@ include shared.mak
464464
#
465465
# CURL_LDFLAGS=-lcurl
466466
#
467+
# Define LAZYLOAD_LIBCURL to dynamically load the libcurl; This can be useful
468+
# if Multiple libcurl versions exist (with different file names) that link to
469+
# various SSL/TLS backends, to support the `http.sslBackend` runtime switch in
470+
# such a scenario.
471+
#
467472
# === Optional library: libpcre2 ===
468473
#
469474
# 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/%
@@ -1598,10 +1604,23 @@ else
15981604
CURL_LIBCURL =
15991605
endif
16001606

1601-
ifndef CURL_LDFLAGS
1602-
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1607+
ifdef LAZYLOAD_LIBCURL
1608+
LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
1609+
OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
1610+
# The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
1611+
# declared as DLL imports
1612+
CURL_CFLAGS = -DCURL_STATICLIB
1613+
ifneq ($(uname_S),MINGW)
1614+
ifneq ($(uname_S),Windows)
1615+
CURL_LIBCURL = -ldl
1616+
endif
1617+
endif
1618+
else
1619+
ifndef CURL_LDFLAGS
1620+
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1621+
endif
1622+
CURL_LIBCURL += $(CURL_LDFLAGS)
16031623
endif
1604-
CURL_LIBCURL += $(CURL_LDFLAGS)
16051624

16061625
ifndef CURL_CFLAGS
16071626
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1622,7 +1641,7 @@ else
16221641
endif
16231642
ifdef USE_CURL_FOR_IMAP_SEND
16241643
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1625-
IMAP_SEND_BUILDDEPS = http.o
1644+
IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
16261645
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
16271646
endif
16281647
ifndef NO_EXPAT
@@ -2053,6 +2072,41 @@ ifdef USE_NED_ALLOCATOR
20532072
OVERRIDE_STRDUP = YesPlease
20542073
endif
20552074

2075+
ifdef USE_MIMALLOC
2076+
MIMALLOC_OBJS = \
2077+
compat/mimalloc/alloc-aligned.o \
2078+
compat/mimalloc/alloc.o \
2079+
compat/mimalloc/arena.o \
2080+
compat/mimalloc/bitmap.o \
2081+
compat/mimalloc/heap.o \
2082+
compat/mimalloc/init.o \
2083+
compat/mimalloc/options.o \
2084+
compat/mimalloc/os.o \
2085+
compat/mimalloc/page.o \
2086+
compat/mimalloc/random.o \
2087+
compat/mimalloc/segment.o \
2088+
compat/mimalloc/segment-cache.o \
2089+
compat/mimalloc/stats.o
2090+
2091+
COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2092+
COMPAT_OBJS += $(MIMALLOC_OBJS)
2093+
2094+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += -DBANNED_H
2095+
2096+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2097+
-Wno-attributes \
2098+
-Wno-unknown-pragmas \
2099+
-Wno-array-bounds
2100+
2101+
ifdef DEVELOPER
2102+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2103+
-Wno-pedantic \
2104+
-Wno-declaration-after-statement \
2105+
-Wno-old-style-definition \
2106+
-Wno-missing-prototypes
2107+
endif
2108+
endif
2109+
20562110
ifdef OVERRIDE_STRDUP
20572111
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
20582112
COMPAT_OBJS += compat/strdup.o
@@ -2779,17 +2833,24 @@ compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
27792833
compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
27802834
endif
27812835

2836+
headless-git.o: compat/win32/headless.c GIT-CFLAGS
2837+
$(QUIET_CC)$(CC) $(ALL_CFLAGS) $(COMPAT_CFLAGS) \
2838+
-fno-stack-protector -o $@ -c -Wall -Wwrite-strings $<
2839+
2840+
headless-git$X: headless-git.o git.res GIT-LDFLAGS
2841+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -mwindows -o $@ $< git.res
2842+
27822843
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
27832844
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
27842845

27852846
git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
27862847
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
27872848
$(IMAP_SEND_LDFLAGS) $(LIBS)
27882849

2789-
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
2850+
git-http-fetch$X: http.o http-walker.o http-fetch.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
27902851
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
27912852
$(CURL_LIBCURL) $(LIBS)
2792-
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
2853+
git-http-push$X: http.o http-push.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
27932854
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
27942855
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
27952856

@@ -2799,7 +2860,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
27992860
ln -s $< $@ 2>/dev/null || \
28002861
cp $< $@
28012862

2802-
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
2863+
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28032864
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28042865
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28052866

@@ -3652,6 +3713,7 @@ clean: profile-clean coverage-clean cocciclean
36523713
$(RM) po/git.pot po/git-core.pot
36533714
$(RM) git.res
36543715
$(RM) $(OBJECTS)
3716+
$(RM) headless-git.o
36553717
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
36563718
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
36573719
$(RM) $(TEST_PROGRAMS)
@@ -3680,13 +3742,17 @@ endif
36803742
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
36813743
ifdef MSVC
36823744
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3745+
$(RM) headless-git.o.pdb
36833746
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3747+
$(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
36843748
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
36853749
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
36863750
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3751+
$(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
36873752
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
36883753
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
36893754
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3755+
$(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
36903756
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
36913757
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
36923758
$(RM) compat/vcbuild/MSVC-DEFS-GEN

0 commit comments

Comments
 (0)