Skip to content

Commit 615e0b3

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 97dde63 + cfa900e commit 615e0b3

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

+15161
-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@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: 15 additions & 16 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
@@ -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
193-
uses: microsoft/setup-msbuild@v1
192+
uses: microsoft/setup-msbuild@v2
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@v4
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@v4
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@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
@@ -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
@@ -511,6 +511,8 @@ include::config/safe.txt[]
511511

512512
include::config/sendemail.txt[]
513513

514+
include::config/sendpack.txt[]
515+
514516
include::config/sequencer.txt[]
515517

516518
include::config/showbranch.txt[]
@@ -547,4 +549,6 @@ include::config/versionsort.txt[]
547549

548550
include::config/web.txt[]
549551

552+
include::config/windows.txt[]
553+
550554
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: 66 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
@@ -1340,6 +1345,7 @@ BUILTIN_OBJS += builtin/write-tree.o
13401345
# upstream unnecessarily (making merging in future changes easier).
13411346
THIRD_PARTY_SOURCES += compat/inet_ntop.c
13421347
THIRD_PARTY_SOURCES += compat/inet_pton.c
1348+
THIRD_PARTY_SOURCES += compat/mimalloc/%
13431349
THIRD_PARTY_SOURCES += compat/nedmalloc/%
13441350
THIRD_PARTY_SOURCES += compat/obstack.%
13451351
THIRD_PARTY_SOURCES += compat/poll/%
@@ -1622,10 +1628,23 @@ else
16221628
CURL_LIBCURL =
16231629
endif
16241630

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

16301649
ifndef CURL_CFLAGS
16311650
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1646,7 +1665,7 @@ else
16461665
endif
16471666
ifdef USE_CURL_FOR_IMAP_SEND
16481667
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1649-
IMAP_SEND_BUILDDEPS = http.o
1668+
IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
16501669
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
16511670
endif
16521671
ifndef NO_EXPAT
@@ -2077,6 +2096,43 @@ ifdef USE_NED_ALLOCATOR
20772096
OVERRIDE_STRDUP = YesPlease
20782097
endif
20792098

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

2821-
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
2877+
git-http-fetch$X: http.o http-walker.o http-fetch.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28222878
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28232879
$(CURL_LIBCURL) $(LIBS)
2824-
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
2880+
git-http-push$X: http.o http-push.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28252881
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28262882
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28272883

@@ -2831,7 +2887,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
28312887
ln -s $< $@ 2>/dev/null || \
28322888
cp $< $@
28332889

2834-
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
2890+
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28352891
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28362892
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28372893

@@ -3721,12 +3777,15 @@ ifdef MSVC
37213777
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
37223778
$(RM) headless-git.o.pdb
37233779
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3780+
$(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
37243781
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
37253782
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
37263783
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3784+
$(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
37273785
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
37283786
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
37293787
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3788+
$(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
37303789
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
37313790
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
37323791
$(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)