Skip to content

Commit 4816787

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 1a94001 + cf4f9dc commit 4816787

Some content is hidden

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

90 files changed

+15817
-216
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
@@ -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@v3
@@ -181,26 +184,22 @@ jobs:
181184
repository: 'microsoft/vcpkg'
182185
path: 'compat/vcbuild/vcpkg'
183186
- name: download vcpkg artifacts
184-
shell: powershell
185-
run: |
186-
$urlbase = "https://dev.azure.com/git/git/_apis/build/builds"
187-
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
188-
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl
189-
(New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip")
190-
Expand-Archive compat.zip -DestinationPath . -Force
191-
Remove-Item compat.zip
187+
uses: git-for-windows/get-azure-pipelines-artifact@v0
188+
with:
189+
repository: git/git
190+
definitionId: 9
192191
- name: add msbuild to PATH
193192
uses: microsoft/setup-msbuild@v1
194193
- name: copy dlls to root
195194
shell: cmd
196-
run: compat\vcbuild\vcpkg_copy_dlls.bat release
195+
run: compat\vcbuild\vcpkg_copy_dlls.bat release ${{ matrix.arch }}-windows
197196
- name: generate Visual Studio solution
198197
shell: bash
199198
run: |
200-
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
201-
-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 }}
202201
- name: MSBuild
203-
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
204203
- name: bundle artifact tar
205204
shell: bash
206205
env:
@@ -214,7 +213,7 @@ jobs:
214213
- name: upload tracked files and build artifacts
215214
uses: actions/upload-artifact@v3
216215
with:
217-
name: vs-artifacts
216+
name: vs-artifacts-${{ matrix.arch }}
218217
path: artifacts
219218
vs-test:
220219
name: win+VS test
@@ -232,7 +231,7 @@ jobs:
232231
- name: download tracked files and build artifacts
233232
uses: actions/download-artifact@v3
234233
with:
235-
name: vs-artifacts
234+
name: vs-artifacts-x64
236235
path: ${{github.workspace}}
237236
- name: extract tracked files and build artifacts
238237
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
@@ -247,3 +247,4 @@ Release/
247247
/git.VC.db
248248
*.dSYM
249249
/contrib/buildsystems/out
250+
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: 64 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
@@ -1327,6 +1332,7 @@ BUILTIN_OBJS += builtin/write-tree.o
13271332
# upstream unnecessarily (making merging in future changes easier).
13281333
THIRD_PARTY_SOURCES += compat/inet_ntop.c
13291334
THIRD_PARTY_SOURCES += compat/inet_pton.c
1335+
THIRD_PARTY_SOURCES += compat/mimalloc/%
13301336
THIRD_PARTY_SOURCES += compat/nedmalloc/%
13311337
THIRD_PARTY_SOURCES += compat/obstack.%
13321338
THIRD_PARTY_SOURCES += compat/poll/%
@@ -1606,10 +1612,23 @@ else
16061612
CURL_LIBCURL =
16071613
endif
16081614

1609-
ifndef CURL_LDFLAGS
1610-
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1615+
ifdef LAZYLOAD_LIBCURL
1616+
LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
1617+
OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
1618+
# The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
1619+
# declared as DLL imports
1620+
CURL_CFLAGS = -DCURL_STATICLIB
1621+
ifneq ($(uname_S),MINGW)
1622+
ifneq ($(uname_S),Windows)
1623+
CURL_LIBCURL = -ldl
1624+
endif
1625+
endif
1626+
else
1627+
ifndef CURL_LDFLAGS
1628+
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1629+
endif
1630+
CURL_LIBCURL += $(CURL_LDFLAGS)
16111631
endif
1612-
CURL_LIBCURL += $(CURL_LDFLAGS)
16131632

16141633
ifndef CURL_CFLAGS
16151634
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1630,7 +1649,7 @@ else
16301649
endif
16311650
ifdef USE_CURL_FOR_IMAP_SEND
16321651
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1633-
IMAP_SEND_BUILDDEPS = http.o
1652+
IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
16341653
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
16351654
endif
16361655
ifndef NO_EXPAT
@@ -2061,6 +2080,41 @@ ifdef USE_NED_ALLOCATOR
20612080
OVERRIDE_STRDUP = YesPlease
20622081
endif
20632082

2083+
ifdef USE_MIMALLOC
2084+
MIMALLOC_OBJS = \
2085+
compat/mimalloc/alloc-aligned.o \
2086+
compat/mimalloc/alloc.o \
2087+
compat/mimalloc/arena.o \
2088+
compat/mimalloc/bitmap.o \
2089+
compat/mimalloc/heap.o \
2090+
compat/mimalloc/init.o \
2091+
compat/mimalloc/options.o \
2092+
compat/mimalloc/os.o \
2093+
compat/mimalloc/page.o \
2094+
compat/mimalloc/random.o \
2095+
compat/mimalloc/segment.o \
2096+
compat/mimalloc/segment-cache.o \
2097+
compat/mimalloc/stats.o
2098+
2099+
COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2100+
COMPAT_OBJS += $(MIMALLOC_OBJS)
2101+
2102+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += -DBANNED_H
2103+
2104+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2105+
-Wno-attributes \
2106+
-Wno-unknown-pragmas \
2107+
-Wno-array-bounds
2108+
2109+
ifdef DEVELOPER
2110+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2111+
-Wno-pedantic \
2112+
-Wno-declaration-after-statement \
2113+
-Wno-old-style-definition \
2114+
-Wno-missing-prototypes
2115+
endif
2116+
endif
2117+
20642118
ifdef OVERRIDE_STRDUP
20652119
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
20662120
COMPAT_OBJS += compat/strdup.o
@@ -2802,10 +2856,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
28022856
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28032857
$(IMAP_SEND_LDFLAGS) $(LIBS)
28042858

2805-
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
2859+
git-http-fetch$X: http.o http-walker.o http-fetch.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28062860
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28072861
$(CURL_LIBCURL) $(LIBS)
2808-
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
2862+
git-http-push$X: http.o http-push.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28092863
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28102864
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28112865

@@ -2815,7 +2869,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
28152869
ln -s $< $@ 2>/dev/null || \
28162870
cp $< $@
28172871

2818-
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
2872+
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28192873
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28202874
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28212875

@@ -3705,12 +3759,15 @@ ifdef MSVC
37053759
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
37063760
$(RM) headless-git.o.pdb
37073761
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3762+
$(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
37083763
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
37093764
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
37103765
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3766+
$(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
37113767
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
37123768
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
37133769
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3770+
$(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
37143771
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
37153772
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
37163773
$(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)