mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-03 23:21:36 -05:00
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.
This commit is contained in:
514
.github/workflows/git-artifacts.yml
vendored
Normal file
514
.github/workflows/git-artifacts.yml
vendored
Normal file
@@ -0,0 +1,514 @@
|
||||
name: git-artifacts
|
||||
|
||||
on:
|
||||
# This workflow can be triggered manually in the Actions tab, see
|
||||
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_only:
|
||||
description: 'Optionally restrict what artifacts to build'
|
||||
required: false
|
||||
ref:
|
||||
description: 'Optionally override which branch to build'
|
||||
required: false
|
||||
repository:
|
||||
description: 'Optionally override from where to fetch the specified ref'
|
||||
required: false
|
||||
|
||||
env:
|
||||
GPG_OPTIONS: "--batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
|
||||
HOME: "${{github.workspace}}\\home"
|
||||
MSYSTEM: MINGW64
|
||||
USERPROFILE: "${{github.workspace}}\\home"
|
||||
BUILD_ONLY: "${{github.event.inputs.build_only}}"
|
||||
REPOSITORY: "${{github.event.inputs.repository}}"
|
||||
REF: "${{github.event.inputs.ref}}"
|
||||
|
||||
jobs:
|
||||
bundle-artifacts:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Configure user
|
||||
shell: bash
|
||||
run:
|
||||
USER_NAME="${{github.actor}}" &&
|
||||
USER_EMAIL="${{github.actor}}@users.noreply.github.com" &&
|
||||
mkdir "$HOME" &&
|
||||
git config --global user.name "$USER_NAME" &&
|
||||
git config --global user.email "$USER_EMAIL" &&
|
||||
echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >>$GITHUB_ENV
|
||||
- uses: git-for-windows/setup-git-for-windows-sdk@v1
|
||||
with:
|
||||
flavor: build-installers
|
||||
- name: Clone build-extra
|
||||
shell: bash
|
||||
run: |
|
||||
d=/usr/src/build-extra &&
|
||||
if test ! -d $d/.git
|
||||
then
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
|
||||
else
|
||||
git -C $d fetch https://github.com/git-for-windows/build-extra main &&
|
||||
git -C $d switch -C main FETCH_HEAD
|
||||
fi
|
||||
- name: Prepare home directory for GPG signing
|
||||
if: env.GPGKEY != ''
|
||||
shell: bash
|
||||
run: |
|
||||
echo '${{secrets.PRIVGPGKEY}}' | tr % '\n' | gpg $GPG_OPTIONS --import &&
|
||||
mkdir -p home &&
|
||||
git config --global gpg.program "/usr/src/build-extra/gnupg-with-gpgkey.sh" &&
|
||||
info="$(gpg --list-keys --with-colons "${GPGKEY%% *}" | cut -d : -f 1,10 | sed -n '/^uid/{s|uid:||p;q}')" &&
|
||||
git config --global user.name "${info% <*}" &&
|
||||
git config --global user.email "<${info#*<}"
|
||||
env:
|
||||
GPGKEY: ${{secrets.GPGKEY}}
|
||||
- name: Generate bundle artifacts
|
||||
env:
|
||||
GPGKEY: ${{secrets.GPGKEY}}
|
||||
shell: bash
|
||||
run: |
|
||||
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git &&
|
||||
mkdir -p bundle-artifacts &&
|
||||
|
||||
{ test -n "$REPOSITORY" || REPOSITORY='${{github.repository}}'; } &&
|
||||
{ test -n "$REF" || REF='${{github.ref}}'; } &&
|
||||
git -c init.defaultBranch=main init --bare &&
|
||||
git remote add -f origin https://github.com/git-for-windows/git &&
|
||||
git fetch "https://github.com/$REPOSITORY" "$REF:$REF" &&
|
||||
|
||||
tag_name="$(git describe --match 'v[0-9]*' FETCH_HEAD)-$(date +%Y%m%d%H%M%S)" &&
|
||||
echo "prerelease-${tag_name#v}" >bundle-artifacts/ver &&
|
||||
echo "${tag_name#v}" >bundle-artifacts/display_version &&
|
||||
echo "$tag_name" >bundle-artifacts/next_version &&
|
||||
git tag $(test -z "$GPGKEY" || echo " -s") -m "Snapshot build" "$tag_name" FETCH_HEAD &&
|
||||
git bundle create bundle-artifacts/git.bundle origin/main.."$tag_name" &&
|
||||
|
||||
sh -x /usr/src/build-extra/please.sh mention feature "Snapshot of $(git show -s --pretty='tformat:%h (%s, %ad)' --date=short FETCH_HEAD)" &&
|
||||
git -C /usr/src/build-extra bundle create "$PWD/bundle-artifacts/build-extra.bundle" origin/main..main
|
||||
- name: Clean up temporary files
|
||||
if: always()
|
||||
shell: bash
|
||||
run: rm -rf home
|
||||
- name: 'Publish Pipeline Artifact: bundle-artifacts'
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: bundle-artifacts
|
||||
path: bundle-artifacts
|
||||
pkg:
|
||||
runs-on: windows-latest
|
||||
needs: bundle-artifacts
|
||||
strategy:
|
||||
matrix:
|
||||
arch:
|
||||
- name: x86_64
|
||||
bitness: 64
|
||||
bin: /amd64
|
||||
- name: i686
|
||||
bitness: 32
|
||||
bin: ''
|
||||
steps:
|
||||
- name: Determine whether this job should be skipped
|
||||
shell: bash
|
||||
run: |
|
||||
for e in ${BUILD_ONLY:-pkg}
|
||||
do
|
||||
case $e in
|
||||
*-${{matrix.arch.name}}) exit 0;; # build this artifact
|
||||
*-arm64) test i686 != ${{matrix.arch.name}} || exit 0;; # pkg-i686 is required for the ARM64 version
|
||||
*-*) ;; # not this build artifact, keep looking
|
||||
*) exit 0;; # build this artifact
|
||||
esac
|
||||
done
|
||||
echo "SKIP=true" >>$GITHUB_ENV
|
||||
- name: Configure user
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run:
|
||||
USER_NAME="${{github.actor}}" &&
|
||||
USER_EMAIL="${{github.actor}}@users.noreply.github.com" &&
|
||||
mkdir "$HOME" &&
|
||||
git config --global user.name "$USER_NAME" &&
|
||||
git config --global user.email "$USER_EMAIL" &&
|
||||
echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >>$GITHUB_ENV
|
||||
- uses: git-for-windows/setup-git-for-windows-sdk@v1
|
||||
if: env.SKIP != 'true'
|
||||
with:
|
||||
flavor: build-installers
|
||||
- name: Download bundle-artifacts
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: bundle-artifacts
|
||||
path: bundle-artifacts
|
||||
- name: Clone and update build-extra
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
d=/usr/src/build-extra &&
|
||||
if test ! -d $d/.git
|
||||
then
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
|
||||
else
|
||||
git -C $d fetch https://github.com/git-for-windows/build-extra main &&
|
||||
git -C $d switch -C main FETCH_HEAD
|
||||
fi &&
|
||||
git -C $d pull "$PWD"/bundle-artifacts/build-extra.bundle main
|
||||
- name: Check out git/git
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
git -c init.defaultBranch=main init &&
|
||||
git remote add -f origin https://github.com/git-for-windows/git &&
|
||||
git fetch --tags bundle-artifacts/git.bundle $(cat bundle-artifacts/next_version) &&
|
||||
git reset --hard $(cat bundle-artifacts/next_version)
|
||||
- name: Prepare home directory for code-signing
|
||||
env:
|
||||
CODESIGN_P12: ${{secrets.CODESIGN_P12}}
|
||||
CODESIGN_PASS: ${{secrets.CODESIGN_PASS}}
|
||||
if: env.SKIP != 'true' && env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
|
||||
shell: bash
|
||||
run: |
|
||||
cd home &&
|
||||
mkdir -p .sig &&
|
||||
echo -n "$CODESIGN_P12" | tr % '\n' | base64 -d >.sig/codesign.p12 &&
|
||||
echo -n "$CODESIGN_PASS" >.sig/codesign.pass
|
||||
git config --global alias.signtool '!sh "/usr/src/build-extra/signtool.sh"'
|
||||
- name: Prepare home directory for GPG signing
|
||||
if: env.SKIP != 'true' && env.GPGKEY != ''
|
||||
shell: bash
|
||||
run: |
|
||||
echo '${{secrets.PRIVGPGKEY}}' | tr % '\n' | gpg $GPG_OPTIONS --import &&
|
||||
info="$(gpg --list-keys --with-colons "${GPGKEY%% *}" | cut -d : -f 1,10 | sed -n '/^uid/{s|uid:||p;q}')" &&
|
||||
git config --global user.name "${info% <*}" &&
|
||||
git config --global user.email "<${info#*<}"
|
||||
env:
|
||||
GPGKEY: ${{secrets.GPGKEY}}
|
||||
- name: Build mingw-w64-${{matrix.arch.name}}-git
|
||||
if: env.SKIP != 'true'
|
||||
env:
|
||||
GPGKEY: "${{secrets.GPGKEY}}"
|
||||
shell: bash
|
||||
run: |
|
||||
set -x
|
||||
|
||||
# Make sure that there is a `/usr/bin/git` that can be used by `makepkg-mingw`
|
||||
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git &&
|
||||
|
||||
# Restrict `PATH` to MSYS2 and to Visual Studio (to let `cv2pdb` find the relevant DLLs)
|
||||
PATH="/mingw64/bin:/usr/bin:/c/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/IDE/:/C/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin${{matrix.arch.bin}}:/C/Windows/system32"
|
||||
|
||||
type -p mspdb140.dll || exit 1
|
||||
sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-${{matrix.arch.bitness}}-bit --build-src-pkg -o artifacts HEAD &&
|
||||
cp bundle-artifacts/ver artifacts/ &&
|
||||
if test -n "$GPGKEY"
|
||||
then
|
||||
for tar in artifacts/*.tar*
|
||||
do
|
||||
/usr/src/build-extra/gnupg-with-gpgkey.sh --detach-sign --no-armor $tar
|
||||
done
|
||||
fi &&
|
||||
|
||||
b=$PWD/artifacts &&
|
||||
version=$(cat bundle-artifacts/next_version) &&
|
||||
(cd /usr/src/MINGW-packages/mingw-w64-git &&
|
||||
cp PKGBUILD.$version PKGBUILD &&
|
||||
git commit -s -m "mingw-w64-git: new version ($version)" PKGBUILD &&
|
||||
git bundle create "$b"/MINGW-packages.bundle origin/main..main)
|
||||
- name: Clean up temporary files
|
||||
if: always() && env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: rm -rf home
|
||||
- name: Publish mingw-w64-${{matrix.arch.name}}-git
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: pkg-${{matrix.arch.name}}
|
||||
path: artifacts
|
||||
build-arm64:
|
||||
needs: bundle-artifacts
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Determine whether this job should be skipped
|
||||
shell: bash
|
||||
run: |
|
||||
for e in ${BUILD_ONLY:-pkg}
|
||||
do
|
||||
case $e in
|
||||
*-arm64) exit 0;; # build this artifact
|
||||
*-*) ;; # not this build artifact, keep looking
|
||||
*) exit 0;; # build this artifact
|
||||
esac
|
||||
done
|
||||
echo "SKIP=true" >>$GITHUB_ENV
|
||||
- name: Configure user
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run:
|
||||
USER_NAME="${{github.actor}}" &&
|
||||
USER_EMAIL="${{github.actor}}@users.noreply.github.com" &&
|
||||
mkdir -p "$HOME" &&
|
||||
git config --global user.name "$USER_NAME" &&
|
||||
git config --global user.email "$USER_EMAIL"
|
||||
- name: Download bundle-artifacts
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: bundle-artifacts
|
||||
path: bundle-artifacts
|
||||
- name: Check out git/git
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
git -c init.defaultBranch=main init &&
|
||||
git remote add -f origin https://github.com/git-for-windows/git &&
|
||||
git fetch --tags bundle-artifacts/git.bundle $(cat bundle-artifacts/next_version) &&
|
||||
git reset --hard $(cat bundle-artifacts/next_version)
|
||||
- name: initialize vcpkg
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: 'microsoft/vcpkg'
|
||||
path: 'compat/vcbuild/vcpkg'
|
||||
- name: download vcpkg artifacts
|
||||
if: env.SKIP != 'true'
|
||||
uses: git-for-windows/get-azure-pipelines-artifact@v0
|
||||
with:
|
||||
repository: git/git
|
||||
definitionId: 9
|
||||
- name: add msbuild to PATH
|
||||
if: env.SKIP != 'true'
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
- name: copy dlls to root
|
||||
if: env.SKIP != 'true'
|
||||
shell: powershell
|
||||
run: |
|
||||
& compat\vcbuild\vcpkg_copy_dlls.bat release arm64-windows
|
||||
if (!$?) { exit(1) }
|
||||
- name: generate Visual Studio solution
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/arm64-windows \
|
||||
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON -DCMAKE_GENERATOR_PLATFORM=arm64 -DVCPKG_ARCH=arm64-windows \
|
||||
-DCMAKE_INSTALL_PREFIX="`pwd`/git-arm64" -DSKIP_DASHED_BUILT_INS=ON -DHOST_CPU=arm64
|
||||
- name: MSBuild
|
||||
if: env.SKIP != 'true'
|
||||
run: msbuild git.sln -property:Configuration=Release
|
||||
- name: Link the Git executables
|
||||
if: env.SKIP != 'true'
|
||||
run: msbuild INSTALL.vcxproj -property:Configuration=Release
|
||||
- name: upload build artifacts
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: arm64-artifacts
|
||||
path: ./git-arm64
|
||||
artifacts:
|
||||
runs-on: windows-latest
|
||||
needs: [pkg, build-arm64]
|
||||
strategy:
|
||||
matrix:
|
||||
artifact:
|
||||
- name: installer
|
||||
fileprefix: Git
|
||||
fileextension: exe
|
||||
- name: portable
|
||||
fileprefix: PortableGit
|
||||
fileextension: exe
|
||||
- name: archive
|
||||
fileprefix: Git
|
||||
fileextension: tar.bz2
|
||||
- name: mingit
|
||||
fileprefix: MinGit
|
||||
fileextension: zip
|
||||
- name: mingit-busybox
|
||||
fileprefix: MinGit
|
||||
fileextension: zip
|
||||
arch:
|
||||
- name: x86_64
|
||||
bitness: 64
|
||||
arm64: false
|
||||
- name: i686
|
||||
bitness: 32
|
||||
arm64: false
|
||||
- name: i686
|
||||
bitness: 32
|
||||
arm64: true
|
||||
fail-fast: false
|
||||
env:
|
||||
MSYSTEM: MINGW${{matrix.arch.bitness}}
|
||||
steps:
|
||||
- name: Determine whether this job should be skipped
|
||||
shell: bash
|
||||
run: |
|
||||
suffix=${{matrix.arch.name}}
|
||||
if test true = ${{matrix.arch.arm64}}
|
||||
then
|
||||
suffix=arm64
|
||||
fi
|
||||
case " $BUILD_ONLY " in
|
||||
' ') ;; # not set; build all
|
||||
*" ${{matrix.artifact.name}} "*|*" ${{matrix.artifact.name}}-$suffix "*) ;; # build this artifact
|
||||
*) echo "SKIP=true" >>$GITHUB_ENV;;
|
||||
esac
|
||||
- name: Download pkg-${{matrix.arch.name}}
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: pkg-${{matrix.arch.name}}
|
||||
path: pkg-${{matrix.arch.name}}
|
||||
- name: Download bundle-artifacts
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: bundle-artifacts
|
||||
path: bundle-artifacts
|
||||
- uses: git-for-windows/setup-git-for-windows-sdk@v1
|
||||
if: env.SKIP != 'true' && matrix.arch.bitness == '64'
|
||||
with:
|
||||
flavor: build-installers
|
||||
- uses: git-for-windows/setup-git-for-windows-sdk@v1
|
||||
if: env.SKIP != 'true' && matrix.arch.bitness == '32'
|
||||
with:
|
||||
flavor: build-installers
|
||||
architecture: i686
|
||||
- name: Download arm64 artifact
|
||||
if: env.SKIP != 'true' && matrix.arch.arm64 == true
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: arm64-artifacts
|
||||
path: ${{github.workspace}}/arm64
|
||||
# Workaround for Git Credential Manager Core on ARM64: https://github.com/git-for-windows/git/issues/3015
|
||||
- name: Create git-credential-manager-core wrapper for ARM64
|
||||
if: env.SKIP != 'true' && matrix.arch.arm64 == true
|
||||
shell: bash
|
||||
run: |
|
||||
printf '%s\n' '#!/bin/sh' 'exec /mingw32/libexec/git-core/git-credential-manager-core.exe "$@"' > arm64/libexec/git-core/git-credential-manager-core
|
||||
chmod +x arm64/libexec/git-core/git-credential-manager-core
|
||||
- name: Clone and update build-extra
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
d=/usr/src/build-extra &&
|
||||
if test ! -d $d/.git
|
||||
then
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
|
||||
else
|
||||
git -C $d fetch https://github.com/git-for-windows/build-extra main &&
|
||||
git -C $d switch -C main FETCH_HEAD
|
||||
fi &&
|
||||
git -C $d pull "$PWD"/bundle-artifacts/build-extra.bundle main
|
||||
- name: Prepare home directory for code-signing
|
||||
env:
|
||||
CODESIGN_P12: ${{secrets.CODESIGN_P12}}
|
||||
CODESIGN_PASS: ${{secrets.CODESIGN_PASS}}
|
||||
if: env.SKIP != 'true' && (matrix.artifact.name == 'installer' || matrix.artifact.name == 'portable') && env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p home/.sig &&
|
||||
echo -n "$CODESIGN_P12" | tr % '\n' | base64 -d >home/.sig/codesign.p12 &&
|
||||
echo -n "$CODESIGN_PASS" >home/.sig/codesign.pass &&
|
||||
git config --global alias.signtool '!sh "/usr/src/build-extra/signtool.sh"'
|
||||
- name: Build ${{matrix.arch.bitness}}-bit ${{matrix.artifact.name}}
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
set -x
|
||||
if test "${{matrix.arch.arm64}}" = true
|
||||
then
|
||||
ARM64="--include-arm64-artifacts=\"$PWD/arm64\""
|
||||
else
|
||||
ARM64=
|
||||
fi
|
||||
|
||||
eval /usr/src/build-extra/please.sh make_installers_from_mingw_w64_git $ARM64 --version=$(cat pkg-${{matrix.arch.name}}/ver) -o artifacts --${{matrix.artifact.name}} --pkg=pkg-${{matrix.arch.name}}/mingw-w64-${{matrix.arch.name}}-git-[0-9]*.tar.xz --pkg=pkg-${{matrix.arch.name}}/mingw-w64-${{matrix.arch.name}}-git-doc-html-[0-9]*.tar.xz &&
|
||||
if test portable = '${{matrix.artifact.name}}' && test -n "$(git config alias.signtool)"
|
||||
then
|
||||
git signtool artifacts/PortableGit-*.exe
|
||||
fi &&
|
||||
openssl dgst -sha256 artifacts/${{matrix.artifact.fileprefix}}-*.${{matrix.artifact.fileextension}} | sed "s/.* //" >artifacts/sha-256.txt
|
||||
- name: Copy package-versions and pdbs
|
||||
if: env.SKIP != 'true' && matrix.artifact.name == 'installer'
|
||||
shell: bash
|
||||
run: |
|
||||
cp /usr/src/build-extra/installer/package-versions.txt artifacts/ &&
|
||||
|
||||
a=$PWD/artifacts &&
|
||||
p=$PWD/pkg-${{matrix.arch.name}} &&
|
||||
(cd /usr/src/build-extra &&
|
||||
mkdir -p cached-source-packages &&
|
||||
cp "$p"/*-pdb* cached-source-packages/ &&
|
||||
GIT_CONFIG_PARAMETERS="'windows.sdk${{matrix.arch.bitness}}.path='" ./please.sh bundle_pdbs --arch=${{matrix.arch.name}} --directory="$a" installer/package-versions.txt)
|
||||
- name: Clean up temporary files
|
||||
if: always() && env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: rm -rf home
|
||||
- name: Publish ${{matrix.artifact.name}}-${{matrix.arch.name}}
|
||||
if: env.SKIP != 'true' && matrix.arch.arm64 != true
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{matrix.artifact.name}}-${{matrix.arch.name}}
|
||||
path: artifacts
|
||||
- name: Publish ${{matrix.artifact.name}}-arm64
|
||||
if: env.SKIP != 'true' && matrix.arch.arm64 == true
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{matrix.artifact.name}}-arm64
|
||||
path: artifacts
|
||||
nuget:
|
||||
runs-on: windows-latest
|
||||
needs: pkg
|
||||
steps:
|
||||
- name: Determine whether this job should be skipped
|
||||
shell: bash
|
||||
run: |
|
||||
case " $BUILD_ONLY " in
|
||||
' ') ;; # not set; build all
|
||||
*" nuget "*) ;; # build this artifact
|
||||
*) echo "SKIP=true" >>$GITHUB_ENV;;
|
||||
esac
|
||||
- name: Download pkg-x86_64
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: pkg-x86_64
|
||||
path: pkg-x86_64
|
||||
- name: Download bundle-artifacts
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: bundle-artifacts
|
||||
path: bundle-artifacts
|
||||
- uses: git-for-windows/setup-git-for-windows-sdk@v1
|
||||
if: env.SKIP != 'true'
|
||||
with:
|
||||
flavor: build-installers
|
||||
- name: Clone and update build-extra
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
d=/usr/src/build-extra &&
|
||||
if test ! -d $d/.git
|
||||
then
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
|
||||
else
|
||||
git -C $d fetch https://github.com/git-for-windows/build-extra main &&
|
||||
git -C $d switch -C main FETCH_HEAD
|
||||
fi &&
|
||||
git -C $d pull "$PWD"/bundle-artifacts/build-extra.bundle main
|
||||
- uses: nuget/setup-nuget@v1
|
||||
if: env.SKIP != 'true'
|
||||
- name: Build 64-bit NuGet packages
|
||||
if: env.SKIP != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
/usr/src/build-extra/please.sh make_installers_from_mingw_w64_git --version=$(cat pkg-x86_64/ver) -o artifacts --nuget --pkg=pkg-x86_64/mingw-w64-x86_64-git-[0-9]*.tar.xz --pkg=pkg-x86_64/mingw-w64-x86_64-git-doc-html-[0-9]*.tar.xz &&
|
||||
/usr/src/build-extra/please.sh make_installers_from_mingw_w64_git --version=$(cat pkg-x86_64/ver) -o artifacts --nuget-mingit &&
|
||||
openssl dgst -sha256 artifacts/Git*.nupkg | sed "s/.* //" >artifacts/sha-256.txt
|
||||
- name: Publish nuget-x86_64
|
||||
if: env.SKIP != 'true'
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: nuget-x86_64
|
||||
path: artifacts
|
||||
27
.github/workflows/main.yml
vendored
27
.github/workflows/main.yml
vendored
@@ -133,6 +133,9 @@ jobs:
|
||||
NO_PERL: 1
|
||||
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x64, arm64]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: git-for-windows/setup-git-for-windows-sdk@v1
|
||||
@@ -142,26 +145,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
|
||||
- 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:
|
||||
@@ -175,7 +174,7 @@ jobs:
|
||||
- name: upload tracked files and build artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: vs-artifacts
|
||||
name: vs-artifacts-${{ matrix.arch }}
|
||||
path: artifacts
|
||||
vs-test:
|
||||
name: win+VS test
|
||||
@@ -190,7 +189,7 @@ jobs:
|
||||
- name: download tracked files and build artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: vs-artifacts
|
||||
name: vs-artifacts-x64
|
||||
path: ${{github.workspace}}
|
||||
- name: extract tracked files and build artifacts
|
||||
shell: bash
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -246,3 +246,4 @@ Release/
|
||||
/git.VC.db
|
||||
*.dSYM
|
||||
/contrib/buildsystems/out
|
||||
CMakeSettings.json
|
||||
|
||||
@@ -499,6 +499,8 @@ include::config/safe.txt[]
|
||||
|
||||
include::config/sendemail.txt[]
|
||||
|
||||
include::config/sendpack.txt[]
|
||||
|
||||
include::config/sequencer.txt[]
|
||||
|
||||
include::config/showbranch.txt[]
|
||||
|
||||
@@ -136,4 +136,7 @@ advice.*::
|
||||
Advice shown when either linkgit:git-add[1] or linkgit:git-rm[1]
|
||||
is asked to update index entries outside the current sparse
|
||||
checkout.
|
||||
useCoreFSMonitorConfig::
|
||||
Advice shown if the deprecated 'core.useBuiltinFSMonitor' config
|
||||
setting is in use.
|
||||
--
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -39,3 +39,9 @@ which id the original user has.
|
||||
If that is not what you would prefer and want git to only trust
|
||||
repositories that are owned by root instead, then you must remove
|
||||
the `SUDO_UID` variable from root's environment before invoking git.
|
||||
+
|
||||
Due to the permission model on Windows where ACLs are used instead of
|
||||
Unix' simpler permission model, it can be a bit tricky to figure out why
|
||||
a directory is considered unsafe. To help with this, Git will provide
|
||||
more detailed information when the environment variable
|
||||
`GIT_TEST_DEBUG_UNSAFE_DIRECTORIES` is set to `true`.
|
||||
|
||||
5
Documentation/config/sendpack.txt
Normal file
5
Documentation/config/sendpack.txt
Normal file
@@ -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.
|
||||
12
Makefile
12
Makefile
@@ -2654,6 +2654,13 @@ compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
|
||||
compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
|
||||
endif
|
||||
|
||||
headless-git.o: compat/win32/headless.c GIT-CFLAGS
|
||||
$(QUIET_CC)$(CC) $(ALL_CFLAGS) $(COMPAT_CFLAGS) \
|
||||
-fno-stack-protector -o $@ -c -Wall -Wwrite-strings $<
|
||||
|
||||
headless-git$X: headless-git.o git.res GIT-LDFLAGS
|
||||
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -mwindows -o $@ $< git.res
|
||||
|
||||
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
|
||||
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
|
||||
|
||||
@@ -3410,6 +3417,7 @@ clean: profile-clean coverage-clean cocciclean
|
||||
$(RM) po/git.pot po/git-core.pot
|
||||
$(RM) *.res
|
||||
$(RM) $(OBJECTS)
|
||||
$(RM) headless-git.o
|
||||
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
|
||||
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
|
||||
$(RM) $(TEST_PROGRAMS)
|
||||
@@ -3439,13 +3447,17 @@ endif
|
||||
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
|
||||
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
|
||||
|
||||
@@ -91,6 +91,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);
|
||||
|
||||
|
||||
1
advice.c
1
advice.c
@@ -74,6 +74,7 @@ static struct {
|
||||
[ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE] = { "submoduleAlternateErrorStrategyDie", 1 },
|
||||
[ADVICE_SUBMODULES_NOT_UPDATED] = { "submodulesNotUpdated", 1 },
|
||||
[ADVICE_UPDATE_SPARSE_PATH] = { "updateSparsePath", 1 },
|
||||
[ADVICE_USE_CORE_FSMONITOR_CONFIG] = { "useCoreFSMonitorConfig", 1 },
|
||||
[ADVICE_WAITING_FOR_EDITOR] = { "waitingForEditor", 1 },
|
||||
};
|
||||
|
||||
|
||||
1
advice.h
1
advice.h
@@ -48,6 +48,7 @@ struct string_list;
|
||||
ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE,
|
||||
ADVICE_SUBMODULES_NOT_UPDATED,
|
||||
ADVICE_UPDATE_SPARSE_PATH,
|
||||
ADVICE_USE_CORE_FSMONITOR_CONFIG,
|
||||
ADVICE_WAITING_FOR_EDITOR,
|
||||
ADVICE_SKIPPED_CHERRY_PICKS,
|
||||
};
|
||||
|
||||
@@ -17,6 +17,8 @@ static unsigned long offset;
|
||||
|
||||
static int tar_umask = 002;
|
||||
|
||||
static gzFile gzip;
|
||||
|
||||
static int write_tar_filter_archive(const struct archiver *ar,
|
||||
struct archiver_args *args);
|
||||
|
||||
@@ -38,11 +40,21 @@ static int write_tar_filter_archive(const struct archiver *ar,
|
||||
#define USTAR_MAX_MTIME 077777777777ULL
|
||||
#endif
|
||||
|
||||
/* writes out the whole block, or dies if fails */
|
||||
static void write_block_or_die(const char *block) {
|
||||
if (gzip) {
|
||||
if (gzwrite(gzip, block, (unsigned) BLOCKSIZE) != BLOCKSIZE)
|
||||
die(_("gzwrite failed"));
|
||||
} else {
|
||||
write_or_die(1, block, BLOCKSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/* writes out the whole block, but only if it is full */
|
||||
static void write_if_needed(void)
|
||||
{
|
||||
if (offset == BLOCKSIZE) {
|
||||
write_or_die(1, block, BLOCKSIZE);
|
||||
write_block_or_die(block);
|
||||
offset = 0;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +78,7 @@ static void do_write_blocked(const void *data, unsigned long size)
|
||||
write_if_needed();
|
||||
}
|
||||
while (size >= BLOCKSIZE) {
|
||||
write_or_die(1, buf, BLOCKSIZE);
|
||||
write_block_or_die(buf);
|
||||
size -= BLOCKSIZE;
|
||||
buf += BLOCKSIZE;
|
||||
}
|
||||
@@ -101,10 +113,10 @@ static void write_trailer(void)
|
||||
{
|
||||
int tail = BLOCKSIZE - offset;
|
||||
memset(block + offset, 0, tail);
|
||||
write_or_die(1, block, BLOCKSIZE);
|
||||
write_block_or_die(block);
|
||||
if (tail < 2 * RECORDSIZE) {
|
||||
memset(block, 0, offset);
|
||||
write_or_die(1, block, BLOCKSIZE);
|
||||
write_block_or_die(block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,18 +455,34 @@ static int write_tar_filter_archive(const struct archiver *ar,
|
||||
filter.use_shell = 1;
|
||||
filter.in = -1;
|
||||
|
||||
if (start_command(&filter) < 0)
|
||||
die_errno(_("unable to start '%s' filter"), cmd.buf);
|
||||
close(1);
|
||||
if (dup2(filter.in, 1) < 0)
|
||||
die_errno(_("unable to redirect descriptor"));
|
||||
close(filter.in);
|
||||
if (!strcmp("gzip -cn", ar->data)) {
|
||||
char outmode[4] = "wb\0";
|
||||
|
||||
if (args->compression_level >= 0 && args->compression_level <= 9)
|
||||
outmode[2] = '0' + args->compression_level;
|
||||
|
||||
gzip = gzdopen(fileno(stdout), outmode);
|
||||
if (!gzip)
|
||||
die(_("Could not gzdopen stdout"));
|
||||
} else {
|
||||
if (start_command(&filter) < 0)
|
||||
die_errno(_("unable to start '%s' filter"), cmd.buf);
|
||||
close(1);
|
||||
if (dup2(filter.in, 1) < 0)
|
||||
die_errno(_("unable to redirect descriptor"));
|
||||
close(filter.in);
|
||||
}
|
||||
|
||||
r = write_tar_archive(ar, args);
|
||||
|
||||
close(1);
|
||||
if (finish_command(&filter) != 0)
|
||||
die(_("'%s' filter reported error"), cmd.buf);
|
||||
if (gzip) {
|
||||
if (gzclose(gzip) != Z_OK)
|
||||
die(_("gzclose failed"));
|
||||
} else {
|
||||
close(1);
|
||||
if (finish_command(&filter) != 0)
|
||||
die(_("'%s' filter reported error"), cmd.buf);
|
||||
}
|
||||
|
||||
strbuf_release(&cmd);
|
||||
return r;
|
||||
|
||||
@@ -34,6 +34,10 @@ static const char *msg_remove = N_("Removing %s\n");
|
||||
static const char *msg_would_remove = N_("Would remove %s\n");
|
||||
static const char *msg_skip_git_dir = N_("Skipping repository %s\n");
|
||||
static const char *msg_would_skip_git_dir = N_("Would skip repository %s\n");
|
||||
#ifndef CAN_UNLINK_MOUNT_POINTS
|
||||
static const char *msg_skip_mount_point = N_("Skipping mount point %s\n");
|
||||
static const char *msg_would_skip_mount_point = N_("Would skip mount point %s\n");
|
||||
#endif
|
||||
static const char *msg_warn_remove_failed = N_("failed to remove %s");
|
||||
static const char *msg_warn_lstat_failed = N_("could not lstat %s\n");
|
||||
static const char *msg_skip_cwd = N_("Refusing to remove current working directory\n");
|
||||
@@ -175,6 +179,29 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (is_mount_point(path)) {
|
||||
#ifndef CAN_UNLINK_MOUNT_POINTS
|
||||
if (!quiet) {
|
||||
quote_path(path->buf, prefix, "ed, 0);
|
||||
printf(dry_run ?
|
||||
_(msg_would_skip_mount_point) :
|
||||
_(msg_skip_mount_point), quoted.buf);
|
||||
}
|
||||
*dir_gone = 0;
|
||||
#else
|
||||
if (!dry_run && unlink(path->buf)) {
|
||||
int saved_errno = errno;
|
||||
quote_path(path->buf, prefix, "ed, 0);
|
||||
errno = saved_errno;
|
||||
warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
||||
*dir_gone = 0;
|
||||
ret = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
dir = opendir(path->buf);
|
||||
if (!dir) {
|
||||
/* an empty dir could be removed even if it is unreadble */
|
||||
|
||||
@@ -1969,7 +1969,7 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
|
||||
"</Settings>\n"
|
||||
"<Actions Context=\"Author\">\n"
|
||||
"<Exec>\n"
|
||||
"<Command>\"%s\\git.exe\"</Command>\n"
|
||||
"<Command>\"%s\\headless-git.exe\"</Command>\n"
|
||||
"<Arguments>--exec-path=\"%s\" for-each-repo --config=maintenance.repo maintenance run --schedule=%s</Arguments>\n"
|
||||
"</Exec>\n"
|
||||
"</Actions>\n"
|
||||
|
||||
@@ -410,7 +410,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
|
||||
startup_info->have_repository = 1;
|
||||
|
||||
/* Ensure `core.hidedotfiles` is processed */
|
||||
git_config(platform_core_config, NULL);
|
||||
git_config(git_default_core_config, NULL);
|
||||
|
||||
safe_create_dir(git_dir, 0);
|
||||
|
||||
|
||||
@@ -1183,7 +1183,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
strbuf_reset(&buf);
|
||||
strbuf_addf(&buf, "%s/rewritten", merge_dir());
|
||||
if (is_directory(buf.buf)) {
|
||||
die("`rebase -p` is no longer supported");
|
||||
die("`rebase --preserve-merges` (-p) is no longer supported.\n"
|
||||
"You still have a `.git/rebase-merge/rewritten` directory, \n"
|
||||
"indicating a `rebase preserve-merge` is still in progress.\n");
|
||||
} else {
|
||||
strbuf_reset(&buf);
|
||||
strbuf_addf(&buf, "%s/interactive", merge_dir());
|
||||
@@ -1203,7 +1205,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
builtin_rebase_usage, 0);
|
||||
|
||||
if (preserve_merges_selected)
|
||||
die(_("--preserve-merges was replaced by --rebase-merges"));
|
||||
die(_("--preserve-merges was replaced by --rebase-merges\n"
|
||||
"Also, check your `pull` configuration settings\n"
|
||||
"`git config --show-scope --show-origin --get-regexp 'pull.*'`\n"
|
||||
"which may also invoke this option."));
|
||||
|
||||
if (action != ACTION_NONE && total_argc != 2) {
|
||||
usage_with_options(builtin_rebase_usage,
|
||||
|
||||
1
cache.h
1
cache.h
@@ -1306,6 +1306,7 @@ int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);
|
||||
int normalize_path_copy(char *dst, const char *src);
|
||||
int longest_ancestor_length(const char *path, struct string_list *prefixes);
|
||||
char *strip_path_suffix(const char *path, const char *suffix);
|
||||
int is_mount_point_via_stat(struct strbuf *path);
|
||||
int daemon_avoid_alias(const char *path);
|
||||
|
||||
/*
|
||||
|
||||
@@ -53,4 +53,8 @@ then
|
||||
fi
|
||||
check_unignored_build_artifacts
|
||||
|
||||
case " $MAKE_TARGETS " in
|
||||
*" all "*) make -C contrib/subtree test;;
|
||||
esac
|
||||
|
||||
save_good_tree
|
||||
|
||||
@@ -15,4 +15,7 @@ group "Run tests" make --quiet -C t T="$(cd t &&
|
||||
tr '\n' ' ')" ||
|
||||
handle_failed_tests
|
||||
|
||||
# Run the git subtree tests only if main tests succeeded
|
||||
test 0 != "$1" || make -C contrib/subtree test
|
||||
|
||||
check_unignored_build_artifacts
|
||||
|
||||
421
compat/mingw.c
421
compat/mingw.c
@@ -1,6 +1,7 @@
|
||||
#include "../git-compat-util.h"
|
||||
#include "win32.h"
|
||||
#include <aclapi.h>
|
||||
#include <sddl.h>
|
||||
#include <conio.h>
|
||||
#include <wchar.h>
|
||||
#include "../strbuf.h"
|
||||
@@ -1048,11 +1049,19 @@ unsigned int sleep (unsigned int seconds)
|
||||
char *mingw_mktemp(char *template)
|
||||
{
|
||||
wchar_t wtemplate[MAX_PATH];
|
||||
int offset = 0;
|
||||
|
||||
if (xutftowcs_path(wtemplate, template) < 0)
|
||||
return NULL;
|
||||
|
||||
if (is_dir_sep(template[0]) && !is_dir_sep(template[1]) &&
|
||||
iswalpha(wtemplate[0]) && wtemplate[1] == L':') {
|
||||
/* We have an absolute path missing the drive prefix */
|
||||
offset = 2;
|
||||
}
|
||||
if (!_wmktemp(wtemplate))
|
||||
return NULL;
|
||||
if (xwcstoutf(template, wtemplate, strlen(template) + 1) < 0)
|
||||
if (xwcstoutf(template, wtemplate + offset, strlen(template) + 1) < 0)
|
||||
return NULL;
|
||||
return template;
|
||||
}
|
||||
@@ -1117,37 +1126,101 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
|
||||
}
|
||||
#endif
|
||||
|
||||
char *mingw_strbuf_realpath(struct strbuf *resolved, const char *path)
|
||||
{
|
||||
wchar_t wpath[MAX_PATH];
|
||||
HANDLE h;
|
||||
DWORD ret;
|
||||
int len;
|
||||
const char *last_component = NULL;
|
||||
|
||||
if (xutftowcs_path(wpath, path) < 0)
|
||||
return NULL;
|
||||
|
||||
h = CreateFileW(wpath, 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
|
||||
/*
|
||||
* strbuf_realpath() allows the last path component to not exist. If
|
||||
* that is the case, now it's time to try without last component.
|
||||
*/
|
||||
if (h == INVALID_HANDLE_VALUE &&
|
||||
GetLastError() == ERROR_FILE_NOT_FOUND) {
|
||||
/* cut last component off of `wpath` */
|
||||
wchar_t *p = wpath + wcslen(wpath);
|
||||
|
||||
while (p != wpath)
|
||||
if (*(--p) == L'/' || *p == L'\\')
|
||||
break; /* found start of last component */
|
||||
|
||||
if (p != wpath && (last_component = find_last_dir_sep(path))) {
|
||||
last_component++; /* skip directory separator */
|
||||
*p = L'\0';
|
||||
h = CreateFileW(wpath, 0, FILE_SHARE_READ |
|
||||
FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
|
||||
ret = GetFinalPathNameByHandleW(h, wpath, ARRAY_SIZE(wpath), 0);
|
||||
CloseHandle(h);
|
||||
if (!ret || ret >= ARRAY_SIZE(wpath))
|
||||
return NULL;
|
||||
|
||||
len = wcslen(wpath) * 3;
|
||||
strbuf_grow(resolved, len);
|
||||
len = xwcstoutf(resolved->buf, normalize_ntpath(wpath), len);
|
||||
if (len < 0)
|
||||
return NULL;
|
||||
resolved->len = len;
|
||||
|
||||
if (last_component) {
|
||||
/* Use forward-slash, like `normalize_ntpath()` */
|
||||
strbuf_addch(resolved, '/');
|
||||
strbuf_addstr(resolved, last_component);
|
||||
}
|
||||
|
||||
return resolved->buf;
|
||||
|
||||
}
|
||||
|
||||
char *mingw_getcwd(char *pointer, int len)
|
||||
{
|
||||
wchar_t cwd[MAX_PATH], wpointer[MAX_PATH];
|
||||
DWORD ret = GetCurrentDirectoryW(ARRAY_SIZE(cwd), cwd);
|
||||
HANDLE hnd;
|
||||
|
||||
if (!ret || ret >= ARRAY_SIZE(cwd)) {
|
||||
errno = ret ? ENAMETOOLONG : err_win_to_posix(GetLastError());
|
||||
return NULL;
|
||||
}
|
||||
ret = GetLongPathNameW(cwd, wpointer, ARRAY_SIZE(wpointer));
|
||||
if (!ret && GetLastError() == ERROR_ACCESS_DENIED) {
|
||||
HANDLE hnd = CreateFileW(cwd, 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (hnd == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
hnd = CreateFileW(cwd, 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (hnd != INVALID_HANDLE_VALUE) {
|
||||
ret = GetFinalPathNameByHandleW(hnd, wpointer, ARRAY_SIZE(wpointer), 0);
|
||||
CloseHandle(hnd);
|
||||
if (!ret || ret >= ARRAY_SIZE(wpointer))
|
||||
return NULL;
|
||||
if (!ret || ret >= ARRAY_SIZE(wpointer)) {
|
||||
ret = GetLongPathNameW(cwd, wpointer, ARRAY_SIZE(wpointer));
|
||||
if (!ret || ret >= ARRAY_SIZE(wpointer)) {
|
||||
errno = ret ? ENAMETOOLONG : err_win_to_posix(GetLastError());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (xwcstoutf(pointer, normalize_ntpath(wpointer), len) < 0)
|
||||
return NULL;
|
||||
return pointer;
|
||||
}
|
||||
if (!ret || ret >= ARRAY_SIZE(wpointer))
|
||||
return NULL;
|
||||
if (GetFileAttributesW(wpointer) == INVALID_FILE_ATTRIBUTES) {
|
||||
if (GetFileAttributesW(cwd) == INVALID_FILE_ATTRIBUTES) {
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
}
|
||||
if (xwcstoutf(pointer, wpointer, len) < 0)
|
||||
if (xwcstoutf(pointer, cwd, len) < 0)
|
||||
return NULL;
|
||||
convert_slashes(pointer);
|
||||
return pointer;
|
||||
@@ -1249,7 +1322,7 @@ static const char *quote_arg_msys2(const char *arg)
|
||||
|
||||
static const char *parse_interpreter(const char *cmd)
|
||||
{
|
||||
static char buf[100];
|
||||
static char buf[MAX_PATH];
|
||||
char *p, *opt;
|
||||
int n, fd;
|
||||
|
||||
@@ -2020,18 +2093,150 @@ static void ensure_socket_initialization(void)
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
static int winsock_error_to_errno(DWORD err)
|
||||
{
|
||||
switch (err) {
|
||||
case WSAEINTR: return EINTR;
|
||||
case WSAEBADF: return EBADF;
|
||||
case WSAEACCES: return EACCES;
|
||||
case WSAEFAULT: return EFAULT;
|
||||
case WSAEINVAL: return EINVAL;
|
||||
case WSAEMFILE: return EMFILE;
|
||||
case WSAEWOULDBLOCK: return EWOULDBLOCK;
|
||||
case WSAEINPROGRESS: return EINPROGRESS;
|
||||
case WSAEALREADY: return EALREADY;
|
||||
case WSAENOTSOCK: return ENOTSOCK;
|
||||
case WSAEDESTADDRREQ: return EDESTADDRREQ;
|
||||
case WSAEMSGSIZE: return EMSGSIZE;
|
||||
case WSAEPROTOTYPE: return EPROTOTYPE;
|
||||
case WSAENOPROTOOPT: return ENOPROTOOPT;
|
||||
case WSAEPROTONOSUPPORT: return EPROTONOSUPPORT;
|
||||
case WSAEOPNOTSUPP: return EOPNOTSUPP;
|
||||
case WSAEAFNOSUPPORT: return EAFNOSUPPORT;
|
||||
case WSAEADDRINUSE: return EADDRINUSE;
|
||||
case WSAEADDRNOTAVAIL: return EADDRNOTAVAIL;
|
||||
case WSAENETDOWN: return ENETDOWN;
|
||||
case WSAENETUNREACH: return ENETUNREACH;
|
||||
case WSAENETRESET: return ENETRESET;
|
||||
case WSAECONNABORTED: return ECONNABORTED;
|
||||
case WSAECONNRESET: return ECONNRESET;
|
||||
case WSAENOBUFS: return ENOBUFS;
|
||||
case WSAEISCONN: return EISCONN;
|
||||
case WSAENOTCONN: return ENOTCONN;
|
||||
case WSAETIMEDOUT: return ETIMEDOUT;
|
||||
case WSAECONNREFUSED: return ECONNREFUSED;
|
||||
case WSAELOOP: return ELOOP;
|
||||
case WSAENAMETOOLONG: return ENAMETOOLONG;
|
||||
case WSAEHOSTUNREACH: return EHOSTUNREACH;
|
||||
case WSAENOTEMPTY: return ENOTEMPTY;
|
||||
/* No errno equivalent; default to EIO */
|
||||
case WSAESOCKTNOSUPPORT:
|
||||
case WSAEPFNOSUPPORT:
|
||||
case WSAESHUTDOWN:
|
||||
case WSAETOOMANYREFS:
|
||||
case WSAEHOSTDOWN:
|
||||
case WSAEPROCLIM:
|
||||
case WSAEUSERS:
|
||||
case WSAEDQUOT:
|
||||
case WSAESTALE:
|
||||
case WSAEREMOTE:
|
||||
case WSASYSNOTREADY:
|
||||
case WSAVERNOTSUPPORTED:
|
||||
case WSANOTINITIALISED:
|
||||
case WSAEDISCON:
|
||||
case WSAENOMORE:
|
||||
case WSAECANCELLED:
|
||||
case WSAEINVALIDPROCTABLE:
|
||||
case WSAEINVALIDPROVIDER:
|
||||
case WSAEPROVIDERFAILEDINIT:
|
||||
case WSASYSCALLFAILURE:
|
||||
case WSASERVICE_NOT_FOUND:
|
||||
case WSATYPE_NOT_FOUND:
|
||||
case WSA_E_NO_MORE:
|
||||
case WSA_E_CANCELLED:
|
||||
case WSAEREFUSED:
|
||||
case WSAHOST_NOT_FOUND:
|
||||
case WSATRY_AGAIN:
|
||||
case WSANO_RECOVERY:
|
||||
case WSANO_DATA:
|
||||
case WSA_QOS_RECEIVERS:
|
||||
case WSA_QOS_SENDERS:
|
||||
case WSA_QOS_NO_SENDERS:
|
||||
case WSA_QOS_NO_RECEIVERS:
|
||||
case WSA_QOS_REQUEST_CONFIRMED:
|
||||
case WSA_QOS_ADMISSION_FAILURE:
|
||||
case WSA_QOS_POLICY_FAILURE:
|
||||
case WSA_QOS_BAD_STYLE:
|
||||
case WSA_QOS_BAD_OBJECT:
|
||||
case WSA_QOS_TRAFFIC_CTRL_ERROR:
|
||||
case WSA_QOS_GENERIC_ERROR:
|
||||
case WSA_QOS_ESERVICETYPE:
|
||||
case WSA_QOS_EFLOWSPEC:
|
||||
case WSA_QOS_EPROVSPECBUF:
|
||||
case WSA_QOS_EFILTERSTYLE:
|
||||
case WSA_QOS_EFILTERTYPE:
|
||||
case WSA_QOS_EFILTERCOUNT:
|
||||
case WSA_QOS_EOBJLENGTH:
|
||||
case WSA_QOS_EFLOWCOUNT:
|
||||
#ifndef _MSC_VER
|
||||
case WSA_QOS_EUNKNOWNPSOBJ:
|
||||
#endif
|
||||
case WSA_QOS_EPOLICYOBJ:
|
||||
case WSA_QOS_EFLOWDESC:
|
||||
case WSA_QOS_EPSFLOWSPEC:
|
||||
case WSA_QOS_EPSFILTERSPEC:
|
||||
case WSA_QOS_ESDMODEOBJ:
|
||||
case WSA_QOS_ESHAPERATEOBJ:
|
||||
case WSA_QOS_RESERVED_PETYPE:
|
||||
default: return EIO;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* On Windows, `errno` is a global macro to a function call.
|
||||
* This makes it difficult to debug and single-step our mappings.
|
||||
*/
|
||||
static inline void set_wsa_errno(void)
|
||||
{
|
||||
DWORD wsa = WSAGetLastError();
|
||||
int e = winsock_error_to_errno(wsa);
|
||||
errno = e;
|
||||
|
||||
#ifdef DEBUG_WSA_ERRNO
|
||||
fprintf(stderr, "winsock error: %d -> %d\n", wsa, e);
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int winsock_return(int ret)
|
||||
{
|
||||
if (ret < 0)
|
||||
set_wsa_errno();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define WINSOCK_RETURN(x) do { return winsock_return(x); } while (0)
|
||||
|
||||
#undef gethostname
|
||||
int mingw_gethostname(char *name, int namelen)
|
||||
{
|
||||
ensure_socket_initialization();
|
||||
return gethostname(name, namelen);
|
||||
ensure_socket_initialization();
|
||||
WINSOCK_RETURN(gethostname(name, namelen));
|
||||
}
|
||||
|
||||
#undef gethostbyname
|
||||
struct hostent *mingw_gethostbyname(const char *host)
|
||||
{
|
||||
struct hostent *ret;
|
||||
|
||||
ensure_socket_initialization();
|
||||
return gethostbyname(host);
|
||||
|
||||
ret = gethostbyname(host);
|
||||
if (!ret)
|
||||
set_wsa_errno();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef getaddrinfo
|
||||
@@ -2039,7 +2244,7 @@ int mingw_getaddrinfo(const char *node, const char *service,
|
||||
const struct addrinfo *hints, struct addrinfo **res)
|
||||
{
|
||||
ensure_socket_initialization();
|
||||
return getaddrinfo(node, service, hints, res);
|
||||
WINSOCK_RETURN(getaddrinfo(node, service, hints, res));
|
||||
}
|
||||
|
||||
int mingw_socket(int domain, int type, int protocol)
|
||||
@@ -2059,7 +2264,7 @@ int mingw_socket(int domain, int type, int protocol)
|
||||
* in errno so that _if_ someone looks up the code somewhere,
|
||||
* then it is at least the number that are usually listed.
|
||||
*/
|
||||
errno = WSAGetLastError();
|
||||
set_wsa_errno();
|
||||
return -1;
|
||||
}
|
||||
/* convert into a file descriptor */
|
||||
@@ -2075,35 +2280,35 @@ int mingw_socket(int domain, int type, int protocol)
|
||||
int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz)
|
||||
{
|
||||
SOCKET s = (SOCKET)_get_osfhandle(sockfd);
|
||||
return connect(s, sa, sz);
|
||||
WINSOCK_RETURN(connect(s, sa, sz));
|
||||
}
|
||||
|
||||
#undef bind
|
||||
int mingw_bind(int sockfd, struct sockaddr *sa, size_t sz)
|
||||
{
|
||||
SOCKET s = (SOCKET)_get_osfhandle(sockfd);
|
||||
return bind(s, sa, sz);
|
||||
WINSOCK_RETURN(bind(s, sa, sz));
|
||||
}
|
||||
|
||||
#undef setsockopt
|
||||
int mingw_setsockopt(int sockfd, int lvl, int optname, void *optval, int optlen)
|
||||
{
|
||||
SOCKET s = (SOCKET)_get_osfhandle(sockfd);
|
||||
return setsockopt(s, lvl, optname, (const char*)optval, optlen);
|
||||
WINSOCK_RETURN(setsockopt(s, lvl, optname, (const char*)optval, optlen));
|
||||
}
|
||||
|
||||
#undef shutdown
|
||||
int mingw_shutdown(int sockfd, int how)
|
||||
{
|
||||
SOCKET s = (SOCKET)_get_osfhandle(sockfd);
|
||||
return shutdown(s, how);
|
||||
WINSOCK_RETURN(shutdown(s, how));
|
||||
}
|
||||
|
||||
#undef listen
|
||||
int mingw_listen(int sockfd, int backlog)
|
||||
{
|
||||
SOCKET s = (SOCKET)_get_osfhandle(sockfd);
|
||||
return listen(s, backlog);
|
||||
WINSOCK_RETURN(listen(s, backlog));
|
||||
}
|
||||
|
||||
#undef accept
|
||||
@@ -2114,6 +2319,11 @@ int mingw_accept(int sockfd1, struct sockaddr *sa, socklen_t *sz)
|
||||
SOCKET s1 = (SOCKET)_get_osfhandle(sockfd1);
|
||||
SOCKET s2 = accept(s1, sa, sz);
|
||||
|
||||
if (s2 == INVALID_SOCKET) {
|
||||
set_wsa_errno();
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* convert into a file descriptor */
|
||||
if ((sockfd2 = _open_osfhandle(s2, O_RDWR|O_BINARY)) < 0) {
|
||||
int err = errno;
|
||||
@@ -2508,6 +2718,28 @@ pid_t waitpid(pid_t pid, int *status, int options)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int mingw_is_mount_point(struct strbuf *path)
|
||||
{
|
||||
WIN32_FIND_DATAW findbuf = { 0 };
|
||||
HANDLE handle;
|
||||
wchar_t wfilename[MAX_PATH];
|
||||
int wlen = xutftowcs_path(wfilename, path->buf);
|
||||
if (wlen < 0)
|
||||
die(_("could not get long path for '%s'"), path->buf);
|
||||
|
||||
/* remove trailing slash, if any */
|
||||
if (wlen > 0 && wfilename[wlen - 1] == L'/')
|
||||
wfilename[--wlen] = L'\0';
|
||||
|
||||
handle = FindFirstFileW(wfilename, &findbuf);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return 0;
|
||||
FindClose(handle);
|
||||
|
||||
return (findbuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
|
||||
(findbuf.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT);
|
||||
}
|
||||
|
||||
int xutftowcsn(wchar_t *wcs, const char *utfs, size_t wcslen, int utflen)
|
||||
{
|
||||
int upos = 0, wpos = 0;
|
||||
@@ -2593,6 +2825,59 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef ENSURE_MSYSTEM_IS_SET
|
||||
static size_t append_system_bin_dirs(char *path, size_t size)
|
||||
{
|
||||
#if !defined(RUNTIME_PREFIX) || !defined(HAVE_WPGMPTR)
|
||||
return 0;
|
||||
#else
|
||||
char prefix[32768];
|
||||
const char *slash;
|
||||
size_t len = xwcstoutf(prefix, _wpgmptr, sizeof(prefix)), off = 0;
|
||||
|
||||
if (len == 0 || len >= sizeof(prefix) ||
|
||||
!(slash = find_last_dir_sep(prefix)))
|
||||
return 0;
|
||||
/* strip trailing `git.exe` */
|
||||
len = slash - prefix;
|
||||
|
||||
/* strip trailing `cmd` or `mingw64\bin` or `mingw32\bin` or `bin` or `libexec\git-core` */
|
||||
if (strip_suffix_mem(prefix, &len, "\\mingw64\\libexec\\git-core") ||
|
||||
strip_suffix_mem(prefix, &len, "\\mingw64\\bin"))
|
||||
off += xsnprintf(path + off, size - off,
|
||||
"%.*s\\mingw64\\bin;", (int)len, prefix);
|
||||
else if (strip_suffix_mem(prefix, &len, "\\mingw32\\libexec\\git-core") ||
|
||||
strip_suffix_mem(prefix, &len, "\\mingw32\\bin"))
|
||||
off += xsnprintf(path + off, size - off,
|
||||
"%.*s\\mingw32\\bin;", (int)len, prefix);
|
||||
else if (strip_suffix_mem(prefix, &len, "\\cmd") ||
|
||||
strip_suffix_mem(prefix, &len, "\\bin") ||
|
||||
strip_suffix_mem(prefix, &len, "\\libexec\\git-core"))
|
||||
off += xsnprintf(path + off, size - off,
|
||||
"%.*s\\mingw%d\\bin;", (int)len, prefix,
|
||||
(int)(sizeof(void *) * 8));
|
||||
else
|
||||
return 0;
|
||||
|
||||
off += xsnprintf(path + off, size - off,
|
||||
"%.*s\\usr\\bin;", (int)len, prefix);
|
||||
return off;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static int is_system32_path(const char *path)
|
||||
{
|
||||
WCHAR system32[MAX_PATH], wpath[MAX_PATH];
|
||||
|
||||
if (xutftowcs_path(wpath, path) < 0 ||
|
||||
!GetSystemDirectoryW(system32, ARRAY_SIZE(system32)) ||
|
||||
_wcsicmp(system32, wpath))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void setup_windows_environment(void)
|
||||
{
|
||||
char *tmp = getenv("TMPDIR");
|
||||
@@ -2617,9 +2902,20 @@ static void setup_windows_environment(void)
|
||||
convert_slashes(tmp);
|
||||
}
|
||||
|
||||
/* simulate TERM to enable auto-color (see color.c) */
|
||||
if (!getenv("TERM"))
|
||||
setenv("TERM", "cygwin", 1);
|
||||
|
||||
/*
|
||||
* Make sure TERM is set up correctly to enable auto-color
|
||||
* (see color.c .) Use "cygwin" for older OS releases which
|
||||
* works correctly with MSYS2 utilities on older consoles.
|
||||
*/
|
||||
if (!getenv("TERM")) {
|
||||
if ((GetVersion() >> 16) < 15063)
|
||||
setenv("TERM", "cygwin", 0);
|
||||
else {
|
||||
setenv("TERM", "xterm-256color", 0);
|
||||
setenv("COLORTERM", "truecolor", 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* calculate HOME if not set */
|
||||
if (!getenv("HOME")) {
|
||||
@@ -2633,7 +2929,8 @@ static void setup_windows_environment(void)
|
||||
strbuf_addstr(&buf, tmp);
|
||||
if ((tmp = getenv("HOMEPATH"))) {
|
||||
strbuf_addstr(&buf, tmp);
|
||||
if (is_directory(buf.buf))
|
||||
if (!is_system32_path(buf.buf) &&
|
||||
is_directory(buf.buf))
|
||||
setenv("HOME", buf.buf, 1);
|
||||
else
|
||||
tmp = NULL; /* use $USERPROFILE */
|
||||
@@ -2644,6 +2941,37 @@ static void setup_windows_environment(void)
|
||||
if (!tmp && (tmp = getenv("USERPROFILE")))
|
||||
setenv("HOME", tmp, 1);
|
||||
}
|
||||
|
||||
if (!getenv("PLINK_PROTOCOL"))
|
||||
setenv("PLINK_PROTOCOL", "ssh", 0);
|
||||
|
||||
#ifdef ENSURE_MSYSTEM_IS_SET
|
||||
if (!(tmp = getenv("MSYSTEM")) || !tmp[0]) {
|
||||
const char *home = getenv("HOME"), *path = getenv("PATH");
|
||||
char buf[32768];
|
||||
size_t off = 0;
|
||||
|
||||
xsnprintf(buf, sizeof(buf),
|
||||
"MINGW%d", (int)(sizeof(void *) * 8));
|
||||
setenv("MSYSTEM", buf, 1);
|
||||
|
||||
if (home)
|
||||
off += xsnprintf(buf + off, sizeof(buf) - off,
|
||||
"%s\\bin;", home);
|
||||
off += append_system_bin_dirs(buf + off, sizeof(buf) - off);
|
||||
if (path)
|
||||
off += xsnprintf(buf + off, sizeof(buf) - off,
|
||||
"%s", path);
|
||||
else if (off > 0)
|
||||
buf[off - 1] = '\0';
|
||||
else
|
||||
buf[0] = '\0';
|
||||
setenv("PATH", buf, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!getenv("LC_ALL") && !getenv("LC_CTYPE") && !getenv("LANG"))
|
||||
setenv("LC_CTYPE", "C.UTF-8", 1);
|
||||
}
|
||||
|
||||
static PSID get_current_user_sid(void)
|
||||
@@ -2707,11 +3035,10 @@ int is_path_owned_by_current_sid(const char *path)
|
||||
DACL_SECURITY_INFORMATION,
|
||||
&sid, NULL, NULL, NULL, &descriptor);
|
||||
|
||||
if (err != ERROR_SUCCESS)
|
||||
error(_("failed to get owner for '%s' (%ld)"), path, err);
|
||||
else if (sid && IsValidSid(sid)) {
|
||||
if (err == ERROR_SUCCESS && sid && IsValidSid(sid)) {
|
||||
/* Now, verify that the SID matches the current user's */
|
||||
static PSID current_user_sid;
|
||||
BOOL is_member;
|
||||
|
||||
if (!current_user_sid)
|
||||
current_user_sid = get_current_user_sid();
|
||||
@@ -2720,6 +3047,35 @@ int is_path_owned_by_current_sid(const char *path)
|
||||
IsValidSid(current_user_sid) &&
|
||||
EqualSid(sid, current_user_sid))
|
||||
result = 1;
|
||||
else if (IsWellKnownSid(sid, WinBuiltinAdministratorsSid) &&
|
||||
CheckTokenMembership(NULL, sid, &is_member) &&
|
||||
is_member)
|
||||
/*
|
||||
* If owned by the Administrators group, and the
|
||||
* current user is an administrator, we consider that
|
||||
* okay, too.
|
||||
*/
|
||||
result = 1;
|
||||
else if (git_env_bool("GIT_TEST_DEBUG_UNSAFE_DIRECTORIES", 0)) {
|
||||
LPSTR str1, str2, to_free1 = NULL, to_free2 = NULL;
|
||||
|
||||
if (ConvertSidToStringSidA(sid, &str1))
|
||||
to_free1 = str1;
|
||||
else
|
||||
str1 = "(inconvertible)";
|
||||
|
||||
if (!current_user_sid)
|
||||
str2 = "(none)";
|
||||
else if (!IsValidSid(current_user_sid))
|
||||
str2 = "(invalid)";
|
||||
else if (ConvertSidToStringSidA(current_user_sid, &str2))
|
||||
to_free2 = str2;
|
||||
else
|
||||
str2 = "(inconvertible)";
|
||||
warning("'%s' is owned by:\n\t'%s'\nbut the current user is:\n\t'%s'", path, str1, str2);
|
||||
LocalFree(to_free1);
|
||||
LocalFree(to_free2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2974,6 +3330,7 @@ int wmain(int argc, const wchar_t **wargv)
|
||||
#endif
|
||||
|
||||
maybe_redirect_std_handles();
|
||||
fsync_object_files = 1;
|
||||
|
||||
/* determine size of argv and environ conversion buffer */
|
||||
maxlen = wcslen(wargv[0]);
|
||||
|
||||
@@ -449,9 +449,16 @@ static inline void convert_slashes(char *path)
|
||||
if (*path == '\\')
|
||||
*path = '/';
|
||||
}
|
||||
struct strbuf;
|
||||
int mingw_is_mount_point(struct strbuf *path);
|
||||
#define is_mount_point mingw_is_mount_point
|
||||
#define CAN_UNLINK_MOUNT_POINTS 1
|
||||
#define PATH_SEP ';'
|
||||
char *mingw_query_user_email(void);
|
||||
#define query_user_email mingw_query_user_email
|
||||
struct strbuf;
|
||||
char *mingw_strbuf_realpath(struct strbuf *resolved, const char *path);
|
||||
#define platform_strbuf_realpath mingw_strbuf_realpath
|
||||
#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
|
||||
#define PRIuMAX "I64u"
|
||||
#define PRId64 "I64d"
|
||||
|
||||
@@ -6,7 +6,11 @@ The Steps to Build Git with VS2015 or VS2017 from the command line.
|
||||
Prompt or from an SDK bash window:
|
||||
|
||||
$ cd <repo_root>
|
||||
$ ./compat/vcbuild/vcpkg_install.bat
|
||||
$ ./compat/vcbuild/vcpkg_install.bat x64-windows
|
||||
|
||||
or
|
||||
|
||||
$ ./compat/vcbuild/vcpkg_install.bat arm64-windows
|
||||
|
||||
The vcpkg tools and all of the third-party sources will be installed
|
||||
in this folder:
|
||||
@@ -37,27 +41,17 @@ The Steps to Build Git with VS2015 or VS2017 from the command line.
|
||||
|
||||
================================================================
|
||||
|
||||
Alternatively, run `make vcxproj` and then load the generated `git.sln` in
|
||||
Visual Studio. The initial build will install the vcpkg system and build the
|
||||
Alternatively, just open Git's top-level directory in Visual Studio, via
|
||||
`File>Open>Folder...`. This will use CMake internally to generate the
|
||||
project definitions. It will also install the vcpkg system and build the
|
||||
dependencies automatically. This will take a while.
|
||||
|
||||
Instead of generating the `git.sln` file yourself (which requires a full Git
|
||||
for Windows SDK), you may want to consider fetching the `vs/master` branch of
|
||||
https://github.com/git-for-windows/git instead (which is updated automatically
|
||||
via CI running `make vcxproj`). The `vs/master` branch does not require a Git
|
||||
for Windows to build, but you can run the test scripts in a regular Git Bash.
|
||||
You can also generate the Visual Studio solution manually by downloading
|
||||
and running CMake explicitly rather than letting Visual Studio doing
|
||||
that implicitly.
|
||||
|
||||
Note that `make vcxproj` will automatically add and commit the generated `.sln`
|
||||
and `.vcxproj` files to the repo. This is necessary to allow building a
|
||||
fully-testable Git in Visual Studio, where a regular Git Bash can be used to
|
||||
run the test scripts (as opposed to a full Git for Windows SDK): a number of
|
||||
build targets, such as Git commands implemented as Unix shell scripts (where
|
||||
`@@SHELL_PATH@@` and other placeholders are interpolated) require a full-blown
|
||||
Git for Windows SDK (which is about 10x the size of a regular Git for Windows
|
||||
installation).
|
||||
|
||||
If your plan is to open a Pull Request with Git for Windows, it is a good idea
|
||||
to drop this commit before submitting.
|
||||
Another, deprecated option is to run `make vcxproj`. This option is
|
||||
superseded by the CMake-based build, and will be removed at some point.
|
||||
|
||||
================================================================
|
||||
The Steps of Build Git with VS2008
|
||||
|
||||
@@ -99,6 +99,7 @@ REM ================================================================
|
||||
|
||||
SET sdk_dir=%WindowsSdkDir%
|
||||
SET sdk_ver=%WindowsSDKVersion%
|
||||
SET sdk_ver_bin_dir=%WindowsSdkVerBinPath%%tgt%
|
||||
SET si=%sdk_dir%Include\%sdk_ver%
|
||||
SET sdk_includes=-I"%si%ucrt" -I"%si%um" -I"%si%shared"
|
||||
SET sl=%sdk_dir%lib\%sdk_ver%
|
||||
@@ -130,6 +131,7 @@ REM ================================================================
|
||||
|
||||
SET sdk_dir=%WindowsSdkDir%
|
||||
SET sdk_ver=%WindowsSDKVersion%
|
||||
SET sdk_ver_bin_dir=%WindowsSdkVerBinPath%bin\amd64
|
||||
SET si=%sdk_dir%Include\%sdk_ver%
|
||||
SET sdk_includes=-I"%si%ucrt" -I"%si%um" -I"%si%shared" -I"%si%winrt"
|
||||
SET sl=%sdk_dir%lib\%sdk_ver%
|
||||
@@ -160,6 +162,11 @@ REM ================================================================
|
||||
echo msvc_includes=%msvc_includes%
|
||||
echo msvc_libs=%msvc_libs%
|
||||
|
||||
echo sdk_ver_bin_dir=%sdk_ver_bin_dir%
|
||||
SET X1=%sdk_ver_bin_dir:C:=/C%
|
||||
SET X2=%X1:\=/%
|
||||
echo sdk_ver_bin_dir_msys=%X2%
|
||||
|
||||
echo sdk_includes=%sdk_includes%
|
||||
echo sdk_libs=%sdk_libs%
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ my @cflags = ();
|
||||
my @lflags = ();
|
||||
my $is_linking = 0;
|
||||
my $is_debug = 0;
|
||||
my $is_gui = 0;
|
||||
while (@ARGV) {
|
||||
my $arg = shift @ARGV;
|
||||
if ("$arg" eq "-DDEBUG") {
|
||||
@@ -56,7 +57,8 @@ while (@ARGV) {
|
||||
# need to use that instead?
|
||||
foreach my $flag (@lflags) {
|
||||
if ($flag =~ /^-LIBPATH:(.*)/) {
|
||||
foreach my $l ("libcurl_imp.lib", "libcurl.lib") {
|
||||
my $libcurl = $is_debug ? "libcurl-d.lib" : "libcurl.lib";
|
||||
foreach my $l ("libcurl_imp.lib", $libcurl) {
|
||||
if (-f "$1/$l") {
|
||||
$lib = $l;
|
||||
last;
|
||||
@@ -66,7 +68,11 @@ while (@ARGV) {
|
||||
}
|
||||
push(@args, $lib);
|
||||
} elsif ("$arg" eq "-lexpat") {
|
||||
if ($is_debug) {
|
||||
push(@args, "libexpatd.lib");
|
||||
} else {
|
||||
push(@args, "libexpat.lib");
|
||||
}
|
||||
} elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") {
|
||||
$arg =~ s/^-L/-LIBPATH:/;
|
||||
push(@lflags, $arg);
|
||||
@@ -118,11 +124,23 @@ while (@ARGV) {
|
||||
push(@cflags, "-wd4996");
|
||||
} elsif ("$arg" =~ /^-W[a-z]/) {
|
||||
# let's ignore those
|
||||
} elsif ("$arg" eq "-fno-stack-protector") {
|
||||
# eat this
|
||||
} elsif ("$arg" eq "-mwindows") {
|
||||
$is_gui = 1;
|
||||
} else {
|
||||
push(@args, $arg);
|
||||
}
|
||||
}
|
||||
if ($is_linking) {
|
||||
if ($is_gui) {
|
||||
push(@args, "-ENTRY:wWinMainCRTStartup");
|
||||
push(@args, "-SUBSYSTEM:WINDOWS");
|
||||
} else {
|
||||
push(@args, "-ENTRY:wmainCRTStartup");
|
||||
push(@args, "-SUBSYSTEM:CONSOLE");
|
||||
}
|
||||
|
||||
push(@args, @lflags);
|
||||
unshift(@args, "link.exe");
|
||||
} else {
|
||||
|
||||
46
compat/vcbuild/scripts/rc.pl
Normal file
46
compat/vcbuild/scripts/rc.pl
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/perl -w
|
||||
######################################################################
|
||||
# Compile Resources on Windows
|
||||
#
|
||||
# This is a wrapper to facilitate the compilation of Git with MSVC
|
||||
# using GNU Make as the build system. So, instead of manipulating the
|
||||
# Makefile into something nasty, just to support non-space arguments
|
||||
# etc, we use this wrapper to fix the command line options
|
||||
#
|
||||
######################################################################
|
||||
use strict;
|
||||
my @args = ();
|
||||
my @input = ();
|
||||
|
||||
while (@ARGV) {
|
||||
my $arg = shift @ARGV;
|
||||
if ("$arg" =~ /^-[dD]/) {
|
||||
# GIT_VERSION gets passed with too many
|
||||
# layers of dquote escaping.
|
||||
$arg =~ s/\\"/"/g;
|
||||
|
||||
push(@args, $arg);
|
||||
|
||||
} elsif ("$arg" eq "-i") {
|
||||
my $arg = shift @ARGV;
|
||||
# TODO complain if NULL or is dashed ??
|
||||
push(@input, $arg);
|
||||
|
||||
} elsif ("$arg" eq "-o") {
|
||||
my $arg = shift @ARGV;
|
||||
# TODO complain if NULL or is dashed ??
|
||||
push(@args, "-fo$arg");
|
||||
|
||||
} else {
|
||||
push(@args, $arg);
|
||||
}
|
||||
}
|
||||
|
||||
push(@args, "-nologo");
|
||||
push(@args, "-v");
|
||||
push(@args, @input);
|
||||
|
||||
unshift(@args, "rc.exe");
|
||||
printf("**** @args\n");
|
||||
|
||||
exit (system(@args) != 0);
|
||||
@@ -15,7 +15,12 @@ REM ================================================================
|
||||
@FOR /F "delims=" %%D IN ("%~dp0") DO @SET cwd=%%~fD
|
||||
cd %cwd%
|
||||
|
||||
SET arch=x64-windows
|
||||
SET arch=%2
|
||||
IF NOT DEFINED arch (
|
||||
echo defaulting to 'x64-windows`. Invoke %0 with 'x86-windows', 'x64-windows', or 'arm64-windows'
|
||||
set arch=x64-windows
|
||||
)
|
||||
|
||||
SET inst=%cwd%vcpkg\installed\%arch%
|
||||
|
||||
IF [%1]==[release] (
|
||||
|
||||
@@ -31,11 +31,24 @@ REM ================================================================
|
||||
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
|
||||
SET arch=%1
|
||||
IF NOT DEFINED arch (
|
||||
echo defaulting to 'x64-windows`. Invoke %0 with 'x86-windows', 'x64-windows', or 'arm64-windows'
|
||||
set arch=x64-windows
|
||||
)
|
||||
|
||||
@FOR /F "delims=" %%D IN ("%~dp0") DO @SET cwd=%%~fD
|
||||
cd %cwd%
|
||||
|
||||
dir vcpkg\vcpkg.exe >nul 2>nul && GOTO :install_libraries
|
||||
|
||||
git.exe version 2>nul
|
||||
IF ERRORLEVEL 1 (
|
||||
echo "***"
|
||||
echo "Git not found. Please adjust your CMD path or Git install option."
|
||||
echo "***"
|
||||
EXIT /B 1 )
|
||||
|
||||
echo Fetching vcpkg in %cwd%vcpkg
|
||||
git.exe clone https://github.com/Microsoft/vcpkg vcpkg
|
||||
IF ERRORLEVEL 1 ( EXIT /B 1 )
|
||||
@@ -48,9 +61,8 @@ REM ================================================================
|
||||
echo Successfully installed %cwd%vcpkg\vcpkg.exe
|
||||
|
||||
:install_libraries
|
||||
SET arch=x64-windows
|
||||
|
||||
echo Installing third-party libraries...
|
||||
echo Installing third-party libraries(%arch%)...
|
||||
FOR %%i IN (zlib expat libiconv openssl libssh2 curl) DO (
|
||||
cd %cwd%vcpkg
|
||||
IF NOT EXIST "packages\%%i_%arch%" CALL :sub__install_one %%i
|
||||
@@ -73,8 +85,47 @@ REM ================================================================
|
||||
:sub__install_one
|
||||
echo Installing package %1...
|
||||
|
||||
.\vcpkg.exe install %1:%arch%
|
||||
call :%1_features
|
||||
|
||||
REM vcpkg may not be reliable on slow, intermittent or proxy
|
||||
REM connections, see e.g.
|
||||
REM https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/4a8f7be5-5e15-4213-a7bb-ddf424a954e6/winhttpsendrequest-ends-with-12002-errorhttptimeout-after-21-seconds-no-matter-what-timeout?forum=windowssdk
|
||||
REM which explains the hidden 21 second timeout
|
||||
REM (last post by Dave : Microsoft - Windows Networking team)
|
||||
|
||||
.\vcpkg.exe install %1%features%:%arch%
|
||||
IF ERRORLEVEL 1 ( EXIT /B 1 )
|
||||
|
||||
echo Finished %1
|
||||
goto :EOF
|
||||
|
||||
::
|
||||
:: features for each vcpkg to install
|
||||
:: there should be an entry here for each package to install
|
||||
:: 'set features=' means use the default otherwise
|
||||
:: 'set features=[comma-delimited-feature-set]' is the syntax
|
||||
::
|
||||
|
||||
:zlib_features
|
||||
set features=
|
||||
goto :EOF
|
||||
|
||||
:expat_features
|
||||
set features=
|
||||
goto :EOF
|
||||
|
||||
:libiconv_features
|
||||
set features=
|
||||
goto :EOF
|
||||
|
||||
:openssl_features
|
||||
set features=
|
||||
goto :EOF
|
||||
|
||||
:libssh2_features
|
||||
set features=
|
||||
goto :EOF
|
||||
|
||||
:curl_features
|
||||
set features=[core,openssl,schannel]
|
||||
goto :EOF
|
||||
|
||||
115
compat/win32/headless.c
Normal file
115
compat/win32/headless.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* headless Git - run Git without opening a console window on Windows
|
||||
*/
|
||||
|
||||
#define STRICT
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/*
|
||||
* If `dir` contains the path to a Git exec directory, extend `PATH` to
|
||||
* include the corresponding `bin/` directory (which is where all those
|
||||
* `.dll` files needed by `git.exe` are, on Windows).
|
||||
*/
|
||||
static int extend_path(wchar_t *dir, size_t dir_len)
|
||||
{
|
||||
const wchar_t *suffix = L"\\libexec\\git-core";
|
||||
size_t suffix_len = wcslen(suffix);
|
||||
wchar_t *env;
|
||||
DWORD len;
|
||||
|
||||
if (dir_len < suffix_len)
|
||||
return 0;
|
||||
|
||||
dir_len -= suffix_len;
|
||||
if (memcmp(dir + dir_len, suffix, suffix_len * sizeof(wchar_t)))
|
||||
return 0;
|
||||
|
||||
len = GetEnvironmentVariableW(L"PATH", NULL, 0);
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
env = _alloca((dir_len + 5 + len) * sizeof(wchar_t));
|
||||
wcsncpy(env, dir, dir_len);
|
||||
wcscpy(env + dir_len, L"\\bin;");
|
||||
if (!GetEnvironmentVariableW(L"PATH", env + dir_len + 5, len))
|
||||
return 0;
|
||||
|
||||
SetEnvironmentVariableW(L"PATH", env);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int WINAPI wWinMain(_In_ HINSTANCE instance,
|
||||
_In_opt_ HINSTANCE previous_instance,
|
||||
_In_ LPWSTR command_line, _In_ int show)
|
||||
{
|
||||
wchar_t git_command_line[32768];
|
||||
size_t size = sizeof(git_command_line) / sizeof(wchar_t);
|
||||
const wchar_t *needs_quotes = L"";
|
||||
int slash = 0, i;
|
||||
|
||||
STARTUPINFO startup_info = {
|
||||
.cb = sizeof(STARTUPINFO),
|
||||
.dwFlags = STARTF_USESHOWWINDOW,
|
||||
.wShowWindow = SW_HIDE,
|
||||
};
|
||||
PROCESS_INFORMATION process_info = { 0 };
|
||||
DWORD creation_flags = CREATE_UNICODE_ENVIRONMENT |
|
||||
CREATE_NEW_CONSOLE | CREATE_NO_WINDOW;
|
||||
DWORD exit_code;
|
||||
|
||||
/* First, determine the full path of argv[0] */
|
||||
for (i = 0; _wpgmptr[i]; i++)
|
||||
if (_wpgmptr[i] == L' ')
|
||||
needs_quotes = L"\"";
|
||||
else if (_wpgmptr[i] == L'\\')
|
||||
slash = i;
|
||||
|
||||
if (slash >= size - 11)
|
||||
return 127; /* Too long path */
|
||||
|
||||
/* If it is in Git's exec path, add the bin/ directory to the PATH */
|
||||
extend_path(_wpgmptr, slash);
|
||||
|
||||
/* Then, add the full path of `git.exe` as argv[0] */
|
||||
i = swprintf_s(git_command_line, size, L"%ls%.*ls\\git.exe%ls",
|
||||
needs_quotes, slash, _wpgmptr, needs_quotes);
|
||||
if (i < 0)
|
||||
return 127; /* Too long path */
|
||||
|
||||
if (*command_line) {
|
||||
/* Now, append the command-line arguments */
|
||||
i = swprintf_s(git_command_line + i, size - i,
|
||||
L" %ls", command_line);
|
||||
if (i < 0)
|
||||
return 127;
|
||||
}
|
||||
|
||||
startup_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
startup_info.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
startup_info.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
|
||||
if (!CreateProcess(NULL, /* infer argv[0] from the command line */
|
||||
git_command_line, /* modified command line */
|
||||
NULL, /* inherit process handles? */
|
||||
NULL, /* inherit thread handles? */
|
||||
FALSE, /* handles inheritable? */
|
||||
creation_flags,
|
||||
NULL, /* use this process' environment */
|
||||
NULL, /* use this process' working directory */
|
||||
&startup_info, &process_info))
|
||||
return 129; /* could not start */
|
||||
WaitForSingleObject(process_info.hProcess, INFINITE);
|
||||
if (!GetExitCodeProcess(process_info.hProcess, &exit_code))
|
||||
exit_code = 130; /* Could not determine exit code? */
|
||||
|
||||
CloseHandle(process_info.hProcess);
|
||||
CloseHandle(process_info.hThread);
|
||||
|
||||
return (int)exit_code;
|
||||
}
|
||||
2
config.c
2
config.c
@@ -1463,7 +1463,7 @@ int git_config_color(char *dest, const char *var, const char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int git_default_core_config(const char *var, const char *value, void *cb)
|
||||
int git_default_core_config(const char *var, const char *value, void *cb)
|
||||
{
|
||||
/* This needs a better name */
|
||||
if (!strcmp(var, "core.filemode")) {
|
||||
|
||||
1
config.h
1
config.h
@@ -131,6 +131,7 @@ struct config_options {
|
||||
typedef int (*config_fn_t)(const char *, const char *, void *);
|
||||
|
||||
int git_default_config(const char *, const char *, void *);
|
||||
int git_default_core_config(const char *var, const char *value, void *cb);
|
||||
|
||||
/**
|
||||
* Read a specific file in git-config format.
|
||||
|
||||
@@ -425,7 +425,7 @@ ifeq ($(uname_S),Windows)
|
||||
# link.exe next to, and required by, cl.exe, we have to prepend this
|
||||
# onto the existing $PATH.
|
||||
#
|
||||
SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
|
||||
SANE_TOOL_PATH ?= $(msvc_bin_dir_msys):$(sdk_ver_bin_dir_msys)
|
||||
HAVE_ALLOCA_H = YesPlease
|
||||
NO_PREAD = YesPlease
|
||||
NEEDS_CRYPTO_WITH_SSL = YesPlease
|
||||
@@ -487,13 +487,15 @@ endif
|
||||
compat/win32/pthread.o compat/win32/syslog.o \
|
||||
compat/win32/trace2_win32_process_info.o \
|
||||
compat/win32/dirent.o
|
||||
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
|
||||
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
|
||||
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DENSURE_MSYSTEM_IS_SET -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
|
||||
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO
|
||||
# invalidcontinue.obj allows Git's source code to close the same file
|
||||
# handle twice, or to access the osfhandle of an already-closed stdout
|
||||
# See https://msdn.microsoft.com/en-us/library/ms235330.aspx
|
||||
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
|
||||
GITLIBS += git.res
|
||||
PTHREAD_LIBS =
|
||||
RC = compat/vcbuild/scripts/rc.pl
|
||||
lib =
|
||||
BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
|
||||
ifndef DEBUG
|
||||
@@ -525,6 +527,8 @@ else
|
||||
endif
|
||||
X = .exe
|
||||
|
||||
EXTRA_PROGRAMS += headless-git$X
|
||||
|
||||
compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
|
||||
endif
|
||||
ifeq ($(uname_S),Interix)
|
||||
@@ -678,6 +682,7 @@ ifeq ($(uname_S),MINGW)
|
||||
RC = windres -O coff
|
||||
NATIVE_CRLF = YesPlease
|
||||
X = .exe
|
||||
EXTRA_PROGRAMS += headless-git$X
|
||||
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
|
||||
htmldir = doc/git/html/
|
||||
prefix =
|
||||
@@ -712,7 +717,7 @@ else
|
||||
endif
|
||||
CC = gcc
|
||||
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
|
||||
-fstack-protector-strong
|
||||
-DENSURE_MSYSTEM_IS_SET -fstack-protector-strong
|
||||
EXTLIBS += -lntdll
|
||||
INSTALL = /bin/install
|
||||
INTERNAL_QSORT = YesPlease
|
||||
@@ -722,6 +727,7 @@ else
|
||||
USE_LIBPCRE = YesPlease
|
||||
NO_CURL =
|
||||
USE_NED_ALLOCATOR = YesPlease
|
||||
NO_PYTHON =
|
||||
ifeq (/mingw64,$(subst 32,64,$(prefix)))
|
||||
# Move system config into top-level /etc/
|
||||
ETC_GITCONFIG = ../etc/gitconfig
|
||||
@@ -756,7 +762,7 @@ vcxproj:
|
||||
|
||||
# Make .vcxproj files and add them
|
||||
perl contrib/buildsystems/generate -g Vcxproj
|
||||
git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
|
||||
git add -f git.sln {*,*/lib.proj,t/helper/*}/*.vcxproj
|
||||
|
||||
# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
|
||||
(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
|
||||
@@ -766,7 +772,7 @@ vcxproj:
|
||||
echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
|
||||
done && \
|
||||
echo ' </Target>' && \
|
||||
echo '</Project>') >git/LinkOrCopyBuiltins.targets
|
||||
echo '</Project>') >git.proj/LinkOrCopyBuiltins.targets
|
||||
(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
|
||||
echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
|
||||
for name in $(REMOTE_CURL_ALIASES); \
|
||||
@@ -774,8 +780,8 @@ vcxproj:
|
||||
echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
|
||||
done && \
|
||||
echo ' </Target>' && \
|
||||
echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
|
||||
git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
|
||||
echo '</Project>') >git-remote-http.proj/LinkOrCopyRemoteHttp.targets
|
||||
git add -f git.proj/LinkOrCopyBuiltins.targets git-remote-http.proj/LinkOrCopyRemoteHttp.targets
|
||||
|
||||
# Add generated headers
|
||||
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
|
||||
|
||||
@@ -14,6 +14,11 @@ Note: Visual Studio also has the option of opening `CMakeLists.txt`
|
||||
directly; Using this option, Visual Studio will not find the source code,
|
||||
though, therefore the `File>Open>Folder...` option is preferred.
|
||||
|
||||
Visual Studio does not produce a .sln solution file nor the .vcxproj files
|
||||
that may be required by VS extension tools.
|
||||
|
||||
To generate the .sln/.vcxproj files run CMake manually, as described below.
|
||||
|
||||
Instructions to run CMake manually:
|
||||
|
||||
mkdir -p contrib/buildsystems/out
|
||||
@@ -22,7 +27,7 @@ Instructions to run CMake manually:
|
||||
|
||||
This will build the git binaries in contrib/buildsystems/out
|
||||
directory (our top-level .gitignore file knows to ignore contents of
|
||||
this directory).
|
||||
this directory). The project .sln and .vcxproj files are also generated.
|
||||
|
||||
Possible build configurations(-DCMAKE_BUILD_TYPE) with corresponding
|
||||
compiler flags
|
||||
@@ -35,17 +40,16 @@ empty(default) :
|
||||
NOTE: -DCMAKE_BUILD_TYPE is optional. For multi-config generators like Visual Studio
|
||||
this option is ignored
|
||||
|
||||
This process generates a Makefile(Linux/*BSD/MacOS) , Visual Studio solution(Windows) by default.
|
||||
This process generates a Makefile(Linux/*BSD/MacOS), Visual Studio solution(Windows) by default.
|
||||
Run `make` to build Git on Linux/*BSD/MacOS.
|
||||
Open git.sln on Windows and build Git.
|
||||
|
||||
NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studio in Windows,
|
||||
to use another tool say `ninja` add this to the command line when configuring.
|
||||
`-G Ninja`
|
||||
|
||||
NOTE: By default CMake will install vcpkg locally to your source tree on configuration,
|
||||
to avoid this, add `-DNO_VCPKG=TRUE` to the command line when configuring.
|
||||
|
||||
The Visual Studio default generator changed in v16.6 from its Visual Studio
|
||||
implemenation to `Ninja` This required changes to many CMake scripts.
|
||||
|
||||
]]
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
@@ -59,15 +63,29 @@ endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
||||
message("settting CMAKE_EXPORT_COMPILE_COMMANDS: ${CMAKE_EXPORT_COMPILE_COMMANDS}")
|
||||
endif()
|
||||
|
||||
if(USE_VCPKG)
|
||||
set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
|
||||
message("WIN32: ${WIN32}") # show its underlying text values
|
||||
message("VCPKG_DIR: ${VCPKG_DIR}")
|
||||
message("VCPKG_ARCH: ${VCPKG_ARCH}") # maybe unset
|
||||
message("MSVC: ${MSVC}")
|
||||
message("CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
|
||||
message("CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
message("CMAKE_GENERATOR_PLATFORM: ${CMAKE_GENERATOR_PLATFORM}")
|
||||
message("CMAKE_EXPORT_COMPILE_COMMANDS: ${CMAKE_EXPORT_COMPILE_COMMANDS}")
|
||||
message("ENV(CMAKE_EXPORT_COMPILE_COMMANDS): $ENV{CMAKE_EXPORT_COMPILE_COMMANDS}")
|
||||
if(NOT EXISTS ${VCPKG_DIR})
|
||||
message("Initializing vcpkg and building the Git's dependencies (this will take a while...)")
|
||||
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat)
|
||||
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat ${VCPKG_ARCH})
|
||||
endif()
|
||||
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIR}/installed/x64-windows")
|
||||
if(NOT EXISTS ${VCPKG_ARCH})
|
||||
message("VCPKG_ARCH: unset, using 'x64-windows'")
|
||||
set(VCPKG_ARCH "x64-windows") # default from vcpkg_install.bat
|
||||
endif()
|
||||
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIR}/installed/${VCPKG_ARCH}")
|
||||
|
||||
# In the vcpkg edition, we need this to be able to link to libcurl
|
||||
set(CURL_NO_CURL_CMAKE ON)
|
||||
@@ -77,7 +95,7 @@ if(USE_VCPKG)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
|
||||
endif()
|
||||
|
||||
find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin")
|
||||
find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin" "$ENV{LOCALAPPDATA}/Programs/Git/bin")
|
||||
if(NOT SH_EXE)
|
||||
message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one."
|
||||
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
|
||||
@@ -223,7 +241,14 @@ endif()
|
||||
|
||||
#default behaviour
|
||||
include_directories(${CMAKE_SOURCE_DIR})
|
||||
add_compile_definitions(GIT_HOST_CPU="${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
|
||||
# which the built Git will run (for instance "x86_64").
|
||||
if(NOT HOST_CPU)
|
||||
add_compile_definitions(GIT_HOST_CPU="${CMAKE_SYSTEM_PROCESSOR}")
|
||||
else()
|
||||
add_compile_definitions(GIT_HOST_CPU="${HOST_CPU}")
|
||||
endif()
|
||||
add_compile_definitions(SHA256_BLK INTERNAL_QSORT RUNTIME_PREFIX)
|
||||
add_compile_definitions(NO_OPENSSL SHA1_DC SHA1DC_NO_STANDARD_INCLUDES
|
||||
SHA1DC_INIT_SAFE_HASH_DEFAULT=0
|
||||
@@ -734,6 +759,15 @@ if(WIN32)
|
||||
else()
|
||||
message(FATAL_ERROR "Unhandled compiler: ${CMAKE_C_COMPILER_ID}")
|
||||
endif()
|
||||
|
||||
add_executable(headless-git ${CMAKE_SOURCE_DIR}/compat/win32/headless.c)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_link_options(headless-git PUBLIC -municode -Wl,-subsystem,windows)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
target_link_options(headless-git PUBLIC /NOLOGO /ENTRY:wWinMainCRTStartup /SUBSYSTEM:WINDOWS)
|
||||
else()
|
||||
message(FATAL_ERROR "Unhandled compiler: ${CMAKE_C_COMPILER_ID}")
|
||||
endif()
|
||||
elseif(UNIX)
|
||||
target_link_libraries(common-main pthread rt)
|
||||
endif()
|
||||
@@ -1061,7 +1095,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PRE
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
|
||||
if(USE_VCPKG)
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/${VCPKG_ARCH}/bin\"\n")
|
||||
endif()
|
||||
|
||||
#Make the tests work when building out of the source tree
|
||||
|
||||
@@ -58,8 +58,8 @@ sub createProject {
|
||||
my $uuid = generate_guid($name);
|
||||
$$build_structure{"$prefix${target}_GUID"} = $uuid;
|
||||
my $vcxproj = $target;
|
||||
$vcxproj =~ s/(.*\/)?(.*)/$&\/$2.vcxproj/;
|
||||
$vcxproj =~ s/([^\/]*)(\/lib)\/(lib.vcxproj)/$1$2\/$1_$3/;
|
||||
$vcxproj =~ s/(.*\/)?(.*)/$&.proj\/$2.vcxproj/;
|
||||
$vcxproj =~ s/([^\/]*)(\/lib\.proj)\/(lib.vcxproj)/$1$2\/$1_$3/;
|
||||
$$build_structure{"$prefix${target}_VCXPROJ"} = $vcxproj;
|
||||
|
||||
my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"$prefix${name}_SOURCES"}}));
|
||||
@@ -76,7 +76,7 @@ sub createProject {
|
||||
|
||||
my $libs_release = "\n ";
|
||||
my $libs_debug = "\n ";
|
||||
if (!$static_library) {
|
||||
if (!$static_library && $name ne 'headless-git') {
|
||||
$libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
|
||||
$libs_debug = $libs_release;
|
||||
$libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
|
||||
@@ -89,7 +89,19 @@ sub createProject {
|
||||
$defines =~ s/>/>/g;
|
||||
$defines =~ s/\'//g;
|
||||
|
||||
die "Could not create the directory $target for $label project!\n" unless (-d "$target" || mkdir "$target");
|
||||
my $rcdefines = $defines;
|
||||
$rcdefines =~ s/(?<!\\)"/\\$&/g;
|
||||
|
||||
my $entrypoint = 'wmainCRTStartup';
|
||||
my $subsystem = 'Console';
|
||||
if (grep /^-mwindows$/, @{$$build_structure{"$prefix${name}_LFLAGS"}}) {
|
||||
$entrypoint = 'wWinMainCRTStartup';
|
||||
$subsystem = 'Windows';
|
||||
}
|
||||
|
||||
my $dir = $vcxproj;
|
||||
$dir =~ s/\/[^\/]*$//;
|
||||
die "Could not create the directory $dir for $label project!\n" unless (-d "$dir" || mkdir "$dir");
|
||||
|
||||
open F, ">$vcxproj" or die "Could not open $vcxproj for writing!\n";
|
||||
binmode F, ":crlf :utf8";
|
||||
@@ -114,12 +126,21 @@ sub createProject {
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>$uuid</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<VCPKGArch Condition="'\$(Platform)'=='Win32'">x86-windows</VCPKGArch>
|
||||
<VCPKGArch Condition="'\$(Platform)'!='Win32'">x64-windows</VCPKGArch>
|
||||
<VCPKGArch Condition="'\$(Platform)'=='x64'">x64-windows</VCPKGArch>
|
||||
<VCPKGArch Condition="'\$(Platform)'=='ARM64'">arm64-windows</VCPKGArch>
|
||||
<VCPKGArchDirectory>$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)</VCPKGArchDirectory>
|
||||
<VCPKGBinDirectory Condition="'\$(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\bin</VCPKGBinDirectory>
|
||||
<VCPKGLibDirectory Condition="'\$(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\lib</VCPKGLibDirectory>
|
||||
@@ -140,7 +161,7 @@ sub createProject {
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>$config_type</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<!-- <CharacterSet>UTF-8</CharacterSet> -->
|
||||
<OutDir>..\\</OutDir>
|
||||
<!-- <IntDir>\$(ProjectDir)\$(Configuration)\\</IntDir> -->
|
||||
@@ -174,9 +195,9 @@ sub createProject {
|
||||
<AdditionalLibraryDirectories>\$(VCPKGLibDirectory);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>\$(VCPKGLibs);\$(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
<EntryPointSymbol>$entrypoint</EntryPointSymbol>
|
||||
<ManifestFile>$cdup\\compat\\win32\\git.manifest</ManifestFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>$subsystem</SubSystem>
|
||||
</Link>
|
||||
EOM
|
||||
if ($target eq 'libgit') {
|
||||
@@ -184,7 +205,7 @@ EOM
|
||||
<PreBuildEvent Condition="!Exists('$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)\\include\\openssl\\ssl.h')">
|
||||
<Message>Initialize VCPKG</Message>
|
||||
<Command>del "$cdup\\compat\\vcbuild\\vcpkg"</Command>
|
||||
<Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat"</Command>
|
||||
<Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat" \$(VCPKGArch)</Command>
|
||||
</PreBuildEvent>
|
||||
EOM
|
||||
}
|
||||
@@ -201,6 +222,9 @@ EOM
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;$rcdefines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
@@ -214,6 +238,9 @@ EOM
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;$rcdefines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
@@ -223,21 +250,27 @@ EOM
|
||||
<ItemGroup>
|
||||
EOM
|
||||
foreach(@sources) {
|
||||
print F << "EOM";
|
||||
if (/\.rc$/) {
|
||||
print F << "EOM";
|
||||
<ResourceCompile Include="$_" />
|
||||
EOM
|
||||
} else {
|
||||
print F << "EOM";
|
||||
<ClCompile Include="$_" />
|
||||
EOM
|
||||
}
|
||||
}
|
||||
print F << "EOM";
|
||||
</ItemGroup>
|
||||
EOM
|
||||
if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
|
||||
if ((!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') && !($name =~ /headless-git/)) {
|
||||
my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
|
||||
my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
|
||||
my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
|
||||
|
||||
print F << "EOM";
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$cdup\\libgit\\libgit.vcxproj">
|
||||
<ProjectReference Include="$cdup\\libgit.proj\\libgit.vcxproj">
|
||||
<Project>$uuid_libgit</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
@@ -252,7 +285,7 @@ EOM
|
||||
}
|
||||
if (!($name =~ 'xdiff')) {
|
||||
print F << "EOM";
|
||||
<ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
|
||||
<ProjectReference Include="$cdup\\xdiff\\lib.proj\\xdiff_lib.vcxproj">
|
||||
<Project>$uuid_xdiff_lib</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
@@ -261,7 +294,7 @@ EOM
|
||||
if ($name =~ /(test-(line-buffer|svn-fe)|^git-remote-testsvn)\.exe$/) {
|
||||
my $uuid_vcs_svn_lib = $$build_structure{"LIBS_vcs-svn/lib_GUID"};
|
||||
print F << "EOM";
|
||||
<ProjectReference Include="$cdup\\vcs-svn\\lib\\vcs-svn_lib.vcxproj">
|
||||
<ProjectReference Include="$cdup\\vcs-svn\\lib.proj\\vcs-svn_lib.vcxproj">
|
||||
<Project>$uuid_vcs_svn_lib</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
@@ -338,7 +371,7 @@ sub createGlueProject {
|
||||
my $vcxproj = $build_structure{"APPS_${appname}_VCXPROJ"};
|
||||
$vcxproj =~ s/\//\\/g;
|
||||
$appname =~ s/.*\///;
|
||||
print F "\"${appname}\", \"${vcxproj}\", \"${uuid}\"";
|
||||
print F "\"${appname}.proj\", \"${vcxproj}\", \"${uuid}\"";
|
||||
print F "$SLN_POST";
|
||||
}
|
||||
foreach (@libs) {
|
||||
@@ -348,15 +381,17 @@ sub createGlueProject {
|
||||
my $vcxproj = $build_structure{"LIBS_${libname}_VCXPROJ"};
|
||||
$vcxproj =~ s/\//\\/g;
|
||||
$libname =~ s/\//_/g;
|
||||
print F "\"${libname}\", \"${vcxproj}\", \"${uuid}\"";
|
||||
print F "\"${libname}.proj\", \"${vcxproj}\", \"${uuid}\"";
|
||||
print F "$SLN_POST";
|
||||
}
|
||||
|
||||
print F << "EOM";
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
@@ -367,10 +402,14 @@ EOM
|
||||
foreach (@apps) {
|
||||
my $appname = $_;
|
||||
my $uuid = $build_structure{"APPS_${appname}_GUID"};
|
||||
print F "\t\t${uuid}.Debug|ARM64.ActiveCfg = Debug|ARM64\n";
|
||||
print F "\t\t${uuid}.Debug|ARM64.Build.0 = Debug|ARM64\n";
|
||||
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
|
||||
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
|
||||
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Release|ARM64.ActiveCfg = Release|ARM64\n";
|
||||
print F "\t\t${uuid}.Release|ARM64.Build.0 = Release|ARM64\n";
|
||||
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
|
||||
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
|
||||
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
|
||||
@@ -379,10 +418,14 @@ EOM
|
||||
foreach (@libs) {
|
||||
my $libname = $_;
|
||||
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
|
||||
print F "\t\t${uuid}.Debug|ARM64.ActiveCfg = Debug|ARM64\n";
|
||||
print F "\t\t${uuid}.Debug|ARM64.Build.0 = Debug|ARM64\n";
|
||||
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
|
||||
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
|
||||
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
|
||||
print F "\t\t${uuid}.Release|ARM64.ActiveCfg = Release|ARM64\n";
|
||||
print F "\t\t${uuid}.Release|ARM64.Build.0 = Release|ARM64\n";
|
||||
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
|
||||
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
|
||||
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
|
||||
|
||||
@@ -165,7 +165,7 @@ sub parseMakeOutput
|
||||
next;
|
||||
}
|
||||
|
||||
if($text =~ / -c /) {
|
||||
if($text =~ / -c / || $text =~ / -i \S+\.rc /) {
|
||||
# compilation
|
||||
handleCompileLine($text, $line);
|
||||
|
||||
@@ -263,16 +263,15 @@ sub handleCompileLine
|
||||
if ("$part" eq "-o") {
|
||||
# ignore object file
|
||||
shift @parts;
|
||||
} elsif ("$part" eq "-c") {
|
||||
} elsif ("$part" eq "-c" || "$part" eq "-i" || "$part" =~ /^-fno-/) {
|
||||
# ignore compile flag
|
||||
} elsif ("$part" eq "-c") {
|
||||
} elsif ($part =~ /^.?-I/) {
|
||||
push(@incpaths, $part);
|
||||
} elsif ($part =~ /^.?-D/) {
|
||||
push(@defines, $part);
|
||||
} elsif ($part =~ /^-/) {
|
||||
push(@cflags, $part);
|
||||
} elsif ($part =~ /\.(c|cc|cpp)$/) {
|
||||
} elsif ($part =~ /\.(c|cc|cpp|rc)$/) {
|
||||
$sourcefile = $part;
|
||||
} else {
|
||||
die "Unhandled compiler option @ line $lineno: $part";
|
||||
@@ -359,7 +358,7 @@ sub handleLinkLine
|
||||
push(@libs, $part);
|
||||
} elsif ($part eq 'invalidcontinue.obj') {
|
||||
# ignore - known to MSVC
|
||||
} elsif ($part =~ /\.o$/) {
|
||||
} elsif ($part =~ /\.(o|res)$/) {
|
||||
push(@objfiles, $part);
|
||||
} elsif ($part =~ /\.obj$/) {
|
||||
# do nothing, 'make' should not be producing .obj, only .o files
|
||||
@@ -371,7 +370,9 @@ sub handleLinkLine
|
||||
# exit(1);
|
||||
foreach (@objfiles) {
|
||||
my $sourcefile = $_;
|
||||
$sourcefile =~ s/^headless-git\.o$/compat\/win32\/headless.c/;
|
||||
$sourcefile =~ s/\.o$/.c/;
|
||||
$sourcefile =~ s/\.res$/.rc/;
|
||||
push(@sources, $sourcefile);
|
||||
push(@cflags, @{$compile_options{"${sourcefile}_CFLAGS"}});
|
||||
push(@defines, @{$compile_options{"${sourcefile}_DEFINES"}});
|
||||
|
||||
@@ -94,7 +94,7 @@ $(GIT_SUBTREE_TEST): $(GIT_SUBTREE)
|
||||
cp $< $@
|
||||
|
||||
test: $(GIT_SUBTREE_TEST)
|
||||
$(MAKE) -C t/ test
|
||||
$(MAKE) -C t/ all
|
||||
|
||||
clean:
|
||||
$(RM) $(GIT_SUBTREE)
|
||||
|
||||
@@ -47,6 +47,31 @@ static struct fsmonitor_settings *alloc_settings(void)
|
||||
return s;
|
||||
}
|
||||
|
||||
static int check_deprecated_builtin_config(struct repository *r)
|
||||
{
|
||||
int core_use_builtin_fsmonitor = 0;
|
||||
|
||||
/*
|
||||
* If 'core.useBuiltinFSMonitor' is set, print a deprecation warning
|
||||
* suggesting the use of 'core.fsmonitor' instead. If the config is
|
||||
* set to true, set the appropriate mode and return 1 indicating that
|
||||
* the check resulted the config being set by this (deprecated) setting.
|
||||
*/
|
||||
if(!repo_config_get_bool(r, "core.useBuiltinFSMonitor", &core_use_builtin_fsmonitor) &&
|
||||
core_use_builtin_fsmonitor) {
|
||||
if (!git_env_bool("GIT_SUPPRESS_USEBUILTINFSMONITOR_ADVICE", 0)) {
|
||||
advise_if_enabled(ADVICE_USE_CORE_FSMONITOR_CONFIG,
|
||||
_("core.useBuiltinFSMonitor=true is deprecated;"
|
||||
"please set core.fsmonitor=true instead"));
|
||||
setenv("GIT_SUPPRESS_USEBUILTINFSMONITOR_ADVICE", "1", 1);
|
||||
}
|
||||
fsm_settings__set_ipc(r);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void lookup_fsmonitor_settings(struct repository *r)
|
||||
{
|
||||
const char *const_str;
|
||||
@@ -72,12 +97,16 @@ static void lookup_fsmonitor_settings(struct repository *r)
|
||||
return;
|
||||
|
||||
case 1: /* config value was unset */
|
||||
if (check_deprecated_builtin_config(r))
|
||||
return;
|
||||
|
||||
const_str = getenv("GIT_TEST_FSMONITOR");
|
||||
break;
|
||||
|
||||
case -1: /* config value set to an arbitrary string */
|
||||
if (repo_config_get_pathname(r, "core.fsmonitor", &const_str))
|
||||
return; /* should not happen */
|
||||
if (check_deprecated_builtin_config(r) ||
|
||||
repo_config_get_pathname(r, "core.fsmonitor", &const_str))
|
||||
return;
|
||||
break;
|
||||
|
||||
default: /* should not happen */
|
||||
|
||||
@@ -174,6 +174,24 @@ sub run_cmd_pipe {
|
||||
die "$^O does not support: @invalid\n" if @invalid;
|
||||
my @args = map { m/ /o ? "\"$_\"": $_ } @_;
|
||||
return qx{@args};
|
||||
} elsif (($^O eq 'MSWin32' || $^O eq 'msys') && (scalar @_ > 200) &&
|
||||
grep $_ eq '--', @_) {
|
||||
use File::Temp qw(tempfile);
|
||||
my ($fhargs, $filename) =
|
||||
tempfile('git-args-XXXXXX', UNLINK => 1);
|
||||
|
||||
my $cmd = 'cat '.$filename.' | xargs -0 -s 20000 ';
|
||||
while ($_[0] ne '--') {
|
||||
$cmd = $cmd . shift(@_) . ' ';
|
||||
}
|
||||
|
||||
shift(@_);
|
||||
print $fhargs join("\0", @_);
|
||||
close($fhargs);
|
||||
|
||||
my $fh = undef;
|
||||
open($fh, '-|', $cmd) or die;
|
||||
return <$fh>;
|
||||
} else {
|
||||
my $fh = undef;
|
||||
open($fh, '-|', @_) or die;
|
||||
|
||||
@@ -521,10 +521,18 @@ static inline int git_has_dir_sep(const char *path)
|
||||
#define has_dir_sep(path) git_has_dir_sep(path)
|
||||
#endif
|
||||
|
||||
#ifndef is_mount_point
|
||||
#define is_mount_point is_mount_point_via_stat
|
||||
#endif
|
||||
|
||||
#ifndef query_user_email
|
||||
#define query_user_email() NULL
|
||||
#endif
|
||||
|
||||
#ifndef platform_strbuf_realpath
|
||||
#define platform_strbuf_realpath(resolved, path) NULL
|
||||
#endif
|
||||
|
||||
#ifdef __TANDEM
|
||||
#include <floss.h(floss_execl,floss_execlp,floss_execv,floss_execvp)>
|
||||
#include <floss.h(floss_getpwuid)>
|
||||
|
||||
@@ -126,4 +126,12 @@
|
||||
#define GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* CURLSSLOPT_AUTO_CLIENT_CERT was added in 7.77.0, released in May
|
||||
* 2021.
|
||||
*/
|
||||
#if LIBCURL_VERSION_NUM >= 0x074d00
|
||||
#define GIT_CURL_HAVE_CURLSSLOPT_AUTO_CLIENT_CERT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2087,6 +2087,7 @@ set all_icons(U$ui_index) file_merge
|
||||
set all_icons(T$ui_index) file_statechange
|
||||
|
||||
set all_icons(_$ui_workdir) file_plain
|
||||
set all_icons(A$ui_workdir) file_plain
|
||||
set all_icons(M$ui_workdir) file_mod
|
||||
set all_icons(D$ui_workdir) file_question
|
||||
set all_icons(U$ui_workdir) file_merge
|
||||
@@ -2113,6 +2114,7 @@ foreach i {
|
||||
{A_ {mc "Staged for commit"}}
|
||||
{AM {mc "Portions staged for commit"}}
|
||||
{AD {mc "Staged for commit, missing"}}
|
||||
{AA {mc "Intended to be added"}}
|
||||
|
||||
{_D {mc "Missing"}}
|
||||
{D_ {mc "Staged for removal"}}
|
||||
|
||||
@@ -582,7 +582,8 @@ proc apply_or_revert_hunk {x y revert} {
|
||||
if {$current_diff_side eq $ui_index} {
|
||||
set failed_msg [mc "Failed to unstage selected hunk."]
|
||||
lappend apply_cmd --reverse --cached
|
||||
if {[string index $mi 0] ne {M}} {
|
||||
set file_state [string index $mi 0]
|
||||
if {$file_state ne {M} && $file_state ne {A}} {
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
@@ -595,7 +596,8 @@ proc apply_or_revert_hunk {x y revert} {
|
||||
lappend apply_cmd --cached
|
||||
}
|
||||
|
||||
if {[string index $mi 1] ne {M}} {
|
||||
set file_state [string index $mi 1]
|
||||
if {$file_state ne {M} && $file_state ne {A}} {
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
@@ -687,7 +689,8 @@ proc apply_or_revert_range_or_line {x y revert} {
|
||||
set failed_msg [mc "Failed to unstage selected line."]
|
||||
set to_context {+}
|
||||
lappend apply_cmd --reverse --cached
|
||||
if {[string index $mi 0] ne {M}} {
|
||||
set file_state [string index $mi 0]
|
||||
if {$file_state ne {M} && $file_state ne {A}} {
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
@@ -702,7 +705,8 @@ proc apply_or_revert_range_or_line {x y revert} {
|
||||
lappend apply_cmd --cached
|
||||
}
|
||||
|
||||
if {[string index $mi 1] ne {M}} {
|
||||
set file_state [string index $mi 1]
|
||||
if {$file_state ne {M} && $file_state ne {A}} {
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
|
||||
@@ -353,6 +353,16 @@ proc parseviewrevs {view revs} {
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Escapes a list of filter paths to be passed to git log via stdin. Note that
|
||||
# paths must not be quoted.
|
||||
proc escape_filter_paths {paths} {
|
||||
set escaped [list]
|
||||
foreach path $paths {
|
||||
lappend escaped [string map {\\ \\\\ "\ " "\\\ "} $path]
|
||||
}
|
||||
return $escaped
|
||||
}
|
||||
|
||||
# Start off a git log process and arrange to read its output
|
||||
proc start_rev_list {view} {
|
||||
global startmsecs commitidx viewcomplete curview
|
||||
@@ -405,14 +415,17 @@ proc start_rev_list {view} {
|
||||
if {$revs eq {}} {
|
||||
return 0
|
||||
}
|
||||
set args [concat $vflags($view) $revs]
|
||||
set args $vflags($view)
|
||||
} else {
|
||||
set revs {}
|
||||
set args $vorigargs($view)
|
||||
}
|
||||
|
||||
if {[catch {
|
||||
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
|
||||
--parents --boundary $args "--" $files] r]
|
||||
--parents --boundary $args --stdin \
|
||||
"<<[join [concat $revs "--" \
|
||||
[escape_filter_paths $files]] "\\n"]"] r]
|
||||
} err]} {
|
||||
error_popup "[mc "Error executing git log:"] $err"
|
||||
return 0
|
||||
@@ -554,13 +567,20 @@ proc updatecommits {} {
|
||||
set revs $newrevs
|
||||
set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]
|
||||
}
|
||||
set args [concat $vflags($view) $revs --not $oldpos]
|
||||
set args $vflags($view)
|
||||
foreach r $oldpos {
|
||||
lappend revs "^$r"
|
||||
}
|
||||
} else {
|
||||
set revs {}
|
||||
set args $vorigargs($view)
|
||||
}
|
||||
if {[catch {
|
||||
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
|
||||
--parents --boundary $args "--" $vfilelimit($view)] r]
|
||||
--parents --boundary $args --stdin \
|
||||
"<<[join [concat $revs "--" \
|
||||
[escape_filter_paths \
|
||||
$vfilelimit($view)]] "\\n"]"] r]
|
||||
} err]} {
|
||||
error_popup "[mc "Error executing git log:"] $err"
|
||||
return
|
||||
@@ -10231,10 +10251,16 @@ proc getallcommits {} {
|
||||
foreach id $seeds {
|
||||
lappend ids "^$id"
|
||||
}
|
||||
lappend ids "--"
|
||||
}
|
||||
}
|
||||
if {$ids ne {}} {
|
||||
set fd [open [concat $cmd $ids] r]
|
||||
if {$ids eq "--all"} {
|
||||
set cmd [concat $cmd "--all"]
|
||||
} else {
|
||||
set cmd [concat $cmd --stdin "<<[join $ids "\\n"]"]
|
||||
}
|
||||
set fd [open $cmd r]
|
||||
fconfigure $fd -blocking 0
|
||||
incr allcommits
|
||||
nowbusy allcommits
|
||||
|
||||
48
http.c
48
http.c
@@ -136,7 +136,13 @@ static char *cached_accept_language;
|
||||
|
||||
static char *http_ssl_backend;
|
||||
|
||||
static int http_schannel_check_revoke = 1;
|
||||
static int http_schannel_check_revoke_mode =
|
||||
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
|
||||
CURLSSLOPT_REVOKE_BEST_EFFORT;
|
||||
#else
|
||||
CURLSSLOPT_NO_REVOKE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* With the backend being set to `schannel`, setting sslCAinfo would override
|
||||
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
|
||||
@@ -144,6 +150,8 @@ static int http_schannel_check_revoke = 1;
|
||||
*/
|
||||
static int http_schannel_use_ssl_cainfo;
|
||||
|
||||
static int http_auto_client_cert;
|
||||
|
||||
size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_)
|
||||
{
|
||||
size_t size = eltsize * nmemb;
|
||||
@@ -287,7 +295,19 @@ static int http_options(const char *var, const char *value, void *cb)
|
||||
}
|
||||
|
||||
if (!strcmp("http.schannelcheckrevoke", var)) {
|
||||
http_schannel_check_revoke = git_config_bool(var, value);
|
||||
if (value && !strcmp(value, "best-effort")) {
|
||||
http_schannel_check_revoke_mode =
|
||||
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
|
||||
CURLSSLOPT_REVOKE_BEST_EFFORT;
|
||||
#else
|
||||
CURLSSLOPT_NO_REVOKE;
|
||||
warning(_("%s=%s unsupported by current cURL"),
|
||||
var, value);
|
||||
#endif
|
||||
} else
|
||||
http_schannel_check_revoke_mode =
|
||||
(git_config_bool(var, value) ?
|
||||
0 : CURLSSLOPT_NO_REVOKE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -296,6 +316,11 @@ static int http_options(const char *var, const char *value, void *cb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp("http.sslautoclientcert", var)) {
|
||||
http_auto_client_cert = git_config_bool(var, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp("http.minsessions", var)) {
|
||||
min_curl_sessions = git_config_int(var, value);
|
||||
if (min_curl_sessions > 1)
|
||||
@@ -818,13 +843,24 @@ static CURL *get_curl_handle(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
|
||||
!http_schannel_check_revoke) {
|
||||
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend)) {
|
||||
long ssl_options = 0;
|
||||
if (http_schannel_check_revoke_mode) {
|
||||
#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE
|
||||
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
|
||||
ssl_options |= http_schannel_check_revoke_mode;
|
||||
#else
|
||||
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
|
||||
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (http_auto_client_cert) {
|
||||
#ifdef GIT_CURL_HAVE_CURLSSLOPT_AUTO_CLIENT_CERT
|
||||
ssl_options |= CURLSSLOPT_AUTO_CLIENT_CERT;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ssl_options)
|
||||
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, ssl_options);
|
||||
}
|
||||
|
||||
if (http_proactive_auth)
|
||||
|
||||
@@ -1785,9 +1785,9 @@ void *read_object_with_reference(struct repository *r,
|
||||
}
|
||||
|
||||
static void hash_object_body(const struct git_hash_algo *algo, git_hash_ctx *c,
|
||||
const void *buf, unsigned long len,
|
||||
const void *buf, size_t len,
|
||||
struct object_id *oid,
|
||||
char *hdr, int *hdrlen)
|
||||
char *hdr, size_t *hdrlen)
|
||||
{
|
||||
algo->init_fn(c);
|
||||
algo->update_fn(c, hdr, *hdrlen);
|
||||
@@ -1796,23 +1796,23 @@ static void hash_object_body(const struct git_hash_algo *algo, git_hash_ctx *c,
|
||||
}
|
||||
|
||||
static void write_object_file_prepare(const struct git_hash_algo *algo,
|
||||
const void *buf, unsigned long len,
|
||||
const void *buf, size_t len,
|
||||
enum object_type type, struct object_id *oid,
|
||||
char *hdr, int *hdrlen)
|
||||
char *hdr, size_t *hdrlen)
|
||||
{
|
||||
git_hash_ctx c;
|
||||
|
||||
/* Generate the header */
|
||||
*hdrlen = format_object_header(hdr, *hdrlen, type, len);
|
||||
|
||||
/* Sha1.. */
|
||||
/* Hash (function pointers) computation */
|
||||
hash_object_body(algo, &c, buf, len, oid, hdr, hdrlen);
|
||||
}
|
||||
|
||||
static void write_object_file_prepare_literally(const struct git_hash_algo *algo,
|
||||
const void *buf, unsigned long len,
|
||||
const void *buf, size_t len,
|
||||
const char *type, struct object_id *oid,
|
||||
char *hdr, int *hdrlen)
|
||||
char *hdr, size_t *hdrlen)
|
||||
{
|
||||
git_hash_ctx c;
|
||||
|
||||
@@ -1871,17 +1871,17 @@ static int write_buffer(int fd, const void *buf, size_t len)
|
||||
}
|
||||
|
||||
static void hash_object_file_literally(const struct git_hash_algo *algo,
|
||||
const void *buf, unsigned long len,
|
||||
const void *buf, size_t len,
|
||||
const char *type, struct object_id *oid)
|
||||
{
|
||||
char hdr[MAX_HEADER_LEN];
|
||||
int hdrlen = sizeof(hdr);
|
||||
size_t hdrlen = sizeof(hdr);
|
||||
|
||||
write_object_file_prepare_literally(algo, buf, len, type, oid, hdr, &hdrlen);
|
||||
}
|
||||
|
||||
void hash_object_file(const struct git_hash_algo *algo, const void *buf,
|
||||
unsigned long len, enum object_type type,
|
||||
size_t len, enum object_type type,
|
||||
struct object_id *oid)
|
||||
{
|
||||
hash_object_file_literally(algo, buf, len, type_name(type), oid);
|
||||
@@ -2050,12 +2050,12 @@ static int freshen_packed_object(const struct object_id *oid)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int write_object_file_flags(const void *buf, unsigned long len,
|
||||
int write_object_file_flags(const void *buf, size_t len,
|
||||
enum object_type type, struct object_id *oid,
|
||||
unsigned flags)
|
||||
{
|
||||
char hdr[MAX_HEADER_LEN];
|
||||
int hdrlen = sizeof(hdr);
|
||||
size_t hdrlen = sizeof(hdr);
|
||||
|
||||
/* Normally if we have it in the pack then we do not bother writing
|
||||
* it out into .git/objects/??/?{38} file.
|
||||
@@ -2067,12 +2067,13 @@ int write_object_file_flags(const void *buf, unsigned long len,
|
||||
return write_loose_object(oid, hdr, hdrlen, buf, len, 0, flags);
|
||||
}
|
||||
|
||||
int write_object_file_literally(const void *buf, unsigned long len,
|
||||
int write_object_file_literally(const void *buf, size_t len,
|
||||
const char *type, struct object_id *oid,
|
||||
unsigned flags)
|
||||
{
|
||||
char *header;
|
||||
int hdrlen, status = 0;
|
||||
size_t hdrlen;
|
||||
int status = 0;
|
||||
|
||||
/* type string, SP, %lu of the length plus NUL must fit this */
|
||||
hdrlen = strlen(type) + MAX_HEADER_LEN;
|
||||
|
||||
@@ -254,10 +254,10 @@ static inline void *repo_read_object_file(struct repository *r,
|
||||
int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);
|
||||
|
||||
void hash_object_file(const struct git_hash_algo *algo, const void *buf,
|
||||
unsigned long len, enum object_type type,
|
||||
size_t len, enum object_type type,
|
||||
struct object_id *oid);
|
||||
|
||||
int write_object_file_flags(const void *buf, unsigned long len,
|
||||
int write_object_file_flags(const void *buf, size_t len,
|
||||
enum object_type type, struct object_id *oid,
|
||||
unsigned flags);
|
||||
static inline int write_object_file(const void *buf, unsigned long len,
|
||||
@@ -266,7 +266,7 @@ static inline int write_object_file(const void *buf, unsigned long len,
|
||||
return write_object_file_flags(buf, len, type, oid, 0);
|
||||
}
|
||||
|
||||
int write_object_file_literally(const void *buf, unsigned long len,
|
||||
int write_object_file_literally(const void *buf, size_t len,
|
||||
const char *type, struct object_id *oid,
|
||||
unsigned flags);
|
||||
|
||||
|
||||
39
path.c
39
path.c
@@ -1300,6 +1300,45 @@ char *strip_path_suffix(const char *path, const char *suffix)
|
||||
return offset == -1 ? NULL : xstrndup(path, offset);
|
||||
}
|
||||
|
||||
int is_mount_point_via_stat(struct strbuf *path)
|
||||
{
|
||||
size_t len = path->len;
|
||||
unsigned int current_dev;
|
||||
struct stat st;
|
||||
|
||||
if (!strcmp("/", path->buf))
|
||||
return 1;
|
||||
|
||||
strbuf_addstr(path, "/.");
|
||||
if (lstat(path->buf, &st)) {
|
||||
/*
|
||||
* If we cannot access the current directory, we cannot say
|
||||
* that it is a bind mount.
|
||||
*/
|
||||
strbuf_setlen(path, len);
|
||||
return 0;
|
||||
}
|
||||
current_dev = st.st_dev;
|
||||
|
||||
/* Now look at the parent directory */
|
||||
strbuf_addch(path, '.');
|
||||
if (lstat(path->buf, &st)) {
|
||||
/*
|
||||
* If we cannot access the parent directory, we cannot say
|
||||
* that it is a bind mount.
|
||||
*/
|
||||
strbuf_setlen(path, len);
|
||||
return 0;
|
||||
}
|
||||
strbuf_setlen(path, len);
|
||||
|
||||
/*
|
||||
* If the device ID differs between current and parent directory,
|
||||
* then it is a bind mount.
|
||||
*/
|
||||
return current_dev != st.st_dev;
|
||||
}
|
||||
|
||||
int daemon_avoid_alias(const char *p)
|
||||
{
|
||||
int sl, ndot;
|
||||
|
||||
2
prompt.c
2
prompt.c
@@ -77,7 +77,7 @@ int git_read_line_interactively(struct strbuf *line)
|
||||
int ret;
|
||||
|
||||
fflush(stdout);
|
||||
ret = strbuf_getline_lf(line, stdin);
|
||||
ret = strbuf_getline(line, stdin);
|
||||
if (ret != EOF)
|
||||
strbuf_trim_trailing_newline(line);
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#include "config.h"
|
||||
#include "repository.h"
|
||||
#include "midx.h"
|
||||
#include "compat/fsmonitor/fsm-listen.h"
|
||||
#include "fsmonitor-ipc.h"
|
||||
#include "fsmonitor-settings.h"
|
||||
|
||||
static void repo_cfg_bool(struct repository *r, const char *key, int *dest,
|
||||
int def)
|
||||
@@ -36,6 +37,30 @@ void prepare_repo_settings(struct repository *r)
|
||||
/* Defaults modified by feature.* */
|
||||
if (experimental) {
|
||||
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
|
||||
|
||||
/*
|
||||
* Force enable the builtin FSMonitor (unless the repo
|
||||
* is incompatible or they've already selected it or
|
||||
* the hook version). But only if they haven't
|
||||
* explicitly turned it off -- so only if our config
|
||||
* value is UNSET.
|
||||
*
|
||||
* lookup_fsmonitor_settings() and check_for_ipc() do
|
||||
* not distinguish between explicitly set FALSE and
|
||||
* UNSET, so we re-test for an UNSET config key here.
|
||||
*
|
||||
* I'm not sure I want to fix fsmonitor-settings.c to
|
||||
* have more than one _DISABLED state since our usage
|
||||
* here is only to support this experimental period
|
||||
* (and I don't want to overload the _reason field
|
||||
* because it describes incompabilities).
|
||||
*/
|
||||
if (manyfiles &&
|
||||
fsmonitor_ipc__is_supported() &&
|
||||
fsm_settings__get_mode(r) == FSMONITOR_MODE_DISABLED &&
|
||||
repo_config_get_maybe_bool(r, "core.fsmonitor", &value) > 0 &&
|
||||
repo_config_get_bool(r, "core.useBuiltinFSMonitor", &value))
|
||||
fsm_settings__set_ipc(r);
|
||||
}
|
||||
if (manyfiles) {
|
||||
r->settings.index_version = 4;
|
||||
|
||||
14
send-pack.c
14
send-pack.c
@@ -39,6 +39,16 @@ int option_parse_push_signed(const struct option *opt,
|
||||
die("bad %s argument: %s", opt->long_name, arg);
|
||||
}
|
||||
|
||||
static int config_use_sideband = 1;
|
||||
|
||||
static int send_pack_config(const char *var, const char *value, void *unused)
|
||||
{
|
||||
if (!strcmp("sendpack.sideband", var))
|
||||
config_use_sideband = git_config_bool(var, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void feed_object(const struct object_id *oid, FILE *fh, int negative)
|
||||
{
|
||||
if (negative &&
|
||||
@@ -494,6 +504,8 @@ int send_pack(struct send_pack_args *args,
|
||||
return 0;
|
||||
}
|
||||
|
||||
git_config(send_pack_config, NULL);
|
||||
|
||||
git_config_get_bool("push.negotiate", &push_negotiate);
|
||||
if (push_negotiate)
|
||||
get_commons_through_negotiation(args->url, remote_refs, &commons);
|
||||
@@ -509,7 +521,7 @@ int send_pack(struct send_pack_args *args,
|
||||
allow_deleting_refs = 1;
|
||||
if (server_supports("ofs-delta"))
|
||||
args->use_ofs_delta = 1;
|
||||
if (server_supports("side-band-64k"))
|
||||
if (config_use_sideband && server_supports("side-band-64k"))
|
||||
use_sideband = 1;
|
||||
if (server_supports("quiet"))
|
||||
quiet_supported = 1;
|
||||
|
||||
10
setup.c
10
setup.c
@@ -1383,9 +1383,17 @@ const char *setup_git_directory_gently(int *nongit_ok)
|
||||
break;
|
||||
case GIT_DIR_INVALID_OWNERSHIP:
|
||||
if (!nongit_ok) {
|
||||
struct strbuf prequoted = STRBUF_INIT;
|
||||
struct strbuf quoted = STRBUF_INIT;
|
||||
|
||||
sq_quote_buf_pretty("ed, dir.buf);
|
||||
#ifdef __MINGW32__
|
||||
if (dir.buf[0] == '/')
|
||||
strbuf_addstr(&prequoted, "%(prefix)/");
|
||||
#endif
|
||||
|
||||
strbuf_add(&prequoted, dir.buf, dir.len);
|
||||
sq_quote_buf_pretty("ed, prequoted.buf);
|
||||
|
||||
die(_("unsafe repository ('%s' is owned by someone else)\n"
|
||||
"To add an exception for this directory, call:\n"
|
||||
"\n"
|
||||
|
||||
@@ -25,10 +25,9 @@ void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
|
||||
/*
|
||||
* Same as SHA1DCUpdate, but adjust types to match git's usual interface.
|
||||
*/
|
||||
void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
|
||||
void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, size_t len)
|
||||
{
|
||||
const char *data = vdata;
|
||||
/* We expect an unsigned long, but sha1dc only takes an int */
|
||||
while (len > INT_MAX) {
|
||||
SHA1DCUpdate(ctx, data, INT_MAX);
|
||||
data += INT_MAX;
|
||||
|
||||
@@ -15,7 +15,7 @@ void git_SHA1DCInit(SHA1_CTX *);
|
||||
#endif
|
||||
|
||||
void git_SHA1DCFinal(unsigned char [20], SHA1_CTX *);
|
||||
void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *data, unsigned long len);
|
||||
void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *data, size_t len);
|
||||
|
||||
#define platform_SHA_CTX SHA1_CTX
|
||||
#define platform_SHA1_Init git_SHA1DCInit
|
||||
|
||||
@@ -38,10 +38,10 @@ test_expect_success 'looping aliases - internal execution' '
|
||||
#'
|
||||
|
||||
test_expect_success 'run-command formats empty args properly' '
|
||||
test_must_fail env GIT_TRACE=1 git frotz a "" b " " c 2>actual.raw &&
|
||||
sed -ne "/run_command:/s/.*trace: run_command: //p" actual.raw >actual &&
|
||||
echo "git-frotz a '\'''\'' b '\'' '\'' c" >expect &&
|
||||
test_cmp expect actual
|
||||
test_must_fail env GIT_TRACE=1 git frotz a "" b " " c 2>actual.raw &&
|
||||
sed -ne "/run_command:/s/.*trace: run_command: //p" actual.raw >actual &&
|
||||
echo "git-frotz a '\'''\'' b '\'' '\'' c" >expect &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -548,7 +548,8 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX wor
|
||||
cp "$GIT_EXEC_PATH"/git$X pretend/bin/ &&
|
||||
GIT_EXEC_PATH= ./pretend/bin/git here >actual &&
|
||||
echo HERE >expect &&
|
||||
test_cmp expect actual'
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '
|
||||
mkdir -p pretend/bin &&
|
||||
@@ -559,4 +560,24 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success MINGW 'MSYSTEM/PATH is adjusted if necessary' '
|
||||
mkdir -p "$HOME"/bin pretend/mingw64/bin \
|
||||
pretend/mingw64/libexec/git-core pretend/usr/bin &&
|
||||
cp "$GIT_EXEC_PATH"/git.exe pretend/mingw64/bin/ &&
|
||||
cp "$GIT_EXEC_PATH"/git.exe pretend/mingw64/libexec/git-core/ &&
|
||||
echo "env | grep MSYSTEM=" | write_script "$HOME"/bin/git-test-home &&
|
||||
echo "echo mingw64" | write_script pretend/mingw64/bin/git-test-bin &&
|
||||
echo "echo usr" | write_script pretend/usr/bin/git-test-bin2 &&
|
||||
|
||||
(
|
||||
MSYSTEM= &&
|
||||
GIT_EXEC_PATH= &&
|
||||
pretend/mingw64/libexec/git-core/git.exe test-home >actual &&
|
||||
pretend/mingw64/libexec/git-core/git.exe test-bin >>actual &&
|
||||
pretend/mingw64/bin/git.exe test-bin2 >>actual
|
||||
) &&
|
||||
test_write_lines MSYSTEM=$MSYSTEM mingw64 usr >expect &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -50,6 +50,9 @@ test_expect_success 'setup' '
|
||||
|
||||
example sha1:ddd3f836d3e3fbb7ae289aa9ae83536f76956399
|
||||
example sha256:b44fe1fe65589848253737db859bd490453510719d7424daab03daf0767b85ae
|
||||
|
||||
large5GB sha1:0be2be10a4c8764f32c4bf372a98edc731a4b204
|
||||
large5GB sha256:dc18ca621300c8d3cfa505a275641ebab00de189859e022a975056882d313e64
|
||||
EOF
|
||||
'
|
||||
|
||||
@@ -249,4 +252,40 @@ test_expect_success '--literally with extra-long type' '
|
||||
echo example | git hash-object -t $t --literally --stdin
|
||||
'
|
||||
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \
|
||||
'files over 4GB hash literally' '
|
||||
test-tool genzeros $((5*1024*1024*1024)) >big &&
|
||||
test_oid large5GB >expect &&
|
||||
git hash-object --stdin --literally <big >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \
|
||||
'files over 4GB hash correctly via --stdin' '
|
||||
{ test -f big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
|
||||
test_oid large5GB >expect &&
|
||||
git hash-object --stdin <big >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \
|
||||
'files over 4GB hash correctly' '
|
||||
{ test -f big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
|
||||
test_oid large5GB >expect &&
|
||||
git hash-object -- big >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
# This clean filter does nothing, other than excercising the interface.
|
||||
# We ensure that cleaning doesn't mangle large files on 64-bit Windows.
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \
|
||||
'hash filtered files over 4GB correctly' '
|
||||
{ test -f big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
|
||||
test_oid large5GB >expect &&
|
||||
test_config filter.null-filter.clean "cat" &&
|
||||
echo "big filter=null-filter" >.gitattributes &&
|
||||
git hash-object -- big >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -498,4 +498,15 @@ test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' '
|
||||
git add "$downcased"
|
||||
'
|
||||
|
||||
test_expect_success MINGW 'can add files via NTFS junctions' '
|
||||
test_when_finished "cmd //c rmdir junction && rm -rf target" &&
|
||||
test_create_repo target &&
|
||||
cmd //c "mklink /j junction target" &&
|
||||
>target/via-junction &&
|
||||
git -C junction add "$(pwd)/junction/via-junction" &&
|
||||
echo via-junction >expect &&
|
||||
git -C target diff --cached --name-only >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -991,6 +991,27 @@ test_expect_success 'checkout -p patch editing of added file' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success EXPENSIVE 'add -i with a lot of files' '
|
||||
git reset --hard &&
|
||||
x160=0123456789012345678901234567890123456789 &&
|
||||
x160=$x160$x160$x160$x160 &&
|
||||
y= &&
|
||||
i=0 &&
|
||||
while test $i -le 200
|
||||
do
|
||||
name=$(printf "%s%03d" $x160 $i) &&
|
||||
echo $name >$name &&
|
||||
git add -N $name &&
|
||||
y="${y}y$LF" &&
|
||||
i=$(($i+1)) ||
|
||||
break
|
||||
done &&
|
||||
echo "$y" | git add -p -- . &&
|
||||
git diff --cached >staged &&
|
||||
test_line_count = 1407 staged &&
|
||||
git reset --hard
|
||||
'
|
||||
|
||||
test_expect_success 'show help from add--helper' '
|
||||
git reset --hard &&
|
||||
cat >expect <<-EOF &&
|
||||
|
||||
@@ -769,8 +769,8 @@ test_expect_success '"remote show" does not show symbolic refs' '
|
||||
(
|
||||
cd three &&
|
||||
git remote show origin >output &&
|
||||
! grep "^ *HEAD$" < output &&
|
||||
! grep -i stale < output
|
||||
! grep "^ *HEAD$" <output &&
|
||||
! grep -i stale <output
|
||||
)
|
||||
'
|
||||
|
||||
@@ -962,6 +962,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
|
||||
(
|
||||
cd six &&
|
||||
git remote rm origin &&
|
||||
mkdir -p .git/branches &&
|
||||
echo "$origin_url#main" >.git/branches/origin &&
|
||||
git remote rename origin origin &&
|
||||
test_path_is_missing .git/branches/origin &&
|
||||
@@ -976,7 +977,8 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)'
|
||||
(
|
||||
cd seven &&
|
||||
git remote rm origin &&
|
||||
echo "quux#foom" > .git/branches/origin &&
|
||||
mkdir -p .git/branches &&
|
||||
echo "quux#foom" >.git/branches/origin &&
|
||||
git remote rename origin origin &&
|
||||
test_path_is_missing .git/branches/origin &&
|
||||
test "$(git config remote.origin.url)" = "quux" &&
|
||||
|
||||
@@ -937,7 +937,8 @@ test_expect_success 'fetch with branches' '
|
||||
mk_empty testrepo &&
|
||||
git branch second $the_first_commit &&
|
||||
git checkout second &&
|
||||
echo ".." > testrepo/.git/branches/branch1 &&
|
||||
mkdir -p testrepo/.git/branches &&
|
||||
echo ".." >testrepo/.git/branches/branch1 &&
|
||||
(
|
||||
cd testrepo &&
|
||||
git fetch branch1 &&
|
||||
@@ -950,7 +951,8 @@ test_expect_success 'fetch with branches' '
|
||||
|
||||
test_expect_success 'fetch with branches containing #' '
|
||||
mk_empty testrepo &&
|
||||
echo "..#second" > testrepo/.git/branches/branch2 &&
|
||||
mkdir -p testrepo/.git/branches &&
|
||||
echo "..#second" >testrepo/.git/branches/branch2 &&
|
||||
(
|
||||
cd testrepo &&
|
||||
git fetch branch2 &&
|
||||
@@ -964,7 +966,8 @@ test_expect_success 'fetch with branches containing #' '
|
||||
test_expect_success 'push with branches' '
|
||||
mk_empty testrepo &&
|
||||
git checkout second &&
|
||||
echo "testrepo" > .git/branches/branch1 &&
|
||||
mkdir -p .git/branches &&
|
||||
echo "testrepo" >.git/branches/branch1 &&
|
||||
git push branch1 &&
|
||||
(
|
||||
cd testrepo &&
|
||||
@@ -976,7 +979,8 @@ test_expect_success 'push with branches' '
|
||||
|
||||
test_expect_success 'push with branches containing #' '
|
||||
mk_empty testrepo &&
|
||||
echo "testrepo#branch3" > .git/branches/branch2 &&
|
||||
mkdir -p .git/branches &&
|
||||
echo "testrepo#branch3" >.git/branches/branch2 &&
|
||||
git push branch2 &&
|
||||
(
|
||||
cd testrepo &&
|
||||
@@ -1504,7 +1508,7 @@ EOF
|
||||
git init no-thin &&
|
||||
git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
|
||||
git push no-thin/.git refs/heads/main:refs/heads/foo &&
|
||||
echo modified >> path1 &&
|
||||
echo modified >>path1 &&
|
||||
git commit -am modified &&
|
||||
git repack -adf &&
|
||||
rcvpck="git receive-pack --reject-thin-pack-for-testing" &&
|
||||
|
||||
@@ -21,14 +21,11 @@ fi
|
||||
UNCPATH="$(winpwd)"
|
||||
case "$UNCPATH" in
|
||||
[A-Z]:*)
|
||||
WITHOUTDRIVE="${UNCPATH#?:}"
|
||||
# Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git
|
||||
# (we use forward slashes here because MSYS2 and Git accept them, and
|
||||
# they are easier on the eyes)
|
||||
UNCPATH="//localhost/${UNCPATH%%:*}\$/${UNCPATH#?:}"
|
||||
test -d "$UNCPATH" || {
|
||||
skip_all='could not access administrative share; skipping'
|
||||
test_done
|
||||
}
|
||||
UNCPATH="//localhost/${UNCPATH%%:*}\$$WITHOUTDRIVE"
|
||||
;;
|
||||
*)
|
||||
skip_all='skipping UNC path tests, cannot determine current path as UNC'
|
||||
@@ -36,6 +33,18 @@ case "$UNCPATH" in
|
||||
;;
|
||||
esac
|
||||
|
||||
test_expect_success 'clone into absolute path lacking a drive prefix' '
|
||||
USINGBACKSLASHES="$(echo "$WITHOUTDRIVE"/without-drive-prefix |
|
||||
tr / \\\\)" &&
|
||||
git clone . "$USINGBACKSLASHES" &&
|
||||
test -f without-drive-prefix/.git/HEAD
|
||||
'
|
||||
|
||||
test -d "$UNCPATH" || {
|
||||
skip_all='could not access administrative share; skipping'
|
||||
test_done
|
||||
}
|
||||
|
||||
test_expect_success setup '
|
||||
test_commit initial
|
||||
'
|
||||
|
||||
@@ -94,6 +94,13 @@ test_expect_success 'clone does not detect username:password when it is https://
|
||||
! grep "uses plaintext credentials" err
|
||||
'
|
||||
|
||||
test_expect_success CASE_INSENSITIVE_FS 'core.worktree is not added due to path case' '
|
||||
|
||||
mkdir UPPERCASE &&
|
||||
git clone src "$(pwd)/uppercase" &&
|
||||
test "unset" = "$(git -C UPPERCASE config --default unset core.worktree)"
|
||||
'
|
||||
|
||||
test_expect_success 'clone from hooks' '
|
||||
|
||||
test_create_repo r0 &&
|
||||
|
||||
@@ -239,7 +239,7 @@ test_expect_success 'push update refs failure' '
|
||||
echo "update fail" >>file &&
|
||||
git commit -a -m "update fail" &&
|
||||
git rev-parse --verify testgit/origin/heads/update >expect &&
|
||||
test_expect_code 1 env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
|
||||
test_must_fail env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
|
||||
git push origin update &&
|
||||
git rev-parse --verify testgit/origin/heads/update >actual &&
|
||||
test_cmp expect actual
|
||||
|
||||
@@ -788,4 +788,14 @@ test_expect_success 'traverse into directories that may have ignored entries' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success MINGW 'clean does not traverse mount points' '
|
||||
mkdir target &&
|
||||
>target/dont-clean-me &&
|
||||
git init with-mountpoint &&
|
||||
cmd //c "mklink /j with-mountpoint\\mountpoint target" &&
|
||||
git -C with-mountpoint clean -dfx &&
|
||||
test_path_is_missing with-mountpoint/mountpoint &&
|
||||
test_path_is_file target/dont-clean-me
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -586,6 +586,48 @@ test_expect_success 'cleanup commit messages (scissors option,-F,-e, scissors on
|
||||
test_must_be_empty actual
|
||||
'
|
||||
|
||||
test_expect_success 'helper-editor' '
|
||||
|
||||
write_script lf-to-crlf.sh <<-\EOF
|
||||
sed "s/\$/Q/" <"$1" | tr Q "\\015" >"$1".new &&
|
||||
mv -f "$1".new "$1"
|
||||
EOF
|
||||
'
|
||||
|
||||
test_expect_success 'cleanup commit messages (scissors option,-F,-e, CR/LF line endings)' '
|
||||
|
||||
test_config core.editor "\"$PWD/lf-to-crlf.sh\"" &&
|
||||
scissors="# ------------------------ >8 ------------------------" &&
|
||||
|
||||
test_write_lines >text \
|
||||
"# Keep this comment" "" " $scissors" \
|
||||
"# Keep this comment, too" "$scissors" \
|
||||
"# Remove this comment" "$scissors" \
|
||||
"Remove this comment, too" &&
|
||||
|
||||
test_write_lines >expect \
|
||||
"# Keep this comment" "" " $scissors" \
|
||||
"# Keep this comment, too" &&
|
||||
|
||||
git commit --cleanup=scissors -e -F text --allow-empty &&
|
||||
git cat-file -p HEAD >raw &&
|
||||
sed -e "1,/^\$/d" raw >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'cleanup commit messages (scissors option,-F,-e, scissors on first line, CR/LF line endings)' '
|
||||
|
||||
scissors="# ------------------------ >8 ------------------------" &&
|
||||
test_write_lines >text \
|
||||
"$scissors" \
|
||||
"# Remove this comment and any following lines" &&
|
||||
cp text /tmp/test2-text &&
|
||||
git commit --cleanup=scissors -e -F text --allow-empty --allow-empty-message &&
|
||||
git cat-file -p HEAD >raw &&
|
||||
sed -e "1,/^\$/d" raw >actual &&
|
||||
test_must_be_empty actual
|
||||
'
|
||||
|
||||
test_expect_success 'cleanup commit messages (strip option,-F)' '
|
||||
|
||||
echo >>negative &&
|
||||
|
||||
@@ -789,4 +789,15 @@ test_expect_success 'fast-export --first-parent outputs all revisions output by
|
||||
)
|
||||
'
|
||||
|
||||
cat > expected << EOF
|
||||
reset refs/heads/master
|
||||
from $(git rev-parse master)
|
||||
|
||||
EOF
|
||||
|
||||
test_expect_failure 'refs are updated even if no commits need to be exported' '
|
||||
git fast-export master..master > actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "protocol.h"
|
||||
|
||||
static int debug;
|
||||
/* TODO: put somewhere sensible, e.g. git_transport_options? */
|
||||
static int auto_gc = 1;
|
||||
|
||||
struct helper_data {
|
||||
const char *name;
|
||||
@@ -478,10 +480,25 @@ static int get_exporter(struct transport *transport,
|
||||
for (i = 0; i < revlist_args->nr; i++)
|
||||
strvec_push(&fastexport->args, revlist_args->items[i].string);
|
||||
|
||||
strvec_push(&fastexport->args, "--");
|
||||
|
||||
fastexport->git_cmd = 1;
|
||||
return start_command(fastexport);
|
||||
}
|
||||
|
||||
static void check_helper_status(struct helper_data *data)
|
||||
{
|
||||
int pid, status;
|
||||
|
||||
pid = waitpid(data->helper->pid, &status, WNOHANG);
|
||||
if (pid < 0)
|
||||
die("Could not retrieve status of remote helper '%s'",
|
||||
data->name);
|
||||
if (pid > 0 && WIFEXITED(status))
|
||||
die("Remote helper '%s' died with %d",
|
||||
data->name, WEXITSTATUS(status));
|
||||
}
|
||||
|
||||
static int fetch_with_import(struct transport *transport,
|
||||
int nr_heads, struct ref **to_fetch)
|
||||
{
|
||||
@@ -518,6 +535,7 @@ static int fetch_with_import(struct transport *transport,
|
||||
|
||||
if (finish_command(&fastimport))
|
||||
die(_("error while running fast-import"));
|
||||
check_helper_status(data);
|
||||
|
||||
/*
|
||||
* The fast-import stream of a remote helper that advertises
|
||||
@@ -551,6 +569,12 @@ static int fetch_with_import(struct transport *transport,
|
||||
}
|
||||
}
|
||||
strbuf_release(&buf);
|
||||
if (auto_gc) {
|
||||
const char *argv_gc_auto[] = {
|
||||
"gc", "--auto", "--quiet", NULL,
|
||||
};
|
||||
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1122,6 +1146,7 @@ static int push_refs_with_export(struct transport *transport,
|
||||
|
||||
if (finish_command(&exporter))
|
||||
die(_("error while running fast-export"));
|
||||
check_helper_status(data);
|
||||
if (push_update_refs_status(data, remote_refs, flags))
|
||||
return 1;
|
||||
|
||||
|
||||
13
wt-status.c
13
wt-status.c
@@ -22,7 +22,7 @@
|
||||
#define AB_DELAY_WARNING_IN_MS (2 * 1000)
|
||||
|
||||
static const char cut_line[] =
|
||||
"------------------------ >8 ------------------------\n";
|
||||
"------------------------ >8 ------------------------";
|
||||
|
||||
static char default_wt_status_colors[][COLOR_MAXLEN] = {
|
||||
GIT_COLOR_NORMAL, /* WT_STATUS_HEADER */
|
||||
@@ -1068,15 +1068,22 @@ conclude:
|
||||
status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
|
||||
}
|
||||
|
||||
static inline int starts_with_newline(const char *p)
|
||||
{
|
||||
return *p == '\n' || (*p == '\r' && p[1] == '\n');
|
||||
}
|
||||
|
||||
size_t wt_status_locate_end(const char *s, size_t len)
|
||||
{
|
||||
const char *p;
|
||||
struct strbuf pattern = STRBUF_INIT;
|
||||
|
||||
strbuf_addf(&pattern, "\n%c %s", comment_line_char, cut_line);
|
||||
if (starts_with(s, pattern.buf + 1))
|
||||
if (starts_with(s, pattern.buf + 1) &&
|
||||
starts_with_newline(s + pattern.len - 1))
|
||||
len = 0;
|
||||
else if ((p = strstr(s, pattern.buf)))
|
||||
else if ((p = strstr(s, pattern.buf)) &&
|
||||
starts_with_newline(p + pattern.len))
|
||||
len = p - s + 1;
|
||||
strbuf_release(&pattern);
|
||||
return len;
|
||||
|
||||
Reference in New Issue
Block a user