Skip to content

Commit 485e6f1

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 f8426a9 + 6ef20b8 commit 485e6f1

File tree

117 files changed

+15871
-227
lines changed

Some content is hidden

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

117 files changed

+15871
-227
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 & 7 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

.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
@@ -249,3 +249,4 @@ Release/
249249
/git.VC.db
250250
*.dSYM
251251
/contrib/buildsystems/out
252+
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.

Documentation/git-pack-objects.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ SYNOPSIS
1515
[--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
1616
[--cruft] [--cruft-expiration=<time>]
1717
[--stdout [--filter=<filter-spec>] | <base-name>]
18-
[--shallow] [--keep-true-parents] [--[no-]sparse] < <object-list>
18+
[--shallow] [--keep-true-parents] [--[no-]sparse]
19+
[--full-name-hash] < <object-list>
1920

2021

2122
DESCRIPTION

Documentation/git-repack.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ git-repack - Pack unpacked objects in a repository
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>] [--write-midx]
12+
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m]
13+
[--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
14+
[--write-midx] [--full-name-hash]
1315

1416
DESCRIPTION
1517
-----------

Makefile

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,11 @@ include shared.mak
471471
#
472472
# CURL_LDFLAGS=-lcurl
473473
#
474+
# Define LAZYLOAD_LIBCURL to dynamically load the libcurl; This can be useful
475+
# if Multiple libcurl versions exist (with different file names) that link to
476+
# various SSL/TLS backends, to support the `http.sslBackend` runtime switch in
477+
# such a scenario.
478+
#
474479
# === Optional library: libpcre2 ===
475480
#
476481
# Define USE_LIBPCRE if you have and want to use libpcre. Various
@@ -812,6 +817,7 @@ TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
812817
TEST_BUILTINS_OBJS += test-match-trees.o
813818
TEST_BUILTINS_OBJS += test-mergesort.o
814819
TEST_BUILTINS_OBJS += test-mktemp.o
820+
TEST_BUILTINS_OBJS += test-name-hash.o
815821
TEST_BUILTINS_OBJS += test-online-cpus.o
816822
TEST_BUILTINS_OBJS += test-pack-mtimes.o
817823
TEST_BUILTINS_OBJS += test-parse-options.o
@@ -1328,6 +1334,7 @@ BUILTIN_OBJS += builtin/write-tree.o
13281334
# upstream unnecessarily (making merging in future changes easier).
13291335
THIRD_PARTY_SOURCES += compat/inet_ntop.c
13301336
THIRD_PARTY_SOURCES += compat/inet_pton.c
1337+
THIRD_PARTY_SOURCES += compat/mimalloc/%
13311338
THIRD_PARTY_SOURCES += compat/nedmalloc/%
13321339
THIRD_PARTY_SOURCES += compat/obstack.%
13331340
THIRD_PARTY_SOURCES += compat/poll/%
@@ -1636,10 +1643,23 @@ else
16361643
CURL_LIBCURL =
16371644
endif
16381645

1639-
ifndef CURL_LDFLAGS
1640-
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1646+
ifdef LAZYLOAD_LIBCURL
1647+
LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
1648+
OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
1649+
# The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
1650+
# declared as DLL imports
1651+
CURL_CFLAGS = -DCURL_STATICLIB
1652+
ifneq ($(uname_S),MINGW)
1653+
ifneq ($(uname_S),Windows)
1654+
CURL_LIBCURL = -ldl
1655+
endif
1656+
endif
1657+
else
1658+
ifndef CURL_LDFLAGS
1659+
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1660+
endif
1661+
CURL_LIBCURL += $(CURL_LDFLAGS)
16411662
endif
1642-
CURL_LIBCURL += $(CURL_LDFLAGS)
16431663

16441664
ifndef CURL_CFLAGS
16451665
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1660,7 +1680,7 @@ else
16601680
endif
16611681
ifdef USE_CURL_FOR_IMAP_SEND
16621682
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1663-
IMAP_SEND_BUILDDEPS = http.o
1683+
IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
16641684
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
16651685
endif
16661686
ifndef NO_EXPAT
@@ -2091,6 +2111,43 @@ ifdef USE_NED_ALLOCATOR
20912111
OVERRIDE_STRDUP = YesPlease
20922112
endif
20932113

2114+
ifdef USE_MIMALLOC
2115+
MIMALLOC_OBJS = \
2116+
compat/mimalloc/alloc-aligned.o \
2117+
compat/mimalloc/alloc.o \
2118+
compat/mimalloc/arena.o \
2119+
compat/mimalloc/bitmap.o \
2120+
compat/mimalloc/heap.o \
2121+
compat/mimalloc/init.o \
2122+
compat/mimalloc/options.o \
2123+
compat/mimalloc/os.o \
2124+
compat/mimalloc/page.o \
2125+
compat/mimalloc/random.o \
2126+
compat/mimalloc/prim/windows/prim.o \
2127+
compat/mimalloc/segment.o \
2128+
compat/mimalloc/segment-cache.o \
2129+
compat/mimalloc/segment-map.o \
2130+
compat/mimalloc/stats.o
2131+
2132+
COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2133+
COMPAT_OBJS += $(MIMALLOC_OBJS)
2134+
2135+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += -DBANNED_H
2136+
2137+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2138+
-Wno-attributes \
2139+
-Wno-unknown-pragmas \
2140+
-Wno-array-bounds
2141+
2142+
ifdef DEVELOPER
2143+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2144+
-Wno-pedantic \
2145+
-Wno-declaration-after-statement \
2146+
-Wno-old-style-definition \
2147+
-Wno-missing-prototypes
2148+
endif
2149+
endif
2150+
20942151
ifdef OVERRIDE_STRDUP
20952152
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
20962153
COMPAT_OBJS += compat/strdup.o
@@ -2847,10 +2904,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
28472904
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28482905
$(IMAP_SEND_LDFLAGS) $(LIBS)
28492906

2850-
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
2907+
git-http-fetch$X: http.o http-walker.o http-fetch.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28512908
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28522909
$(CURL_LIBCURL) $(LIBS)
2853-
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
2910+
git-http-push$X: http.o http-push.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28542911
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28552912
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28562913

@@ -2860,7 +2917,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
28602917
ln -s $< $@ 2>/dev/null || \
28612918
cp $< $@
28622919

2863-
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
2920+
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
28642921
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
28652922
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
28662923

@@ -3749,12 +3806,15 @@ ifdef MSVC
37493806
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
37503807
$(RM) headless-git.o.pdb
37513808
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3809+
$(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
37523810
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
37533811
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
37543812
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3813+
$(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
37553814
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
37563815
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
37573816
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3817+
$(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
37583818
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
37593819
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
37603820
$(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)