Skip to content

Commit

Permalink
Merge branch 'ready-for-upstream'
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Jun 6, 2024
2 parents bacbd2e + 47476d0 commit 870c339
Show file tree
Hide file tree
Showing 93 changed files with 15,172 additions and 219 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/clangarm64-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CLANG build ARM64

on:
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
clang-build:
runs-on: [Windows, ARM64]
env:
NO_PERL: 1
steps:
- uses: actions/checkout@v4
- uses: git-for-windows/setup-git-for-windows-sdk@v1
with:
flavor: makepkg-git
architecture: aarch64
# This assumes that the job is running on a self-hosted runner,
# in which case we need to cleanup SDK files.
cleanup: true
- name: Build Git CLANGARM64
run: make -j`nproc`
31 changes: 15 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ jobs:
NO_PERL: 1
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
runs-on: windows-latest
strategy:
matrix:
arch: [x64, arm64]
concurrency:
group: vs-build-${{ github.ref }}
group: vs-build-${{ github.ref }}-${{ matrix.arch }}
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: actions/checkout@v4
Expand All @@ -181,26 +184,22 @@ jobs:
repository: 'microsoft/vcpkg'
path: 'compat/vcbuild/vcpkg'
- name: download vcpkg artifacts
shell: powershell
run: |
$urlbase = "https://dev.azure.com/git/git/_apis/build/builds"
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl
(New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip")
Expand-Archive compat.zip -DestinationPath . -Force
Remove-Item compat.zip
uses: git-for-windows/get-azure-pipelines-artifact@v0
with:
repository: git/git
definitionId: 9
- name: add msbuild to PATH
uses: microsoft/setup-msbuild@v1
uses: microsoft/setup-msbuild@v2
- name: copy dlls to root
shell: cmd
run: compat\vcbuild\vcpkg_copy_dlls.bat release
run: compat\vcbuild\vcpkg_copy_dlls.bat release ${{ matrix.arch }}-windows
- name: generate Visual Studio solution
shell: bash
run: |
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows \
-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 }}
- name: MSBuild
run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
run: msbuild git.sln -property:Configuration=Release -property:Platform=${{ matrix.arch }} -maxCpuCount:4 -property:PlatformToolset=v142
- name: bundle artifact tar
shell: bash
env:
Expand All @@ -214,7 +213,7 @@ jobs:
- name: upload tracked files and build artifacts
uses: actions/upload-artifact@v4
with:
name: vs-artifacts
name: vs-artifacts-${{ matrix.arch }}
path: artifacts
vs-test:
name: win+VS test
Expand All @@ -232,7 +231,7 @@ jobs:
- name: download tracked files and build artifacts
uses: actions/download-artifact@v4
with:
name: vs-artifacts
name: vs-artifacts-x64
path: ${{github.workspace}}
- name: extract tracked files and build artifacts
shell: bash
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/nano-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Windows Nano Server tests

on:
workflow_dispatch:

env:
DEVELOPER: 1

jobs:
test-nano-server:
runs-on: windows-2022
env:
WINDBG_DIR: "C:/Program Files (x86)/Windows Kits/10/Debuggers/x64"
IMAGE: mcr.microsoft.com/powershell:nanoserver-ltsc2022

steps:
- uses: actions/checkout@v4
- uses: git-for-windows/setup-git-for-windows-sdk@v1
- name: build Git
shell: bash
run: make -j15
- name: pull nanoserver image
shell: bash
run: docker pull $IMAGE
- name: run nano-server test
shell: bash
run: |
docker run \
--user "ContainerAdministrator" \
-v "$WINDBG_DIR:C:/dbg" \
-v "$(cygpath -aw /mingw64/bin):C:/mingw64-bin" \
-v "$(cygpath -aw .):C:/test" \
$IMAGE pwsh.exe -Command '
# Extend the PATH to include the `.dll` files in /mingw64/bin/
$env:PATH += ";C:\mingw64-bin"
# For each executable to test pick some no-operation set of
# flags/subcommands or something that should quickly result in an
# error with known exit code that is not a negative 32-bit
# number, and set the expected return code appropriately.
#
# Only test executables that could be expected to run in a UI
# less environment.
#
# ( Executable path, arguments, expected return code )
# also note space is required before close parenthesis (a
# powershell quirk when defining nested arrays like this)
$executables_to_test = @(
("C:\test\git.exe", "", 1 ),
("C:\test\scalar.exe", "version", 0 )
)
foreach ($executable in $executables_to_test)
{
Write-Output "Now testing $($executable[0])"
&$executable[0] $executable[1]
if ($LASTEXITCODE -ne $executable[2]) {
# if we failed, run the debugger to find out what function
# or DLL could not be found and then exit the script with
# failure The missing DLL or EXE will be referenced near
# the end of the output
# Set a flag to have the debugger show loader stub
# diagnostics. This requires running as administrator,
# otherwise the flag will be ignored.
C:\dbg\gflags -i $executable[0] +SLS
C:\dbg\cdb.exe -c "g" -c "q" $executable[0] $executable[1]
exit 1
}
}
exit 0
'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,4 @@ Release/
/git.VC.db
*.dSYM
/contrib/buildsystems/out
CMakeSettings.json
4 changes: 4 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ include::config/safe.txt[]

include::config/sendemail.txt[]

include::config/sendpack.txt[]

include::config/sequencer.txt[]

include::config/showbranch.txt[]
Expand Down Expand Up @@ -564,4 +566,6 @@ include::config/versionsort.txt[]

include::config/web.txt[]

include::config/windows.txt[]

include::config/worktree.txt[]
17 changes: 12 additions & 5 deletions Documentation/config/http.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,13 @@ http.sslBackend::

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

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

http.sslAutoClientCert::
As of cURL v7.77.0, the Secure Channel backend won't automatically
send client certificates from the Windows Certificate Store anymore.
To opt in to the old behavior, http.sslAutoClientCert can be set.

http.pinnedPubkey::
Public key of the https service. It may either be the filename of
a PEM or DER encoded public key file or a string starting with
Expand Down
5 changes: 5 additions & 0 deletions Documentation/config/sendpack.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sendpack.sideband::
Allows to disable the side-band-64k capability for send-pack even
when it is advertised by the server. Makes it possible to work
around a limitation in the git for windows implementation together
with the dump git protocol. Defaults to true.
4 changes: 4 additions & 0 deletions Documentation/config/windows.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
windows.appendAtomically::
By default, append atomic API is used on windows. But it works only with
local disk files, if you're working on a network file system, you should
set it false to turn it off.
73 changes: 66 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,11 @@ include shared.mak
#
# CURL_LDFLAGS=-lcurl
#
# Define LAZYLOAD_LIBCURL to dynamically load the libcurl; This can be useful
# if Multiple libcurl versions exist (with different file names) that link to
# various SSL/TLS backends, to support the `http.sslBackend` runtime switch in
# such a scenario.
#
# === Optional library: libpcre2 ===
#
# Define USE_LIBPCRE if you have and want to use libpcre. Various
Expand Down Expand Up @@ -1329,6 +1334,7 @@ BUILTIN_OBJS += builtin/write-tree.o
# upstream unnecessarily (making merging in future changes easier).
THIRD_PARTY_SOURCES += compat/inet_ntop.c
THIRD_PARTY_SOURCES += compat/inet_pton.c
THIRD_PARTY_SOURCES += compat/mimalloc/%
THIRD_PARTY_SOURCES += compat/nedmalloc/%
THIRD_PARTY_SOURCES += compat/obstack.%
THIRD_PARTY_SOURCES += compat/poll/%
Expand Down Expand Up @@ -1617,10 +1623,23 @@ else
CURL_LIBCURL =
endif

ifndef CURL_LDFLAGS
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
ifdef LAZYLOAD_LIBCURL
LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
# The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
# declared as DLL imports
CURL_CFLAGS = -DCURL_STATICLIB
ifneq ($(uname_S),MINGW)
ifneq ($(uname_S),Windows)
CURL_LIBCURL = -ldl
endif
endif
else
ifndef CURL_LDFLAGS
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
endif
CURL_LIBCURL += $(CURL_LDFLAGS)
endif
CURL_LIBCURL += $(CURL_LDFLAGS)

ifndef CURL_CFLAGS
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
Expand All @@ -1641,7 +1660,7 @@ else
endif
ifdef USE_CURL_FOR_IMAP_SEND
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
IMAP_SEND_BUILDDEPS = http.o
IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
endif
ifndef NO_EXPAT
Expand Down Expand Up @@ -2072,6 +2091,43 @@ ifdef USE_NED_ALLOCATOR
OVERRIDE_STRDUP = YesPlease
endif

ifdef USE_MIMALLOC
MIMALLOC_OBJS = \
compat/mimalloc/alloc-aligned.o \
compat/mimalloc/alloc.o \
compat/mimalloc/arena.o \
compat/mimalloc/bitmap.o \
compat/mimalloc/heap.o \
compat/mimalloc/init.o \
compat/mimalloc/options.o \
compat/mimalloc/os.o \
compat/mimalloc/page.o \
compat/mimalloc/random.o \
compat/mimalloc/prim/windows/prim.o \
compat/mimalloc/segment.o \
compat/mimalloc/segment-cache.o \
compat/mimalloc/segment-map.o \
compat/mimalloc/stats.o

COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
COMPAT_OBJS += $(MIMALLOC_OBJS)

$(MIMALLOC_OBJS): COMPAT_CFLAGS += -DBANNED_H

$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
-Wno-attributes \
-Wno-unknown-pragmas \
-Wno-array-bounds

ifdef DEVELOPER
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
-Wno-pedantic \
-Wno-declaration-after-statement \
-Wno-old-style-definition \
-Wno-missing-prototypes
endif
endif

ifdef OVERRIDE_STRDUP
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
COMPAT_OBJS += compat/strdup.o
Expand Down Expand Up @@ -2833,10 +2889,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(IMAP_SEND_LDFLAGS) $(LIBS)

git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
git-http-fetch$X: http.o http-walker.o http-fetch.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(CURL_LIBCURL) $(LIBS)
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
git-http-push$X: http.o http-push.o $(LAZYLOAD_LIBCURL_OBJ) GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)

Expand All @@ -2846,7 +2902,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
ln -s $< $@ 2>/dev/null || \
cp $< $@

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

Expand Down Expand Up @@ -3736,12 +3792,15 @@ ifdef MSVC
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
$(RM) headless-git.o.pdb
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
$(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
$(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
$(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
$(RM) compat/vcbuild/MSVC-DEFS-GEN
Expand Down
3 changes: 3 additions & 0 deletions abspath.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ static char *strbuf_realpath_1(struct strbuf *resolved, const char *path,
goto error_out;
}

if (platform_strbuf_realpath(resolved, path))
return resolved->buf;

strbuf_addstr(&remaining, path);
get_root_part(resolved, &remaining);

Expand Down
Loading

0 comments on commit 870c339

Please sign in to comment.