Merge branch 'master' into ds/backfill

* master: (446 commits)
  The seventh batch
  The sixth batch
  The fifth batch
  The fourth batch
  refs/reftable: fix uninitialized memory access of `max_index`
  remote: announce removal of "branches/" and "remotes/"
  The third batch
  hash.h: drop unsafe_ function variants
  csum-file: introduce hashfile_checkpoint_init()
  t/helper/test-hash.c: use unsafe_hash_algo()
  csum-file.c: use unsafe_hash_algo()
  hash.h: introduce `unsafe_hash_algo()`
  csum-file.c: extract algop from hashfile_checksum_valid()
  csum-file: store the hash algorithm as a struct field
  t/helper/test-tool: implement sha1-unsafe helper
  trace2: prevent segfault on config collection with valueless true
  refs: fix creation of reflog entries for symrefs
  ci: wire up Visual Studio build with Meson
  ci: raise error when Meson generates warnings
  meson: fix compilation with Visual Studio
  ...
This commit is contained in:
Junio C Hamano
2025-02-03 16:12:33 -08:00
649 changed files with 19152 additions and 8312 deletions

View File

@@ -113,15 +113,13 @@ jobs:
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: actions/checkout@v4
- name: setup SDK
shell: powershell
run: ci/install-sdk.ps1
- uses: git-for-windows/setup-git-for-windows-sdk@v1
- name: build
shell: powershell
shell: bash
env:
HOME: ${{runner.workspace}}
NO_PERL: 1
run: git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts'
run: . /etc/profile && ci/make-test-artifacts.sh artifacts
- name: zip up tracked files
run: git archive -o artifacts/tracked.tar.gz HEAD
- name: upload tracked files and build artifacts
@@ -149,12 +147,10 @@ jobs:
- name: extract tracked files and build artifacts
shell: bash
run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
- name: setup SDK
shell: powershell
run: ci/install-sdk.ps1
- uses: git-for-windows/setup-git-for-windows-sdk@v1
- name: test
shell: powershell
run: git-sdk/usr/bin/bash.exe -l -c 'ci/run-test-slice.sh ${{matrix.nr}} 10'
shell: bash
run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
- name: print test failures
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
shell: bash
@@ -252,6 +248,58 @@ jobs:
with:
name: failed-tests-windows-vs-${{ matrix.nr }}
path: ${{env.FAILED_TEST_ARTIFACTS}}
windows-meson-build:
name: win+Meson build
needs: ci-config
if: needs.ci-config.outputs.enabled == 'yes'
runs-on: windows-latest
concurrency:
group: windows-meson-build-${{ github.ref }}
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Set up dependencies
shell: pwsh
run: pip install meson ninja
- name: Setup
shell: pwsh
run: meson setup build -Dperl=disabled
- name: Compile
shell: pwsh
run: meson compile -C build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: windows-meson-artifacts
path: build
windows-meson-test:
name: win+Meson test
runs-on: windows-latest
needs: [ci-config, windows-meson-build]
strategy:
fail-fast: false
matrix:
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
concurrency:
group: windows-meson-test-${{ matrix.nr }}-${{ github.ref }}
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Set up dependencies
shell: pwsh
run: pip install meson ninja
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: windows-meson-artifacts
path: build
- name: Test
shell: pwsh
run: meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % 10 } | Where-Object Name -EQ ${{ matrix.nr }} | ForEach-Object { meson test -C build --no-rebuild --print-errorlogs $_.Group }
regular:
name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
needs: ci-config
@@ -269,9 +317,8 @@ jobs:
- jobname: linux-reftable
cc: clang
pool: ubuntu-latest
- jobname: linux-gcc
- jobname: linux-breaking-changes
cc: gcc
cc_package: gcc-8
pool: ubuntu-20.04
- jobname: linux-TEST-vars
cc: gcc
@@ -286,9 +333,9 @@ jobs:
- jobname: osx-gcc
cc: gcc-13
pool: macos-13
- jobname: linux-gcc-default
cc: gcc
pool: ubuntu-latest
- jobname: osx-meson
cc: clang
pool: macos-13
- jobname: linux-leaks
cc: gcc
pool: ubuntu-latest
@@ -298,11 +345,15 @@ jobs:
- jobname: linux-asan-ubsan
cc: clang
pool: ubuntu-latest
- jobname: linux-meson
cc: gcc
pool: ubuntu-latest
env:
CC: ${{matrix.vector.cc}}
CC_PACKAGE: ${{matrix.vector.cc_package}}
jobname: ${{matrix.vector.jobname}}
distro: ${{matrix.vector.pool}}
TEST_OUTPUT_DIRECTORY: ${{github.workspace}}/t
runs-on: ${{matrix.vector.pool}}
steps:
- uses: actions/checkout@v4
@@ -342,12 +393,21 @@ jobs:
- jobname: linux-musl
image: alpine
distro: alpine-latest
# Supported until 2025-04-02.
- jobname: linux32
image: i386/ubuntu:focal
distro: ubuntu32-20.04
- jobname: pedantic
image: fedora
distro: fedora-latest
# A RHEL 8 compatible distro. Supported until 2029-05-31.
- jobname: almalinux-8
image: almalinux:8
distro: almalinux-8
# Supported until 2026-08-31.
- jobname: debian-11
image: debian:11
distro: debian-11
env:
jobname: ${{matrix.vector.jobname}}
distro: ${{matrix.vector.distro}}

3
.gitignore vendored
View File

@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
/bin-wrappers/
/git
/git-add
/git-am
@@ -195,9 +194,11 @@
/config-list.h
/command-list.h
/hook-list.h
/version-def.h
*.tar.gz
*.dsc
*.deb
/git.rc
/git.spec
*.exe
*.[aos]

View File

@@ -20,6 +20,7 @@ test:linux:
- saas-linux-medium-amd64
variables:
CUSTOM_PATH: "/custom"
TEST_OUTPUT_DIRECTORY: "/tmp/test-output"
before_script:
- ./ci/install-dependencies.sh
script:
@@ -31,11 +32,12 @@ test:linux:
if test "$CI_JOB_STATUS" != 'success'
then
sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
fi
parallel:
matrix:
- jobname: linux-old
image: ubuntu:16.04
image: ubuntu:20.04
CC: gcc
- jobname: linux-sha256
image: ubuntu:latest
@@ -43,17 +45,13 @@ test:linux:
- jobname: linux-reftable
image: ubuntu:latest
CC: clang
- jobname: linux-gcc
- jobname: linux-breaking-changes
image: ubuntu:20.04
CC: gcc
CC_PACKAGE: gcc-8
- jobname: linux-TEST-vars
image: ubuntu:20.04
CC: gcc
CC_PACKAGE: gcc-8
- jobname: linux-gcc-default
image: ubuntu:latest
CC: gcc
- jobname: linux-leaks
image: ubuntu:latest
CC: gcc
@@ -67,6 +65,9 @@ test:linux:
image: fedora:latest
- jobname: linux-musl
image: alpine:latest
- jobname: linux-meson
image: ubuntu:latest
CC: gcc
artifacts:
paths:
- t/failed-test-artifacts
@@ -99,10 +100,13 @@ test:osx:
parallel:
matrix:
- jobname: osx-clang
image: macos-13-xcode-14
image: macos-14-xcode-15
CC: clang
- jobname: osx-reftable
image: macos-13-xcode-14
image: macos-14-xcode-15
CC: clang
- jobname: osx-meson
image: macos-14-xcode-15
CC: clang
artifacts:
paths:
@@ -141,6 +145,44 @@ test:mingw64:
- git-sdk/usr/bin/bash.exe -l -c 'ci/print-test-failures.sh'
parallel: 10
.msvc-meson:
tags:
- saas-windows-medium-amd64
before_script:
- choco install -y git meson ninja openssl
- Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
- refreshenv
# The certificate store for Python on Windows is broken and fails to fetch
# certificates, see https://bugs.python.org/issue36011. This seems to
# mostly be an issue with how the GitLab image is set up as it is a
# non-issue on GitHub Actions. Work around the issue by importing
# cetrificates manually.
- Invoke-WebRequest https://curl.haxx.se/ca/cacert.pem -OutFile cacert.pem
- openssl pkcs12 -export -nokeys -in cacert.pem -out certs.pfx -passout "pass:"
- Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root -FilePath certs.pfx
build:msvc-meson:
extends: .msvc-meson
stage: build
script:
- meson setup build -Dperl=disabled
- meson compile -C build
artifacts:
paths:
- build
test:msvc-meson:
extends: .msvc-meson
stage: test
when: manual
timeout: 6h
needs:
- job: "build:msvc-meson"
artifacts: true
script:
- meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % $Env:CI_NODE_TOTAL + 1 } | Where-Object Name -EQ $Env:CI_NODE_INDEX | ForEach-Object { meson test -C build --no-rebuild --print-errorlogs $_.Group }
parallel: 10
test:fuzz-smoke-tests:
image: ubuntu:latest
stage: test

View File

@@ -12,6 +12,9 @@ cmds-*.txt
mergetools-*.txt
SubmittingPatches.txt
tmp-doc-diff/
tmp-meson-diff/
GIT-ASCIIDOCFLAGS
/.build/
/GIT-EXCLUDED-PROGRAMS
/asciidoc.conf
/asciidoctor-extensions.rb

View File

@@ -154,6 +154,31 @@ Cf. <xmqq1rjuz6n3.fsf_-_@gitster.c.googlers.com>,
<CAKvOHKAFXQwt4D8yUCCkf_TQL79mYaJ=KAKhtpDNTvHJFuX1NA@mail.gmail.com>,
<20230323204047.GA9290@coredump.intra.peff.net>,
* Support for storing shorthands for remote URLs in "$GIT_COMMON_DIR/branches/"
and "$GIT_COMMON_DIR/remotes/" has been long superseded by storing remotes in
the repository configuration.
+
The mechanism has originally been introduced in f170e4b39d ([PATCH] fetch/pull:
short-hand notation for remote repositories., 2005-07-16) and was superseded by
6687f8fea2 ([PATCH] Use .git/remote/origin, not .git/branches/origin.,
2005-08-20), where we switched from ".git/branches/" to ".git/remotes/". That
commit already mentions an upcoming deprecation of the ".git/branches/"
directory, and starting with a1d4aa7424 (Add repository-layout document.,
2005-09-01) we have also marked this layout as deprecated. Eventually we also
started to migrate away from ".git/remotes/" in favor of config-based remotes,
and we have marked the directory as legacy in 3d3d282146 (Documentation:
Grammar correction, wording fixes and cleanup, 2011-08-23)
+
As our documentation mentions, these directories are not to be found in modern
repositories at all and most users aren't even aware of these mechanisms. They
have been deprecated for almost 20 years and 14 years respectively, and we are
not aware of any active users that have complained about this deprecation.
Furthermore, the ".git/branches/" directory is nowadays misleadingly named and
may cause confusion as "branches" are almost exclusively used in the context of
references.
+
These features will be removed.
== Superseded features that will not be deprecated
Some features have gained newer replacements that aim to improve the design in

View File

@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
@@ -703,16 +703,30 @@ Program Output
Error Messages
- Do not end error messages with a full stop.
- Do not end a single-sentence error message with a full stop.
- Do not capitalize the first word, only because it is the first word
in the message ("unable to open %s", not "Unable to open %s"). But
in the message ("unable to open '%s'", not "Unable to open '%s'"). But
"SHA-3 not supported" is fine, because the reason the first word is
capitalized is not because it is at the beginning of the sentence,
but because the word would be spelled in capital letters even when
it appeared in the middle of the sentence.
- Say what the error is first ("cannot open %s", not "%s: cannot open")
- Say what the error is first ("cannot open '%s'", not "%s: cannot open").
- Enclose the subject of an error inside a pair of single quotes,
e.g. `die(_("unable to open '%s'"), path)`.
- Unless there is a compelling reason not to, error messages from
porcelain commands should be marked for translation, e.g.
`die(_("bad revision %s"), revision)`.
- Error messages from the plumbing commands are sometimes meant for
machine consumption and should not be marked for translation,
e.g., `die("bad revision %s", revision)`.
- BUG("message") are for communicating the specific error to developers,
thus should not be translated.
Externally Visible Names

View File

@@ -1,6 +1,8 @@
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak
.PHONY: FORCE
# Guard against environment variables
MAN1_TXT =
MAN5_TXT =
@@ -111,6 +113,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
@@ -148,16 +151,12 @@ man5dir = $(mandir)/man5
man7dir = $(mandir)/man7
# DESTDIR =
GIT_DATE := $(shell git show --quiet --pretty='%as')
ASCIIDOC = asciidoc
ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
-amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
-arevdate='$(GIT_DATE)'
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -182,6 +181,10 @@ endif
-include ../config.mak.autogen
-include ../config.mak
# Set GIT_VERSION_OVERRIDE such that version_gen knows to substitute
# GIT_VERSION in case it was set by the user.
GIT_VERSION_OVERRIDE := $(GIT_VERSION)
ifndef NO_MAN_BOLD_LITERAL
XMLTO_EXTRA += -m manpage-bold-literal.xsl
endif
@@ -210,6 +213,12 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
DBLATEX_COMMON =
XMLTO_EXTRA += --skip-validation
XMLTO_EXTRA += -x manpage.xsl
asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
$(QUIET_GEN)$(call version_gen,"$(shell pwd)/..",$<,$@)
else
asciidoc.conf: asciidoc.conf.in FORCE
$(QUIET_GEN)$(call version_gen,"$(shell pwd)/..",$<,$@)
endif
ASCIIDOC_DEPS += docinfo.html
@@ -218,6 +227,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -268,22 +278,17 @@ install-pdf: pdf
install-html: html
'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
../GIT-VERSION-FILE: FORCE
$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
mergetools-list.made $(mergetools_txt) \
$(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
$(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
$(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
@@ -305,22 +310,14 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
$(mergetools_txt): mergetools-list.made
mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
$(QUIET_GEN) \
$(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
. ../git-mergetool--lib.sh && \
show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
$(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
. ../git-mergetool--lib.sh && \
show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
date >$@
mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
mergetools-diff.txt:
$(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
mergetools-merge.txt:
$(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
@@ -341,6 +338,8 @@ clean:
$(RM) SubmittingPatches.txt
$(RM) $(cmds_txt) $(mergetools_txt) *.made
$(RM) GIT-ASCIIDOCFLAGS
$(RM) asciidoc.conf asciidoctor-extensions.rb
$(RM) -rf tmp-meson-diff
docinfo.html: docinfo-html.in
$(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ -364,16 +363,16 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
user-manual.xml: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
user-manual.xml: user-manual.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
technical/api-index.txt: technical/api-index-skel.txt \
technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
$(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
$(QUIET_GEN)'$(SHELL_PATH_SQ)' technical/api-index.sh ./technical ./technical/api-index.txt
technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
asciidoc.conf GIT-ASCIIDOCFLAGS
$(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
SubmittingPatches.txt: SubmittingPatches
@@ -413,16 +412,16 @@ gitman.info: gitman.texi
$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
$(QUIET_DB2TEXI)$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@
howto-index.txt: howto-index.sh $(HOWTO_TXT)
$(QUIET_GEN)'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(HOWTO_TXT)) >$@
howto-index.txt: howto/howto-index.sh $(HOWTO_TXT)
$(QUIET_GEN)'$(SHELL_PATH_SQ)' ./howto/howto-index.sh $(sort $(HOWTO_TXT)) >$@
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
WEBDOC_DEST = /pub/software/scm/git/docs
howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt GIT-ASCIIDOCFLAGS
$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC) \
sed -e '1,/^$$/d' $< | \
$(TXT_TO_HTML) - >$@
@@ -496,6 +495,20 @@ lint-docs-fsck-msgids: $(LINT_DOCS_FSCK_MSGIDS)
lint-docs-manpages:
$(QUIET_GEN)./lint-manpages.sh
.PHONY: lint-docs-meson
lint-docs-meson:
@# awk acts up when trying to match single quotes, so we use \047 instead.
@mkdir -p tmp-meson-diff && \
awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \
grep -v -e '#' -e '^$$' | \
sort >tmp-meson-diff/meson.txt && \
ls git*.txt scalar.txt | grep -v -e git-bisect-lk2009.txt -e git-tools.txt >tmp-meson-diff/actual.txt && \
if ! cmp tmp-meson-diff/meson.txt tmp-meson-diff/actual.txt; then \
echo "Meson man pages differ from actual man pages:"; \
diff -u tmp-meson-diff/meson.txt tmp-meson-diff/actual.txt; \
exit 1; \
fi
## Lint: list of targets above
.PHONY: lint-docs
lint-docs: lint-docs-fsck-msgids
@@ -503,6 +516,7 @@ lint-docs: lint-docs-gitlink
lint-docs: lint-docs-man-end-blurb
lint-docs: lint-docs-man-section-order
lint-docs: lint-docs-manpages
lint-docs: lint-docs-meson
ifeq ($(wildcard po/Makefile),po/Makefile)
doc-l10n install-l10n::

View File

@@ -0,0 +1,5 @@
Git v2.40.4 Release Notes
=========================
This release lets Git refuse to accept URLs that contain control
sequences. This addresses CVE-2024-50349 and CVE-2024-52006.

View File

@@ -0,0 +1,6 @@
Git v2.41.3 Release Notes
=========================
This release merges up the fix that appears in v2.40.4 to address
the security issues CVE-2024-50349 and CVE-2024-52006; see the
release notes for that version for details.

View File

@@ -0,0 +1,6 @@
Git v2.42.4 Release Notes
=========================
This release merges up the fix that appears in v2.40.4 and v2.41.3
to address the security issues CVE-2024-50349 and CVE-2024-52006;
see the release notes for these versions for details.

View File

@@ -0,0 +1,7 @@
Git v2.43.6 Release Notes
=========================
This release merges up the fix that appears in v2.40.4, v2.41.3
and v2.42.4 to address the security issues CVE-2024-50349 and
CVE-2024-52006; see the release notes for these versions for
details.

View File

@@ -0,0 +1,7 @@
Git v2.44.3 Release Notes
=========================
This release merges up the fix that appears in v2.40.4, v2.41.3,
v2.42.4 and v2.43.6 to address the security issues CVE-2024-50349
and CVE-2024-52006; see the release notes for these versions
for details.

View File

@@ -1,7 +1,12 @@
Git v2.45.3 Release Notes
=========================
This primarily is to backport various small fixes accumulated on the
This release merges up the fix that appears in v2.40.4, v2.41.3,
v2.42.4, v2.43.6 and v2.44.3 to address the security issues
CVE-2024-50349 and CVE-2024-52006; see the release notes for
these versions for details.
This version also backports various small fixes accumulated on the
'master' front during the development towards Git 2.46, the next
feature release.

View File

@@ -0,0 +1,6 @@
Git v2.46.3 Release Notes
=========================
This release merges up the fix that appears in v2.40.4, v2.41.3, v2.42.4,
v2.43.6, v2.44.3 and v2.45.3 to address the security issues CVE-2024-50349 and
CVE-2024-52006; see the release notes for these versions for details.

View File

@@ -0,0 +1,7 @@
Git v2.47.2 Release Notes
=========================
This release merges up the fix that appears in v2.40.4, v2.41.3,
v2.42.4, v2.43.6, v2.44.3, v2.45.3 and v2.46.3 to address the
security issues CVE-2024-50349 and CVE-2024-52006; see the release
notes for these versions for details.

View File

@@ -21,6 +21,24 @@ UI, Workflows & Features
* Drop support for older libcURL and Perl.
* End-user experience of "git mergetool" when the command errors out
has been improved.
* "git bundle --unbundle" and "git clone" running on a bundle file
both learned to trigger fsck over the new objects with configurable
fck check levels.
* When "git fetch $remote" notices that refs/remotes/$remote/HEAD is
missing and discovers what branch the other side points with its
HEAD, refs/remotes/$remote/HEAD is updated to point to it.
* "git fetch" honors "remote.<remote>.followRemoteHEAD" settings to
tweak the remote-tracking HEAD in "refs/remotes/<remote>/HEAD".
* "git range-diff" learned to optionally show and compare merge
commits in the ranges being compared, with the --diff-merges
option.
Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
@@ -29,15 +47,15 @@ Performance, Internal Implementation, Development Support etc.
* The way AsciiDoc is used for SYNOPSIS part of the manual pages has
been revamped. The sources, at least for the simple cases, got
vastly pleasant to work with.
vastly more pleasant to work with.
* The reftable library is now prepared to expect that the memory
allocation function given to it may fail to allocate and to deal
with such an error.
* An extra worktree attached to a repository points at each other to
allow finding the repository from the worktree and vice versa
possible. Turn this linkage to relative paths.
allow finding the repository from the worktree (and vice versa)
possible. Use relative paths for this linkage.
* Enable Windows-based CI in GitLab.
@@ -76,7 +94,7 @@ Performance, Internal Implementation, Development Support etc.
* Update the project's CodingGuidelines to discourage naming functions
with a "_1()" suffix.
* Updates the '.clang-format' to match project conventions.
* Update '.clang-format' to match project conventions.
* Centralize documentation for repository extensions into a single place.
@@ -98,7 +116,7 @@ Performance, Internal Implementation, Development Support etc.
* The migration procedure between two ref backends has been optimized.
* "git fsck" learned to issue warnings on "curiously formatted" ref
contents that have always been taken valid but something Git
contents that have always been treated as valid but that Git
wouldn't have written itself (e.g., missing terminating end-of-line
after the full object name).
@@ -107,18 +125,61 @@ Performance, Internal Implementation, Development Support etc.
* Built-in Git subcommands are supplied the repository object to work
with; they learned to do the same when they invoke sub-subcommands.
* Drop support for ancient environments in various CI jobs.
* Isolate the reftable subsystem from the rest of Git's codebase by
using fewer pieces of Git's infrastructure.
* Optimize reading random references out of the reftable backend by
allowing reuse of iterator objects.
* Backport oss-fuzz tests to our codebase.
* Introduce a new repository extension to prevent older Git versions
from mis-interpreting worktrees created with relative paths.
* Yet another "pass the repository through the callchain" topic.
* "git describe" learned to stop digging the history needlessly
deeper.
* Build procedure update plus introduction of Meson based builds.
* Recent reftable updates mistook a NULL return from a request for
0-byte allocation as OOM and died unnecessarily, which has been
corrected.
* Reftable backend adds check for upper limit of log's update_index.
* Start working to make the codebase buildable with -Wsign-compare.
* Regression fix for 'show-index' when run outside of a repository.
* The meson-build procedure is integrated into CI to catch and
prevent bitrotting.
* "git refs migrate" learned to also migrate the reflog data across
backends.
* The developer documentation has been updated to give the latest
info on gitk and git-gui maintainer.
* CI jobs that run threaded programs under LSan has been giving false
positives from time to time, which has been worked around.
Fixes since v2.47
-----------------
* Doc update to clarify how periodical maintenance are scheduled,
spread across time to avoid thundering hurds.
spread across time to avoid thundering herds.
* Use after free and double freeing at the end in "git log -L... -p"
had been identified and fixed.
* On macOS, fsmonitor can fall into a race condition that results in
a client waiting forever to be notified for an event that have
a client waiting forever to be notified about an event that has
already happened. This problem has been corrected.
* "git maintenance start" crashed due to an uninitialized variable
@@ -142,7 +203,7 @@ Fixes since v2.47
* The dumb-http code regressed when the result of re-indexing a pack
yielded an *.idx file that differs in content from the *.idx file
it downloaded from the remote. This has been corrected by no longer
relying on: the *.idx file we got from the remote.
relying on the *.idx file we got from the remote.
* When called with '--left-right' and '--use-bitmap-index', 'rev-list'
will produce output without any left/right markers, which has been
@@ -166,7 +227,7 @@ Fixes since v2.47
* "git gc" discards any objects that are outside promisor packs that
are referred to by an object in a promisor pack, and we do not
refetch them from the promisor at runtime, resulting an unusable
repository. Work it around by including these objects in the
repository. Work around it by including these objects in the
referring promisor pack at the receiving end of the fetch.
* Avoid build/test breakage on a system without working malloc debug
@@ -204,8 +265,66 @@ Fixes since v2.47
* The sequencer failed to honor core.commentString in some places.
* Describe a case where an option value needs to be spelled as a
separate argument, i.e. "--opt val", not "--opt=val".
(merge 1bc1e94091 jc/doc-opt-tilde-expand later to maint).
* Loosen overly strict ownership check introduced in the recent past,
to keep the promise "cloning a suspicious repository is a safe
first step to inspect it".
(merge 0ffb5a6bf1 bc/allow-upload-pack-from-other-people later to maint).
* "git fast-import" learned to reject paths with ".." and "." as
their components to avoid creating invalid tree objects.
(merge 8cb4c6e62f en/fast-import-verify-path later to maint).
* The --ancestry-path option is designed to be given a commit that is
on the path, which was not documented, which has been corrected.
(merge bc1a980759 kk/doc-ancestry-path later to maint).
* "git tag" has been taught to refuse to create refs/tags/HEAD
since such a tag will be confusing in the context of the UI provided by
the Git Porcelain commands.
(merge bbd445d5ef jc/forbid-head-as-tagname later to maint).
* The advice messages now tell the newer 'git config set' command to
set the advice.token configuration variable to squelch a message.
(merge 6c397d0104 bf/explicit-config-set-in-advice-messages later to maint).
* The syntax ":/<text>" to name the latest commit with the matching
text was broken with a recent change, which has been corrected.
(merge 0ff919e87a ps/commit-with-message-syntax-fix later to maint).
* Fix performance regression of a recent "fatten promisor pack with
local objects" protection against an unwanted gc.
* "git log -p --remerge-diff --reverse" was completely broken.
(merge f94bfa1516 js/log-remerge-keep-ancestry later to maint).
* "git bundle create" with an annotated tag on the positive end of
the revision range had a workaround code for older limitation in
the revision walker, which has become unnecessary.
(merge dd1072dfa8 tc/bundle-with-tag-remove-workaround later to maint).
* GitLab CI updates.
(merge c6b43f663e ps/ci-gitlab-update later to maint).
* Code to reuse objects based on bitmap contents have been tightened
to avoid race condition even when multiple packs are involved.
(merge 62b3ec8a3f tb/bitmap-fix-pack-reuse later to maint).
* An earlier "csum-file checksum does not have to be computed with
sha1dc" topic had a few code paths that had initialized an
implementation of a hash function to be used by an unmatching hash
by mistake, which have been corrected.
(merge 599a63409b ps/weak-sha1-for-tail-sum-fix later to maint).
* Other code cleanup, docfix, build fix, etc.
(merge 77af53f56f aa/t7300-modernize later to maint).
(merge dcd590a39d bf/t-readme-mention-reftable later to maint).
(merge 68e3c69efa kh/trailer-in-glossary later to maint).
(merge 91f88f76e6 tb/boundary-traversal-fix later to maint).
(merge 168ebb7159 jc/doc-error-message-guidelines later to maint).
(merge 18693d7d65 kh/doc-bundle-typofix later to maint).
(merge e2f5d3b491 kh/doc-update-ref-grammofix later to maint).
(merge 8525e92886 mh/doc-windows-home-env later to maint).

View File

@@ -0,0 +1,7 @@
Git v2.48.1 Release Notes
=========================
This release merges up the fix that appears in v2.40.4, v2.41.3,
v2.42.4, v2.43.6, v2.44.3, v2.45.3, v2.46.3, and v2.47.2 to address
the security issues CVE-2024-50349 and CVE-2024-52006; see the release
notes for these versions for details.

View File

@@ -0,0 +1,140 @@
Git v2.49 Release Notes
=======================
UI, Workflows & Features
------------------------
* Completion script updates for zsh
Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
* More -Wsign-compare fixes.
* meson-based build now supports the unsafe-sha1 build knob.
* The code to check LSan results has been simplified and made more
robust.
(merge 164a2516eb jk/lsan-race-ignore-false-positive later to maint).
* More code paths have a repository passed through the callchain,
instead of assuming the primary the_repository object.
* Move a few more unit tests to the clar test framework.
* Introduce a new API to visit objects in batches based on a common
path, or by type.
* Following the procedure we established to introduce breaking
changes for Git 3.0, allow an early opt-in for removing support of
$GIT_DIR/branches/ and $GIT_DIR/remotes/ directories to configure
remotes.
Fixes since v2.48
-----------------
* "git submodule" learned various ways to spell the same option,
e.g. "--branch=B" can be spelled "--branch B" or "-bB".
(merge b86f0f9071 re/submodule-parse-opt later to maint).
* Tweak the help text used for the option value placeholders by
parse-options API so that translations can customize the "<>"
placeholder signal (e.g. "--option=<value>").
(merge 5b34dd08d0 as/long-option-help-i18n later to maint).
* CI jobs gave sporadic failures, which turns out that that the
object finalization code was giving an error when it did not have
to.
(merge d7fcbe2c56 ps/object-collision-check later to maint).
* The code to compute "unique" name used git_rand() which can fail or
get stuck; the callsite does not require cryptographic security.
Introduce the "insecure" mode and use it appropriately.
(merge 0b4f8afef6 ps/reftable-get-random-fix later to maint).
* A misconfigured "fsck.skiplist" configuration variable was not
diagnosed as an error, which has been corrected.
(merge ca7158076f jt/fsck-skiplist-parse-fix later to maint).
* Extended SHA-1 expression parser did not work well when a branch
with an unusual name (e.g. "foo{bar") is involved.
(merge 191f0c8db2 en/object-name-with-funny-refname-fix later to maint).
* The meson build procedure looked for the 'version-def.h' file in a
wrong directory, which has been corrected.
(merge 4771501c0a tc/meson-use-our-version-def-h later to maint).
* The meson build procedure for Documentation/technical/ hierarchy was
missing necessary dependencies, which has been corrected.
(merge 1dca492edd sj/meson-doc-technical-dependency-fix later to maint).
* The "instaweb" bound only to local IP address without "--local" and
to all addresses with "--local", which was the other way around, when
using Python's http.server class, which has been corrected.
(merge 76baf97fa1 ak/instaweb-python-port-binding-fix later to maint).
* Document that it is insecure to use Personal Access Tokens, which
some hosting providers take as username/password, embedded in URLs.
(merge a90ff409f0 mh/doc-credential-helpers-with-pat later to maint).
* The help text from "git $cmd -h" appear on the standard output for
some $cmd and the standard error for others. The built-in commands
have been fixed to show them on the standard output consistently.
(merge f66d1423f5 jc/show-usage-help later to maint).
* The meson-driven build is now aware of "git-subtree" housed in
contrib/subtree hierarchy.
(merge 8454b42f94 ps/build-meson-subtree later to maint).
* It was possible for "git unpack-objects" and "git index-pack" to
make an unaligned access, which has been corrected.
(merge 98046591b9 jk/pack-header-parse-alignment-fix later to maint).
* The "cache" credential back-end did not handle authtype correctly,
which has been corrected.
(merge 0b43274850 mh/credential-cache-authtype-request-fix later to maint).
* "git branch --sort=..." and "git for-each-ref --format=... --sort=..."
did not work as expected with some atoms, which has been corrected.
(merge c5490ce9d1 rs/ref-fitler-used-atoms-value-fix later to maint).
* reflog entries for symbolic ref updates were broken, which has been
corrected.
(merge 3519492430 kn/reflog-symref-fix later to maint).
* The trace2 code was not prepared to show a configuration variable
that is set to true using the valueless true syntax, which has been
corrected.
(merge 2fd367cf63 am/trace2-with-valueless-true later to maint).
* The "git refs migrate" command did not migrate the reflog for
refs/stash, which is the contents of the stashes, which has been
corrected.
(merge a0bea0978f ps/reflog-migration-with-logall-fix later to maint).
* Doc and short-help text for "show-index" has been clarified to
stress that the command reads its data from the standard input.
(merge 49edce4ff9 jc/show-index-h-update later to maint).
* The API around choosing to use unsafe variant of SHA-1
implementation has been updated in an attempt to make it harder to
abuse.
(merge 04292c3796 tb/unsafe-hash-cleanup later to maint).
* Fix bugs in an earlier attempt to fix "git refs migration".
(merge f11f0a5a2d kn/reflog-migration-fix-fix later to maint).
* Other code cleanup, docfix, build fix, etc.
(merge ddb5287894 jk/t7407-use-test-grep later to maint).
(merge 21e1b44865 aj/difftool-config-doc-fix later to maint).
(merge 6a63995335 mh/gitattr-doc-markup-fix later to maint).
(merge 43850dcf9c sk/unit-test-hash later to maint).
(merge 4ad47d2de3 jc/cli-doc-option-and-config later to maint).
(merge 2d0ff147e5 jp/t8002-printf-fix later to maint).
(merge 69666e6746 ja/doc-restore-markup-update later to maint).
(merge d11d003ba5 sk/strlen-returns-size_t later to maint).
(merge 77b2d29e91 ja/doc-notes-markup-updates later to maint).
(merge 6979bf6f8f jk/combine-diff-cleanup later to maint).
(merge 8705c9bd13 kn/pack-write-with-reduced-globals later to maint).

View File

@@ -692,16 +692,17 @@ rebase when I receive your patches).
Some parts of the system have dedicated maintainers with their own
repositories.
- `git-gui/` comes from git-gui project, maintained by Johannes Sixt:
- `git-gui/` comes from the git-gui project, maintained by Johannes Sixt:
https://github.com/j6t/git-gui
- `gitk-git/` comes from Paul Mackerras's gitk project:
Contibutions should go via the git mailing list.
git://git.ozlabs.org/~paulus/gitk
- `gitk-git/` comes from the gitk project, maintained by Johannes Sixt:
Those who are interested in improving gitk can volunteer to help Paul
maintain it, cf. <YntxL/fTplFm8lr6@cleo>.
https://github.com/j6t/gitk
Contibutions should go via the git mailing list.
- `po/` comes from the localization coordinator, Jiang Xin:

View File

@@ -21,13 +21,26 @@ tilde=&#126;
apostrophe=&#39;
backtick=&#96;
litdd=&#45;&#45;
manmanual=Git Manual
mansource=Git @GIT_VERSION@
revdate=@GIT_DATE@
ifdef::doctype-book[]
[titles]
underlines="__","==","--","~~","^^"
endif::doctype-book[]
ifdef::backend-docbook[]
[linkgit-inlinemacro]
ifndef::doctype-book[]
{0%{target}}
{0#<citerefentry>}
{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
{0#</citerefentry>}
endif::doctype-book[]
ifdef::doctype-book[]
<ulink url="{target}.html">{target}{0?({0})}</ulink>
endif::doctype-book[]
[literal-inlinemacro]
{eval:re.sub(r'(&lt;[-a-zA-Z0-9.]+&gt;)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|&gt;)(\.?([-a-zA-Z0-9:+=~@,\/_^\$]+\.?)+)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))}

View File

@@ -29,13 +29,12 @@ module Git
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
def process document, output
if document.basebackend? 'docbook'
mansource = document.attributes['mansource']
manversion = document.attributes['manversion']
manmanual = document.attributes['manmanual']
output = output.sub(/<refmiscinfo class="source">.*?<\/refmiscinfo>/, "")
output = output.sub(/<refmiscinfo class="manual">.*?<\/refmiscinfo>/, "")
output = output.sub(/<date>.*?<\/date>/, "<date>@GIT_DATE@</date>")
new_tags = "" \
"<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \
"<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \
"<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
"<refmiscinfo class=\"source\">Git @GIT_VERSION@</refmiscinfo>\n" \
"<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end
output

View File

@@ -1,5 +1,6 @@
#!/usr/bin/perl
my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@ for my $text (<*.txt>) {
chomp;
s/^include::\s*//;
s/\[\]//;
s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}

View File

@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
my ($out, $nameattr) = @_;
my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
open I, '<', "$name.txt" or die "No such file $name.txt";
open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
die "No description found in $name.txt";
die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
my ($input, @categories) = @ARGV;
my ($source_dir, $build_dir, @categories) = @ARGV;
open IN, "<$input";
open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ close IN;
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
open O, '>', "$out+" or die "Cannot open output file $out+";
my ($path) = "$build_dir/$out";
open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
format_one(\*O, $_);
format_one($source_dir, \*O, $_);
}
close O;
if (-f "$out" && compare("$out", "$out+") == 0) {
unlink "$out+";
if (-f "$path" && compare("$path", "$path+") == 0) {
unlink "$path+";
}
else {
print STDERR "$out\n";
rename "$out+", "$out";
rename "$path+", "$path";
}
}

View File

@@ -1,29 +1,34 @@
commit.cleanup::
ifdef::git-commit[]
:see-git-commit:
endif::git-commit[]
ifndef::git-commit[]
:see-git-commit: See linkgit:git-commit[1] for details.
endif::git-commit[]
`commit.cleanup`::
This setting overrides the default of the `--cleanup` option in
`git commit`. See linkgit:git-commit[1] for details. Changing the
default can be useful when you always want to keep lines that begin
`git commit`. {see-git-commit} Changing the default can be useful
when you always want to keep lines that begin
with the comment character `#` in your log message, in which case you
would do `git config commit.cleanup whitespace` (note that you will
have to remove the help lines that begin with `#` in the commit log
template yourself, if you do this).
commit.gpgSign::
`commit.gpgSign`::
A boolean to specify whether all commits should be GPG signed.
Use of this option when doing operations such as rebase can
result in a large number of commits being signed. It may be
convenient to use an agent to avoid typing your GPG passphrase
several times.
commit.status::
`commit.status`::
A boolean to enable/disable inclusion of status information in the
commit message template when using an editor to prepare the commit
message. Defaults to true.
message. Defaults to `true`.
commit.template::
`commit.template`::
Specify the pathname of a file to use as the template for
new commit messages.
commit.verbose::
`commit.verbose`::
A boolean or int to specify the level of verbosity with `git commit`.
See linkgit:git-commit[1].
{see-git-commit}

View File

@@ -22,6 +22,17 @@ credential.useHttpPath::
or https URL to be important. Defaults to false. See
linkgit:gitcredentials[7] for more information.
credential.sanitizePrompt::
By default, user names and hosts that are shown as part of the
password prompt are not allowed to contain control characters (they
will be URL-encoded by default). Configure this setting to `false` to
override that behavior.
credential.protectProtocol::
By default, Carriage Return characters are not allowed in the protocol
that is used when Git talks to a credential helper. This setting allows
users to override this default.
credential.username::
If no username is set for a network authentication, use this username
by default. See credential.<context>.* below, and

View File

@@ -218,8 +218,6 @@ endif::git-diff[]
Set this option to `true` to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
include::../mergetools-diff.txt[]
`diff.indentHeuristic`::
Set this option to `false` to disable the default heuristics
that shift diff hunk boundaries to make patches easier to read.

View File

@@ -13,6 +13,8 @@ diff.guitool::
and requires that a corresponding difftool.<guitool>.cmd variable
is defined.
include::{build_dir}/mergetools-diff.txt[]
difftool.<tool>.cmd::
Specify the command to invoke the specified diff tool.
The specified command is evaluated in shell with the following

View File

@@ -63,6 +63,12 @@ Note that this setting should only be set by linkgit:git-init[1] or
linkgit:git-clone[1]. Trying to change it after initialization will not
work and will produce hard-to-diagnose issues.
relativeWorktrees::
If enabled, indicates at least one worktree has been linked with
relative paths. Automatically set if a worktree has been created or
repaired with either the `--relative-paths` option or with the
`worktree.useRelativePaths` config set to `true`.
worktreeConfig::
If enabled, then worktrees will load config settings from the
`$GIT_DIR/config.worktree` file in addition to the

View File

@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
include::../mergetools-merge.txt[]
include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge

View File

@@ -1,4 +1,4 @@
notes.mergeStrategy::
`notes.mergeStrategy`::
Which merge strategy to choose by default when resolving notes
conflicts. Must be one of `manual`, `ours`, `theirs`, `union`, or
`cat_sort_uniq`. Defaults to `manual`. See the "NOTES MERGE STRATEGIES"
@@ -7,17 +7,17 @@ notes.mergeStrategy::
This setting can be overridden by passing the `--strategy` option to
linkgit:git-notes[1].
notes.<name>.mergeStrategy::
`notes.<name>.mergeStrategy`::
Which merge strategy to choose when doing a notes merge into
refs/notes/<name>. This overrides the more general
"notes.mergeStrategy". See the "NOTES MERGE STRATEGIES" section in
`refs/notes/<name>`. This overrides the more general
`notes.mergeStrategy`. See the "NOTES MERGE STRATEGIES" section in
linkgit:git-notes[1] for more information on the available strategies.
notes.displayRef::
`notes.displayRef`::
Which ref (or refs, if a glob or specified more than once), in
addition to the default set by `core.notesRef` or
`GIT_NOTES_REF`, to read notes from when showing commit
messages with the 'git log' family of commands.
messages with the `git log` family of commands.
+
This setting can be overridden with the `GIT_NOTES_DISPLAY_REF`
environment variable, which must be a colon separated list of refs or
@@ -26,27 +26,27 @@ globs.
A warning will be issued for refs that do not exist,
but a glob that does not match any refs is silently ignored.
+
This setting can be disabled by the `--no-notes` option to the 'git
log' family of commands, or by the `--notes=<ref>` option accepted by
This setting can be disabled by the `--no-notes` option to the linkgit:git-log[1]
family of commands, or by the `--notes=<ref>` option accepted by
those commands.
+
The effective value of "core.notesRef" (possibly overridden by
GIT_NOTES_REF) is also implicitly added to the list of refs to be
The effective value of `core.notesRef` (possibly overridden by
`GIT_NOTES_REF`) is also implicitly added to the list of refs to be
displayed.
notes.rewrite.<command>::
When rewriting commits with <command> (currently `amend` or
`notes.rewrite.<command>`::
When rewriting commits with _<command>_ (currently `amend` or
`rebase`), if this variable is `false`, git will not copy
notes from the original to the rewritten commit. Defaults to
`true`. See also "`notes.rewriteRef`" below.
`true`. See also `notes.rewriteRef` below.
+
This setting can be overridden with the `GIT_NOTES_REWRITE_REF`
environment variable, which must be a colon separated list of refs or
globs.
notes.rewriteMode::
`notes.rewriteMode`::
When copying notes during a rewrite (see the
"notes.rewrite.<command>" option), determines what to do if
`notes.rewrite.<command>` option), determines what to do if
the target commit already has a note. Must be one of
`overwrite`, `concatenate`, `cat_sort_uniq`, or `ignore`.
Defaults to `concatenate`.
@@ -54,7 +54,7 @@ notes.rewriteMode::
This setting can be overridden with the `GIT_NOTES_REWRITE_MODE`
environment variable.
notes.rewriteRef::
`notes.rewriteRef`::
When copying notes during a rewrite, specifies the (fully
qualified) ref whose notes should be copied. May be a glob,
in which case notes in all matching refs will be copied. You

View File

@@ -101,6 +101,19 @@ remote.<name>.serverOption::
The default set of server options used when fetching from this remote.
These server options can be overridden by the `--server-option=` command
line arguments.
remote.<name>.followRemoteHEAD::
How linkgit:git-fetch[1] should handle updates to `remotes/<name>/HEAD`.
The default value is "create", which will create `remotes/<name>/HEAD`
if it exists on the remote, but not locally, but will not touch an
already existing local reference. Setting to "warn" will print
a message if the remote has a different value, than the local one and
in case there is no local reference, it behaves like "create".
A variant on "warn" is "warn-if-not-$branch", which behaves like
"warn", but if `HEAD` on the remote is `$branch` it will be silent.
Setting to "always" will silently update it to the value on the remote.
Finally, setting it to "never" will never change or create the local
reference.
+
This is a multi-valued variable, and an empty value can be used in a higher
priority configuration file (e.g. `.git/config` in a repository) to clear

View File

@@ -7,3 +7,13 @@ worktree.guessRemote::
such a branch exists, it is checked out and set as "upstream"
for the new branch. If no such match can be found, it falls
back to creating a new branch from the current HEAD.
worktree.useRelativePaths::
Link worktrees using relative paths (when "true") or absolute
paths (when "false"). This is particularly useful for setups
where the repository and worktrees may be moved between
different locations or environments. Defaults to "false".
+
Note that setting `worktree.useRelativePaths` to "true" implies enabling the
`extension.relativeWorktrees` config (see linkgit:git-config[1]),
thus making it incompatible with older versions of Git.

View File

@@ -0,0 +1,17 @@
#!/bin/sh
if test "$#" -ne 3
then
echo >&2 "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>"
exit 1
fi
SOURCE_DIR="$1"
TOOL_MODE="$2"
OUTPUT="$3"
MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
(
. "$SOURCE_DIR"/git-mergetool--lib.sh &&
show_tool_names can_$TOOL_MODE
) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"

View File

@@ -32,7 +32,7 @@ Git commands that fetch or otherwise "read" via protocols such as
possible linkgit:git-clone[1] a new repository from a bundle, to use
linkgit:git-fetch[1] to fetch from one, and to list the references
contained within it with linkgit:git-ls-remote[1]. There's no
corresponding "write" support, i.e.a 'git push' into a bundle is not
corresponding "write" support, i.e. a 'git push' into a bundle is not
supported.
BUNDLE FORMAT

View File

@@ -63,6 +63,9 @@ symbolic link, the clone will fail. This is a security measure to
prevent the unintentional copying of files by dereferencing the symbolic
links.
+
This option does not work with repositories owned by other users for security
reasons, and `--no-local` must be specified for the clone to succeed.
+
*NOTE*: this operation can race with concurrent modification to the
source repository, similar to running `cp -r <src> <dst>` while modifying
_<src>_.
@@ -384,6 +387,12 @@ $ cd my-linux
$ git clone --bare -l /home/proj/.git /pub/scm/proj.git
------------
* Clone a local repository from a different user:
+
------------
$ git clone --no-local /home/otheruser/proj.git /pub/scm/proj.git
------------
CONFIGURATION
-------------

View File

@@ -7,8 +7,8 @@ git-commit - Record changes to the repository
SYNOPSIS
--------
[verse]
'git commit' [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]
[synopsis]
git commit [-a | --interactive | --patch] [-s] [-v] [-u[<mode>]] [--amend]
[--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>]
[-F <file> | -m <msg>] [--reset-author] [--allow-empty]
[--allow-empty-message] [--no-verify] [-e] [--author=<author>]
@@ -23,31 +23,31 @@ Create a new commit containing the current contents of the index and
the given log message describing the changes. The new commit is a
direct child of HEAD, usually the tip of the current branch, and the
branch is updated to point to it (unless no branch is associated with
the working tree, in which case HEAD is "detached" as described in
the working tree, in which case `HEAD` is "detached" as described in
linkgit:git-checkout[1]).
The content to be committed can be specified in several ways:
1. by using linkgit:git-add[1] to incrementally "add" changes to the
index before using the 'commit' command (Note: even modified files
index before using the `commit` command (Note: even modified files
must be "added");
2. by using linkgit:git-rm[1] to remove files from the working tree
and the index, again before using the 'commit' command;
and the index, again before using the `commit` command;
3. by listing files as arguments to the 'commit' command
(without --interactive or --patch switch), in which
3. by listing files as arguments to the `commit` command
(without `--interactive` or `--patch` switch), in which
case the commit will ignore changes staged in the index, and instead
record the current content of the listed files (which must already
be known to Git);
4. by using the -a switch with the 'commit' command to automatically
4. by using the `-a` switch with the `commit` command to automatically
"add" changes from all known files (i.e. all files that are already
listed in the index) and to automatically "rm" files in the index
that have been removed from the working tree, and then perform the
actual commit;
5. by using the --interactive or --patch switches with the 'commit' command
5. by using the `--interactive` or `--patch` switches with the `commit` command
to decide one by one which files or hunks should be part of the commit
in addition to contents in the index,
before finalizing the operation. See the ``Interactive Mode'' section of
@@ -58,139 +58,139 @@ summary of what is included by any of the above for the next
commit by giving the same set of parameters (options and paths).
If you make a commit and then find a mistake immediately after
that, you can recover from it with 'git reset'.
that, you can recover from it with `git reset`.
:git-commit: 1
OPTIONS
-------
-a::
--all::
Tell the command to automatically stage files that have
`-a`::
`--all`::
Automatically stage files that have
been modified and deleted, but new files you have not
told Git about are not affected.
-p::
--patch::
`-p`::
`--patch`::
Use the interactive patch selection interface to choose
which changes to commit. See linkgit:git-add[1] for
details.
-C <commit>::
--reuse-message=<commit>::
Take an existing commit object, and reuse the log message
`-C <commit>`::
`--reuse-message=<commit>`::
Take an existing _<commit>_ object, and reuse the log message
and the authorship information (including the timestamp)
when creating the commit.
-c <commit>::
--reedit-message=<commit>::
Like '-C', but with `-c` the editor is invoked, so that
`-c <commit>`::
`--reedit-message=<commit>`::
Like `-C`, but with `-c` the editor is invoked, so that
the user can further edit the commit message.
--fixup=[(amend|reword):]<commit>::
Create a new commit which "fixes up" `<commit>` when applied with
`--fixup=[(amend|reword):]<commit>`::
Create a new commit which "fixes up" _<commit>_ when applied with
`git rebase --autosquash`. Plain `--fixup=<commit>` creates a
"fixup!" commit which changes the content of `<commit>` but leaves
"fixup!" commit which changes the content of _<commit>_ but leaves
its log message untouched. `--fixup=amend:<commit>` is similar but
creates an "amend!" commit which also replaces the log message of
`<commit>` with the log message of the "amend!" commit.
_<commit>_ with the log message of the "amend!" commit.
`--fixup=reword:<commit>` creates an "amend!" commit which
replaces the log message of `<commit>` with its own log message
but makes no changes to the content of `<commit>`.
replaces the log message of _<commit>_ with its own log message
but makes no changes to the content of _<commit>_.
+
The commit created by plain `--fixup=<commit>` has a subject
composed of "fixup!" followed by the subject line from <commit>,
composed of "fixup!" followed by the subject line from _<commit>_,
and is recognized specially by `git rebase --autosquash`. The `-m`
option may be used to supplement the log message of the created
commit, but the additional commentary will be thrown away once the
"fixup!" commit is squashed into `<commit>` by
"fixup!" commit is squashed into _<commit>_ by
`git rebase --autosquash`.
+
The commit created by `--fixup=amend:<commit>` is similar but its
subject is instead prefixed with "amend!". The log message of
<commit> is copied into the log message of the "amend!" commit and
_<commit>_ is copied into the log message of the "amend!" commit and
opened in an editor so it can be refined. When `git rebase
--autosquash` squashes the "amend!" commit into `<commit>`, the
log message of `<commit>` is replaced by the refined log message
--autosquash` squashes the "amend!" commit into _<commit>_, the
log message of _<commit>_ is replaced by the refined log message
from the "amend!" commit. It is an error for the "amend!" commit's
log message to be empty unless `--allow-empty-message` is
specified.
+
`--fixup=reword:<commit>` is shorthand for `--fixup=amend:<commit>
--only`. It creates an "amend!" commit with only a log message
--only`. It creates an "amend!" commit with only a log message
(ignoring any changes staged in the index). When squashed by `git
rebase --autosquash`, it replaces the log message of `<commit>`
rebase --autosquash`, it replaces the log message of _<commit>_
without making any other changes.
+
Neither "fixup!" nor "amend!" commits change authorship of
`<commit>` when applied by `git rebase --autosquash`.
_<commit>_ when applied by `git rebase --autosquash`.
See linkgit:git-rebase[1] for details.
--squash=<commit>::
Construct a commit message for use with `rebase --autosquash`.
`--squash=<commit>`::
Construct a commit message for use with `git rebase --autosquash`.
The commit message subject line is taken from the specified
commit with a prefix of "squash! ". Can be used with additional
commit message options (`-m`/`-c`/`-C`/`-F`). See
linkgit:git-rebase[1] for details.
--reset-author::
When used with -C/-c/--amend options, or when committing after a
`--reset-author`::
When used with `-C`/`-c`/`--amend` options, or when committing after a
conflicting cherry-pick, declare that the authorship of the
resulting commit now belongs to the committer. This also renews
the author timestamp.
--short::
`--short`::
When doing a dry-run, give the output in the short-format. See
linkgit:git-status[1] for details. Implies `--dry-run`.
--branch::
`--branch`::
Show the branch and tracking info even in short-format.
--porcelain::
`--porcelain`::
When doing a dry-run, give the output in a porcelain-ready
format. See linkgit:git-status[1] for details. Implies
`--dry-run`.
--long::
`--long`::
When doing a dry-run, give the output in the long-format.
Implies `--dry-run`.
-z::
--null::
`-z`::
`--null`::
When showing `short` or `porcelain` status output, print the
filename verbatim and terminate the entries with NUL, instead of LF.
filename verbatim and terminate the entries with _NUL_, instead of _LF_.
If no format is given, implies the `--porcelain` output format.
Without the `-z` option, filenames with "unusual" characters are
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]).
-F <file>::
--file=<file>::
Take the commit message from the given file. Use '-' to
`-F <file>`::
`--file=<file>`::
Take the commit message from _<file>_. Use '-' to
read the message from the standard input.
--author=<author>::
`--author=<author>`::
Override the commit author. Specify an explicit author using the
standard `A U Thor <author@example.com>` format. Otherwise <author>
standard `A U Thor <author@example.com>` format. Otherwise _<author>_
is assumed to be a pattern and is used to search for an existing
commit by that author (i.e. rev-list --all -i --author=<author>);
commit by that author (i.e. `git rev-list --all -i --author=<author>`);
the commit author is then copied from the first such commit found.
--date=<date>::
`--date=<date>`::
Override the author date used in the commit.
-m <msg>::
--message=<msg>::
Use the given <msg> as the commit message.
`-m <msg>`::
`--message=<msg>`::
Use _<msg>_ as the commit message.
If multiple `-m` options are given, their values are
concatenated as separate paragraphs.
+
The `-m` option is mutually exclusive with `-c`, `-C`, and `-F`.
-t <file>::
--template=<file>::
`-t <file>`::
`--template=<file>`::
When editing the commit message, start the editor with the
contents in the given file. The `commit.template` configuration
contents in _<file>_. The `commit.template` configuration
variable is often used to give this option implicitly to the
command. This mechanism can be used by projects that want to
guide participants with some hints on what to write in the message
@@ -200,56 +200,54 @@ The `-m` option is mutually exclusive with `-c`, `-C`, and `-F`.
include::signoff-option.txt[]
--trailer <token>[(=|:)<value>]::
Specify a (<token>, <value>) pair that should be applied as a
`--trailer <token>[(=|:)<value>]`::
Specify a (_<token>_, _<value>_) pair that should be applied as a
trailer. (e.g. `git commit --trailer "Signed-off-by:C O Mitter \
<committer@example.com>" --trailer "Helped-by:C O Mitter \
<committer@example.com>"` will add the "Signed-off-by" trailer
and the "Helped-by" trailer to the commit message.)
<committer@example.com>"` will add the `Signed-off-by` trailer
and the `Helped-by` trailer to the commit message.)
The `trailer.*` configuration variables
(linkgit:git-interpret-trailers[1]) can be used to define if
a duplicated trailer is omitted, where in the run of trailers
each trailer would appear, and other details.
-n::
--[no-]verify::
By default, the pre-commit and commit-msg hooks are run.
When any of `--no-verify` or `-n` is given, these are bypassed.
`-n`::
`--[no-]verify`::
Bypass the `pre-commit` and `commit-msg` hooks.
See also linkgit:githooks[5].
--allow-empty::
`--allow-empty`::
Usually recording a commit that has the exact same tree as its
sole parent commit is a mistake, and the command prevents you
from making such a commit. This option bypasses the safety, and
is primarily for use by foreign SCM interface scripts.
--allow-empty-message::
Like --allow-empty this command is primarily for use by foreign
SCM interface scripts. It allows you to create a commit with an
empty commit message without using plumbing commands like
linkgit:git-commit-tree[1].
`--allow-empty-message`::
Create a commit with an empty commit message without using plumbing
commands like linkgit:git-commit-tree[1]. Like `--allow-empty`, this
command is primarily for use by foreign SCM interface scripts.
--cleanup=<mode>::
This option determines how the supplied commit message should be
`--cleanup=<mode>`::
Determine how the supplied commit message should be
cleaned up before committing. The '<mode>' can be `strip`,
`whitespace`, `verbatim`, `scissors` or `default`.
+
--
strip::
`strip`::
Strip leading and trailing empty lines, trailing whitespace,
commentary and collapse consecutive empty lines.
whitespace::
`whitespace`::
Same as `strip` except #commentary is not removed.
verbatim::
`verbatim`::
Do not change the message at all.
scissors::
`scissors`::
Same as `whitespace` except that everything from (and including)
the line found below is truncated, if the message is to be edited.
"`#`" can be customized with core.commentChar.
"`#`" can be customized with `core.commentChar`.
# ------------------------ >8 ------------------------
default::
`default`::
Same as `strip` if the message is to be edited.
Otherwise `whitespace`.
--
@@ -257,19 +255,18 @@ default::
The default can be changed by the `commit.cleanup` configuration
variable (see linkgit:git-config[1]).
-e::
--edit::
The message taken from file with `-F`, command line with
`-m`, and from commit object with `-C` are usually used as
the commit log message unmodified. This option lets you
further edit the message taken from these sources.
`-e`::
`--edit`::
Let the user further edit the message taken from _<file>_
with `-F <file>`, command line with `-m <message>`, and
from _<commit>_ with `-C <commit>`.
--no-edit::
`--no-edit`::
Use the selected commit message without launching an editor.
For example, `git commit --amend --no-edit` amends a commit
without changing its commit message.
--amend::
`--amend`::
Replace the tip of the current branch by creating a new
commit. The recorded tree is prepared as usual (including
the effect of the `-i` and `-o` options and explicit
@@ -295,23 +292,23 @@ You should understand the implications of rewriting history if you
amend a commit that has already been published. (See the "RECOVERING
FROM UPSTREAM REBASE" section in linkgit:git-rebase[1].)
--no-post-rewrite::
Bypass the post-rewrite hook.
`--no-post-rewrite`::
Bypass the `post-rewrite` hook.
-i::
--include::
`-i`::
`--include`::
Before making a commit out of staged contents so far,
stage the contents of paths given on the command line
as well. This is usually not what you want unless you
are concluding a conflicted merge.
-o::
--only::
`-o`::
`--only`::
Make a commit by taking the updated working tree contents
of the paths specified on the
command line, disregarding any contents that have been
staged for other paths. This is the default mode of operation of
'git commit' if any paths are given on the command line,
`git commit` if any paths are given on the command line,
in which case this option can be omitted.
If this option is specified together with `--amend`, then
no paths need to be specified, which can be used to amend
@@ -319,48 +316,48 @@ FROM UPSTREAM REBASE" section in linkgit:git-rebase[1].)
already been staged. If used together with `--allow-empty`
paths are also not required, and an empty commit will be created.
--pathspec-from-file=<file>::
Pathspec is passed in `<file>` instead of commandline args. If
`<file>` is exactly `-` then standard input is used. Pathspec
elements are separated by LF or CR/LF. Pathspec elements can be
`--pathspec-from-file=<file>`::
Pass pathspec in _<file>_ instead of commandline args. If
_<file>_ is exactly `-` then standard input is used. Pathspec
elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]). See also `--pathspec-file-nul` and
global `--literal-pathspecs`.
--pathspec-file-nul::
`--pathspec-file-nul`::
Only meaningful with `--pathspec-from-file`. Pathspec elements are
separated with NUL character and all other characters are taken
separated with _NUL_ character and all other characters are taken
literally (including newlines and quotes).
-u[<mode>]::
--untracked-files[=<mode>]::
`-u[<mode>]`::
`--untracked-files[=<mode>]`::
Show untracked files.
+
--
The mode parameter is optional (defaults to 'all'), and is used to
specify the handling of untracked files; when -u is not used, the
default is 'normal', i.e. show untracked files and directories.
The _<mode>_ parameter is optional (defaults to `all`), and is used to
specify the handling of untracked files; when `-u` is not used, the
default is `normal`, i.e. show untracked files and directories.
The possible options are:
- 'no' - Show no untracked files
- 'normal' - Shows untracked files and directories
- 'all' - Also shows individual files in untracked directories.
`no`:: Show no untracked files
`normal`:: Shows untracked files and directories
`all`:: Also shows individual files in untracked directories.
All usual spellings for Boolean value `true` are taken as `normal`
and `false` as `no`.
The default can be changed using the status.showUntrackedFiles
The default can be changed using the `status.showUntrackedFiles`
configuration variable documented in linkgit:git-config[1].
--
-v::
--verbose::
Show unified diff between the HEAD commit and what
`-v`::
`--verbose`::
Show unified diff between the `HEAD` commit and what
would be committed at the bottom of the commit message
template to help the user describe the commit by reminding
what changes the commit has.
Note that this diff output doesn't have its
lines prefixed with '#'. This diff will not be a part
lines prefixed with `#`. This diff will not be a part
of the commit message. See the `commit.verbose` configuration
variable in linkgit:git-config[1].
+
@@ -368,40 +365,40 @@ If specified twice, show in addition the unified diff between
what would be committed and the worktree files, i.e. the unstaged
changes to tracked files.
-q::
--quiet::
`-q`::
`--quiet`::
Suppress commit summary message.
--dry-run::
`--dry-run`::
Do not create a commit, but show a list of paths that are
to be committed, paths with local changes that will be left
uncommitted and paths that are untracked.
--status::
`--status`::
Include the output of linkgit:git-status[1] in the commit
message template when using an editor to prepare the commit
message. Defaults to on, but can be used to override
configuration variable commit.status.
configuration variable `commit.status`.
--no-status::
`--no-status`::
Do not include the output of linkgit:git-status[1] in the
commit message template when using an editor to prepare the
default commit message.
-S[<keyid>]::
--gpg-sign[=<keyid>]::
--no-gpg-sign::
GPG-sign commits. The `keyid` argument is optional and
`-S[<key-id>]`::
`--gpg-sign[=<key-id>]`::
`--no-gpg-sign`::
GPG-sign commits. The _<key-id>_ is optional and
defaults to the committer identity; if specified, it must be
stuck to the option without a space. `--no-gpg-sign` is useful to
countermand both `commit.gpgSign` configuration variable, and
earlier `--gpg-sign`.
\--::
`--`::
Do not interpret any more arguments as options.
<pathspec>...::
When pathspec is given on the command line, commit the contents of
`<pathspec>...`::
When _<pathspec>_ is given on the command line, commit the contents of
the files that match the pathspec without recording the changes
already added to the index. The contents of these files are also
staged for the next commit on top of what have been staged before.
@@ -412,10 +409,10 @@ EXAMPLES
--------
When recording your own work, the contents of modified files in
your working tree are temporarily stored to a staging area
called the "index" with 'git add'. A file can be
called the "index" with `git add`. A file can be
reverted back, only in the index but not in the working tree,
to that of the last commit with `git restore --staged <file>`,
which effectively reverts 'git add' and prevents the changes to
which effectively reverts `git add` and prevents the changes to
this file from participating in the next commit. After building
the state to be committed incrementally with these commands,
`git commit` (without any pathname parameter) is used to record what
@@ -443,7 +440,7 @@ $ git commit -a
------------
The command `git commit -a` first looks at your working tree,
notices that you have modified hello.c and removed goodbye.c,
notices that you have modified `hello.c` and removed `goodbye.c`,
and performs necessary `git add` and `git rm` for you.
After staging changes to many files, you can alter the order the
@@ -471,13 +468,13 @@ $ git commit
this second commit would record the changes to `hello.c` and
`hello.h` as expected.
After a merge (initiated by 'git merge' or 'git pull') stops
After a merge (initiated by `git merge` or `git pull`) stops
because of conflicts, cleanly merged
paths are already staged to be committed for you, and paths that
conflicted are left in unmerged state. You would have to first
check which paths are conflicting with 'git status'
check which paths are conflicting with `git status`
and after fixing them manually in your working tree, you would
stage the result as usual with 'git add':
stage the result as usual with `git add`:
------------
$ git status | grep unmerged
@@ -507,12 +504,12 @@ COMMIT INFORMATION
Author and committer information is taken from the following environment
variables, if set:
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_AUTHOR_DATE
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
GIT_COMMITTER_DATE
* `GIT_AUTHOR_NAME`
* `GIT_AUTHOR_EMAIL`
* `GIT_AUTHOR_DATE`
* `GIT_COMMITTER_NAME`
* `GIT_COMMITTER_EMAIL`
* `GIT_COMMITTER_DATE`
(nb "<", ">" and "\n"s are stripped)
@@ -524,7 +521,7 @@ that, see the `credential.username` variable in linkgit:git-config[1].
In case (some of) these environment variables are not set, the information
is taken from the configuration items `user.name` and `user.email`, or, if not
present, the environment variable EMAIL, or, if that is not set,
present, the environment variable `EMAIL`, or, if that is not set,
system user name and the hostname used for outgoing mail (taken
from `/etc/mailname` and falling back to the fully qualified hostname when
that file does not exist).
@@ -555,7 +552,7 @@ include::i18n.txt[]
ENVIRONMENT AND CONFIGURATION VARIABLES
---------------------------------------
The editor used to edit the commit log message will be chosen from the
`GIT_EDITOR` environment variable, the core.editor configuration variable, the
`GIT_EDITOR` environment variable, the `core.editor` configuration variable, the
`VISUAL` environment variable, or the `EDITOR` environment variable (in that
order). See linkgit:git-var[1] for details.

View File

@@ -78,6 +78,23 @@ variable (this example increases the cache time to 1 hour):
$ git config credential.helper 'cache --timeout=3600'
-------------------------------------------------------
PERSONAL ACCESS TOKENS
----------------------
Some remotes accept personal access tokens, which are randomly
generated and hard to memorise. They typically have a lifetime of weeks
or months.
git-credential-cache is inherently unsuitable for persistent storage of
personal access tokens. The credential will be forgotten after the cache
timeout. Even if you configure a long timeout, credentials will be
forgotten if the daemon dies.
To avoid frequently regenerating personal access tokens, configure a
credential helper with persistent storage. Alternatively, configure an
OAuth credential helper to generate credentials automatically. See
linkgit:gitcredentials[7], sections "Available helpers" and "OAuth".
GIT
---
Part of the linkgit:git[1] suite

View File

@@ -7,19 +7,19 @@ git-notes - Add or inspect object notes
SYNOPSIS
--------
[verse]
'git notes' [list [<object>]]
'git notes' add [-f] [--allow-empty] [--[no-]separator | --separator=<paragraph-break>] [--[no-]stripspace] [-F <file> | -m <msg> | (-c | -C) <object>] [-e] [<object>]
'git notes' copy [-f] ( --stdin | <from-object> [<to-object>] )
'git notes' append [--allow-empty] [--[no-]separator | --separator=<paragraph-break>] [--[no-]stripspace] [-F <file> | -m <msg> | (-c | -C) <object>] [-e] [<object>]
'git notes' edit [--allow-empty] [<object>] [--[no-]stripspace]
'git notes' show [<object>]
'git notes' merge [-v | -q] [-s <strategy> ] <notes-ref>
'git notes' merge --commit [-v | -q]
'git notes' merge --abort [-v | -q]
'git notes' remove [--ignore-missing] [--stdin] [<object>...]
'git notes' prune [-n] [-v]
'git notes' get-ref
[synopsis]
git notes [list [<object>]]
git notes add [-f] [--allow-empty] [--[no-]separator | --separator=<paragraph-break>] [--[no-]stripspace] [-F <file> | -m <msg> | (-c | -C) <object>] [-e] [<object>]
git notes copy [-f] ( --stdin | <from-object> [<to-object>] )
git notes append [--allow-empty] [--[no-]separator | --separator=<paragraph-break>] [--[no-]stripspace] [-F <file> | -m <msg> | (-c | -C) <object>] [-e] [<object>]
git notes edit [--allow-empty] [<object>] [--[no-]stripspace]
git notes show [<object>]
git notes merge [-v | -q] [-s <strategy> ] <notes-ref>
git notes merge --commit [-v | -q]
git notes merge --abort [-v | -q]
git notes remove [--ignore-missing] [--stdin] [<object>...]
git notes prune [-n] [-v]
git notes get-ref
DESCRIPTION
@@ -33,34 +33,34 @@ ENVIRONMENT sections below. If this ref does not exist, it will be
quietly created when it is first needed to store a note.
A typical use of notes is to supplement a commit message without
changing the commit itself. Notes can be shown by 'git log' along with
changing the commit itself. Notes can be shown by `git log` along with
the original commit message. To distinguish these notes from the
message stored in the commit object, the notes are indented like the
message, after an unindented line saying "Notes (<refname>):" (or
message, after an unindented line saying "Notes (_<refname>_):" (or
"Notes:" for `refs/notes/commits`).
Notes can also be added to patches prepared with `git format-patch` by
using the `--notes` option. Such notes are added as a patch commentary
after a three dash separator line.
To change which notes are shown by 'git log', see the
"notes.displayRef" discussion in <<CONFIGURATION>>.
To change which notes are shown by `git log`, see the
`notes.displayRef` discussion in <<CONFIGURATION,CONFIGURATION>>.
See the "notes.rewrite.<command>" configuration for a way to carry
See the `notes.rewrite.<command>` configuration for a way to carry
notes across commands that rewrite commits.
SUBCOMMANDS
-----------
list::
`list`::
List the notes object for a given object. If no object is
given, show a list of all note objects and the objects they
annotate (in the format "<note-object> <annotated-object>").
annotate (in the format "`<note-object> <annotated-object>`").
This is the default subcommand if no subcommand is given.
add::
Add notes for a given object (defaults to HEAD). Abort if the
`add`::
Add notes for a given object (defaults to `HEAD`). Abort if the
object already has notes (use `-f` to overwrite existing notes).
However, if you're using `add` interactively (using an editor
to supply the notes contents), then - instead of aborting -
@@ -71,10 +71,10 @@ add::
fine-tune the message(s) supplied from `-m` and `-F` options
interactively (using an editor) before adding the note.
copy::
`copy`::
Copy the notes for the first object onto the second object (defaults to
HEAD). Abort if the second object already has notes, or if the first
object has none (use -f to overwrite existing notes to the
`HEAD`). Abort if the second object already has notes, or if the first
object has none (use `-f` to overwrite existing notes to the
second object). This subcommand is equivalent to:
`git notes add [-f] -C $(git notes list <from-object>) <to-object>`
+
@@ -84,27 +84,27 @@ In `--stdin` mode, take lines in the format
<from-object> SP <to-object> [ SP <rest> ] LF
----------
+
on standard input, and copy the notes from each <from-object> to its
corresponding <to-object>. (The optional `<rest>` is ignored so that
on standard input, and copy the notes from each _<from-object>_ to its
corresponding _<to-object>_. (The optional _<rest>_ is ignored so that
the command can read the input given to the `post-rewrite` hook.)
append::
`append`::
Append new message(s) given by `-m` or `-F` options to an
existing note, or add them as a new note if one does not
exist, for the object (defaults to HEAD). When appending to
exist, for the object (defaults to `HEAD`). When appending to
an existing note, a blank line is added before each new
message as an inter-paragraph separator. The separator can
be customized with the `--separator` option.
Edit the notes to be appended given by `-m` and `-F` options with
`-e` interactively (using an editor) before appending the note.
edit::
Edit the notes for a given object (defaults to HEAD).
`edit`::
Edit the notes for a given object (defaults to `HEAD`).
show::
Show the notes for a given object (defaults to HEAD).
`show`::
Show the notes for a given object (defaults to `HEAD`).
merge::
`merge`::
Merge the given notes ref into the current notes ref.
This will try to merge the changes made by the given
notes ref (called "remote") since the merge-base (if
@@ -112,35 +112,35 @@ merge::
+
If conflicts arise and a strategy for automatically resolving
conflicting notes (see the "NOTES MERGE STRATEGIES" section) is not given,
the "manual" resolver is used. This resolver checks out the
the `manual` resolver is used. This resolver checks out the
conflicting notes in a special worktree (`.git/NOTES_MERGE_WORKTREE`),
and instructs the user to manually resolve the conflicts there.
When done, the user can either finalize the merge with
'git notes merge --commit', or abort the merge with
'git notes merge --abort'.
`git notes merge --commit`, or abort the merge with
`git notes merge --abort`.
remove::
Remove the notes for given objects (defaults to HEAD). When
`remove`::
Remove the notes for given objects (defaults to `HEAD`). When
giving zero or one object from the command line, this is
equivalent to specifying an empty note message to
the `edit` subcommand.
prune::
`prune`::
Remove all notes for non-existing/unreachable objects.
get-ref::
`get-ref`::
Print the current notes ref. This provides an easy way to
retrieve the current notes ref (e.g. from scripts).
OPTIONS
-------
-f::
--force::
`-f`::
`--force`::
When adding notes to an object that already has notes,
overwrite the existing notes (instead of aborting).
-m <msg>::
--message=<msg>::
`-m <msg>`::
`--message=<msg>`::
Use the given note message (instead of prompting).
If multiple `-m` options are given, their values
are concatenated as separate paragraphs.
@@ -148,95 +148,96 @@ OPTIONS
single line between paragraphs will be stripped out.
If you wish to keep them verbatim, use `--no-stripspace`.
-F <file>::
--file=<file>::
Take the note message from the given file. Use '-' to
`-F <file>`::
`--file=<file>`::
Take the note message from the given file. Use `-` to
read the note message from the standard input.
Lines starting with `#` and empty lines other than a
single line between paragraphs will be stripped out.
If you wish to keep them verbatim, use `--no-stripspace`.
-C <object>::
--reuse-message=<object>::
`-C <object>`::
`--reuse-message=<object>`::
Take the given blob object (for example, another note) as the
note message. (Use `git notes copy <object>` instead to
copy notes between objects.). By default, message will be
copied verbatim, but if you wish to strip out the lines
starting with `#` and empty lines other than a single line
between paragraphs, use with`--stripspace` option.
between paragraphs, use with `--stripspace` option.
-c <object>::
--reedit-message=<object>::
Like '-C', but with `-c` the editor is invoked, so that
`-c <object>`::
`--reedit-message=<object>`::
Like `-C`, but with `-c` the editor is invoked, so that
the user can further edit the note message.
--allow-empty::
`--allow-empty`::
Allow an empty note object to be stored. The default behavior is
to automatically remove empty notes.
--[no-]separator, --separator=<paragraph-break>::
`--[no-]separator`::
`--separator=<paragraph-break>`::
Specify a string used as a custom inter-paragraph separator
(a newline is added at the end as needed). If `--no-separator`, no
separators will be added between paragraphs. Defaults to a blank
line.
--[no-]stripspace::
`--[no-]stripspace`::
Strip leading and trailing whitespace from the note message.
Also strip out empty lines other than a single line between
paragraphs. Lines starting with `#` will be stripped out
in non-editor cases like `-m`, `-F` and `-C`, but not in
editor case like `git notes edit`, `-c`, etc.
--ref <ref>::
Manipulate the notes tree in <ref>. This overrides
`GIT_NOTES_REF` and the "core.notesRef" configuration. The ref
`--ref <ref>`::
Manipulate the notes tree in _<ref>_. This overrides
`GIT_NOTES_REF` and the `core.notesRef` configuration. The ref
specifies the full refname when it begins with `refs/notes/`; when it
begins with `notes/`, `refs/` and otherwise `refs/notes/` is prefixed
to form a full name of the ref.
--ignore-missing::
`--ignore-missing`::
Do not consider it an error to request removing notes from an
object that does not have notes attached to it.
--stdin::
`--stdin`::
Also read the object names to remove notes from the standard
input (there is no reason you cannot combine this with object
names from the command line).
-n::
--dry-run::
`-n`::
`--dry-run`::
Do not remove anything; just report the object names whose notes
would be removed.
-s <strategy>::
--strategy=<strategy>::
`-s <strategy>`::
`--strategy=<strategy>`::
When merging notes, resolve notes conflicts using the given
strategy. The following strategies are recognized: "manual"
(default), "ours", "theirs", "union" and "cat_sort_uniq".
This option overrides the "notes.mergeStrategy" configuration setting.
strategy. The following strategies are recognized: `manual`
(default), `ours`, `theirs`, `union` and `cat_sort_uniq`.
This option overrides the `notes.mergeStrategy` configuration setting.
See the "NOTES MERGE STRATEGIES" section below for more
information on each notes merge strategy.
--commit::
Finalize an in-progress 'git notes merge'. Use this option
when you have resolved the conflicts that 'git notes merge'
stored in .git/NOTES_MERGE_WORKTREE. This amends the partial
merge commit created by 'git notes merge' (stored in
.git/NOTES_MERGE_PARTIAL) by adding the notes in
.git/NOTES_MERGE_WORKTREE. The notes ref stored in the
.git/NOTES_MERGE_REF symref is updated to the resulting commit.
`--commit`::
Finalize an in-progress `git notes merge`. Use this option
when you have resolved the conflicts that `git notes merge`
stored in `.git/NOTES_MERGE_WORKTREE`. This amends the partial
merge commit created by `git notes merge` (stored in
`.git/NOTES_MERGE_PARTIAL`) by adding the notes in
`.git/NOTES_MERGE_WORKTREE`. The notes ref stored in the
`.git/NOTES_MERGE_REF` symref is updated to the resulting commit.
--abort::
Abort/reset an in-progress 'git notes merge', i.e. a notes merge
`--abort`::
Abort/reset an in-progress `git notes merge`, i.e. a notes merge
with conflicts. This simply removes all files related to the
notes merge.
-q::
--quiet::
`-q`::
`--quiet`::
When merging notes, operate quietly.
-v::
--verbose::
`-v`::
`--verbose`::
When merging notes, be more verbose.
When pruning notes, report all object names whose notes are
removed.
@@ -270,28 +271,28 @@ object, in which case the history of the notes can be read with
NOTES MERGE STRATEGIES
----------------------
The default notes merge strategy is "manual", which checks out
The default notes merge strategy is `manual`, which checks out
conflicting notes in a special work tree for resolving notes conflicts
(`.git/NOTES_MERGE_WORKTREE`), and instructs the user to resolve the
conflicts in that work tree.
When done, the user can either finalize the merge with
'git notes merge --commit', or abort the merge with
'git notes merge --abort'.
`git notes merge --commit`, or abort the merge with
`git notes merge --abort`.
Users may select an automated merge strategy from among the following using
either -s/--strategy option or configuring notes.mergeStrategy accordingly:
either `-s`/`--strategy` option or configuring `notes.mergeStrategy` accordingly:
"ours" automatically resolves conflicting notes in favor of the local
`ours` automatically resolves conflicting notes in favor of the local
version (i.e. the current notes ref).
"theirs" automatically resolves notes conflicts in favor of the remote
`theirs` automatically resolves notes conflicts in favor of the remote
version (i.e. the given notes ref being merged into the current notes
ref).
"union" automatically resolves notes conflicts by concatenating the
`union` automatically resolves notes conflicts by concatenating the
local and remote versions.
"cat_sort_uniq" is similar to "union", but in addition to concatenating
`cat_sort_uniq` is similar to `union`, but in addition to concatenating
the local and remote versions, this strategy also sorts the resulting
lines, and removes duplicate lines from the result. This is equivalent
to applying the "cat | sort | uniq" shell pipeline to the local and
@@ -320,7 +321,7 @@ Notes:
In principle, a note is a regular Git blob, and any kind of
(non-)format is accepted. You can binary-safely create notes from
arbitrary files using 'git hash-object':
arbitrary files using `git hash-object`:
------------
$ cc *.c
@@ -331,7 +332,7 @@ $ git notes --ref=built add --allow-empty -C "$blob" HEAD
(You cannot simply use `git notes --ref=built add -F a.out HEAD`
because that is not binary-safe.)
Of course, it doesn't make much sense to display non-text-format notes
with 'git log', so if you use such notes, you'll probably need to write
with `git log`, so if you use such notes, you'll probably need to write
some special-purpose tools to do something useful with them.
@@ -339,7 +340,7 @@ some special-purpose tools to do something useful with them.
CONFIGURATION
-------------
core.notesRef::
`core.notesRef`::
Notes ref to read and manipulate instead of
`refs/notes/commits`. Must be an unabbreviated ref name.
This setting can be overridden through the environment and

View File

@@ -10,7 +10,8 @@ SYNOPSIS
[verse]
'git range-diff' [--color=[<when>]] [--no-color] [<diff-options>]
[--no-dual-color] [--creation-factor=<factor>]
[--left-only | --right-only]
[--left-only | --right-only] [--diff-merges=<format>]
[--remerge-diff]
( <range1> <range2> | <rev1>...<rev2> | <base> <rev1> <rev2> )
[[--] <path>...]
@@ -81,6 +82,20 @@ to revert to color all lines according to the outer diff markers
Suppress commits that are missing from the second specified range
(or the "right range" when using the `<rev1>...<rev2>` format).
--diff-merges=<format>::
Instead of ignoring merge commits, generate diffs for them using the
corresponding `--diff-merges=<format>` option of linkgit:git-log[1],
and include them in the comparison.
+
Note: In the common case, the `remerge` mode will be the most natural one
to use, as it shows only the diff on top of what Git's merge machinery would
have produced. In other words, if a merge commit is the result of a
non-conflicting `git merge`, the `remerge` mode will represent it with an empty
diff.
--remerge-diff::
Convenience option, equivalent to `--diff-merges=remerge`.
--[no-]notes[=<ref>]::
This flag is passed to the `git log` program
(see linkgit:git-log[1]) that generates the patches.

View File

@@ -57,8 +57,6 @@ KNOWN LIMITATIONS
The ref format migration has several known limitations in its current form:
* It is not possible to migrate repositories that have reflogs.
* It is not possible to migrate repositories that have worktrees.
* There is no way to block concurrent writes to the repository during an

View File

@@ -7,10 +7,10 @@ git-restore - Restore working tree files
SYNOPSIS
--------
[verse]
'git restore' [<options>] [--source=<tree>] [--staged] [--worktree] [--] <pathspec>...
'git restore' [<options>] [--source=<tree>] [--staged] [--worktree] --pathspec-from-file=<file> [--pathspec-file-nul]
'git restore' (-p|--patch) [<options>] [--source=<tree>] [--staged] [--worktree] [--] [<pathspec>...]
[synopsis]
git restore [<options>] [--source=<tree>] [--staged] [--worktree] [--] <pathspec>...
git restore [<options>] [--source=<tree>] [--staged] [--worktree] --pathspec-from-file=<file> [--pathspec-file-nul]
git restore (-p|--patch) [<options>] [--source=<tree>] [--staged] [--worktree] [--] [<pathspec>...]
DESCRIPTION
-----------
@@ -32,8 +32,8 @@ THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
OPTIONS
-------
-s <tree>::
--source=<tree>::
`-s <tree>`::
`--source=<tree>`::
Restore the working tree files with the content from the given
tree. It is common to specify the source tree by naming a
commit, branch or tag associated with it.
@@ -41,79 +41,79 @@ OPTIONS
If not specified, the contents are restored from `HEAD` if `--staged` is
given, otherwise from the index.
+
As a special case, you may use `"A...B"` as a shortcut for the
merge base of `A` and `B` if there is exactly one merge base. You can
leave out at most one of `A` and `B`, in which case it defaults to `HEAD`.
As a special case, you may use `"<rev-A>...<rev-B>"` as a shortcut for the
merge base of _<rev-A>_ and _<rev-B>_ if there is exactly one merge base. You can
leave out at most one of _<rev-A>__ and _<rev-B>_, in which case it defaults to `HEAD`.
-p::
--patch::
`-p`::
`--patch`::
Interactively select hunks in the difference between the
restore source and the restore location. See the ``Interactive
Mode'' section of linkgit:git-add[1] to learn how to operate
restore source and the restore location. See the "Interactive
Mode" section of linkgit:git-add[1] to learn how to operate
the `--patch` mode.
+
Note that `--patch` can accept no pathspec and will prompt to restore
all modified paths.
-W::
--worktree::
-S::
--staged::
`-W`::
`--worktree`::
`-S`::
`--staged`::
Specify the restore location. If neither option is specified,
by default the working tree is restored. Specifying `--staged`
will only restore the index. Specifying both restores both.
-q::
--quiet::
`-q`::
`--quiet`::
Quiet, suppress feedback messages. Implies `--no-progress`.
--progress::
--no-progress::
`--progress`::
`--no-progress`::
Progress status is reported on the standard error stream
by default when it is attached to a terminal, unless `--quiet`
is specified. This flag enables progress reporting even if not
attached to a terminal, regardless of `--quiet`.
--ours::
--theirs::
`--ours`::
`--theirs`::
When restoring files in the working tree from the index, use
stage #2 ('ours') or #3 ('theirs') for unmerged paths.
stage #2 (`ours`) or #3 (`theirs`) for unmerged paths.
This option cannot be used when checking out paths from a
tree-ish (i.e. with the `--source` option).
+
Note that during `git rebase` and `git pull --rebase`, 'ours' and
'theirs' may appear swapped. See the explanation of the same options
Note that during `git rebase` and `git pull --rebase`, `ours` and
`theirs` may appear swapped. See the explanation of the same options
in linkgit:git-checkout[1] for details.
-m::
--merge::
`-m`::
`--merge`::
When restoring files on the working tree from the index,
recreate the conflicted merge in the unmerged paths.
This option cannot be used when checking out paths from a
tree-ish (i.e. with the `--source` option).
--conflict=<style>::
`--conflict=<style>`::
The same as `--merge` option above, but changes the way the
conflicting hunks are presented, overriding the
`merge.conflictStyle` configuration variable. Possible values
are "merge" (default), "diff3", and "zdiff3".
are `merge` (default), `diff3`, and `zdiff3`.
--ignore-unmerged::
`--ignore-unmerged`::
When restoring files on the working tree from the index, do
not abort the operation if there are unmerged entries and
neither `--ours`, `--theirs`, `--merge` or `--conflict` is
specified. Unmerged paths on the working tree are left alone.
--ignore-skip-worktree-bits::
`--ignore-skip-worktree-bits`::
In sparse checkout mode, the default is to only update entries
matched by `<pathspec>` and sparse patterns in
$GIT_DIR/info/sparse-checkout. This option ignores the sparse
matched by _<pathspec>_ and sparse patterns in
`$GIT_DIR/info/sparse-checkout`. This option ignores the sparse
patterns and unconditionally restores any files in
`<pathspec>`.
_<pathspec>_.
--recurse-submodules::
--no-recurse-submodules::
If `<pathspec>` names an active submodule and the restore location
`--recurse-submodules`::
`--no-recurse-submodules`::
If _<pathspec>_ names an active submodule and the restore location
includes the working tree, the submodule will only be updated if
this option is given, in which case its working tree will be
restored to the commit recorded in the superproject, and any local
@@ -122,30 +122,30 @@ in linkgit:git-checkout[1] for details.
not be updated. Just like linkgit:git-checkout[1], this will detach
`HEAD` of the submodule.
--overlay::
--no-overlay::
In overlay mode, the command never removes files when
restoring. In no-overlay mode, tracked files that do not
appear in the `--source` tree are removed, to make them match
`<tree>` exactly. The default is no-overlay mode.
`--overlay`::
`--no-overlay`::
In overlay mode, never remove files when restoring. In no-overlay mode,
remove tracked files that do not appear in the _<tree>_ of
`--source=<tree>`, to make them match _<tree>_ exactly. The default
is no-overlay mode.
--pathspec-from-file=<file>::
Pathspec is passed in `<file>` instead of commandline args. If
`<file>` is exactly `-` then standard input is used. Pathspec
elements are separated by LF or CR/LF. Pathspec elements can be
`--pathspec-from-file=<file>`::
Pathspec is passed in _<file>_ instead of commandline args. If
_<file>_ is exactly `-` then standard input is used. Pathspec
elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]). See also `--pathspec-file-nul` and
global `--literal-pathspecs`.
--pathspec-file-nul::
`--pathspec-file-nul`::
Only meaningful with `--pathspec-from-file`. Pathspec elements are
separated with NUL character and all other characters are taken
separated with _NUL_ character and all other characters are taken
literally (including newlines and quotes).
\--::
`--`::
Do not interpret any more arguments as options.
<pathspec>...::
`<pathspec>...`::
Limits the paths affected by the operation.
+
For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
@@ -154,7 +154,7 @@ EXAMPLES
--------
The following sequence switches to the `master` branch, reverts the
`Makefile` to two revisions back, deletes hello.c by mistake, and gets
`Makefile` to two revisions back, deletes `hello.c` by mistake, and gets
it back from the index.
------------
@@ -165,7 +165,7 @@ $ git restore hello.c <2>
------------
<1> take a file out of another commit
<2> restore hello.c from the index
<2> restore `hello.c` from the index
If you want to restore _all_ C source files to match the version in
the index, you can say

View File

@@ -9,7 +9,7 @@ git-show-index - Show packed archive index
SYNOPSIS
--------
[verse]
'git show-index' [--object-format=<hash-algorithm>]
'git show-index' [--object-format=<hash-algorithm>] < <pack-idx-file>
DESCRIPTION

View File

@@ -93,11 +93,11 @@ update::
ref does not exist before the update.
create::
Create <ref> with <new-oid> after verifying it does not
Create <ref> with <new-oid> after verifying that it does not
exist. The given <new-oid> may not be zero.
delete::
Delete <ref> after verifying it exists with <old-oid>, if
Delete <ref> after verifying that it exists with <old-oid>, if
given. If given, <old-oid> may not be zero.
symref-update::
@@ -110,11 +110,11 @@ verify::
<old-oid> is zero or missing, the ref must not exist.
symref-create:
Create symbolic ref <ref> with <new-target> after verifying
Create symbolic ref <ref> with <new-target> after verifying that
it does not exist.
symref-delete::
Delete <ref> after verifying it exists with <old-target>, if given.
Delete <ref> after verifying that it exists with <old-target>, if given.
symref-verify::
Verify symbolic <ref> against <old-target> but do not change it.

View File

@@ -216,6 +216,14 @@ To remove a locked worktree, specify `--force` twice.
This can also be set up as the default behaviour by using the
`worktree.guessRemote` config option.
--[no-]relative-paths::
Link worktrees using relative paths or absolute paths (default).
Overrides the `worktree.useRelativePaths` config option, see
linkgit:git-config[1].
+
With `repair`, the linking files will be updated if there's an absolute/relative
mismatch, even if the links are correct.
--[no-]track::
When creating a new branch, if `<commit-ish>` is a branch,
mark it as "upstream" from the new branch. This is the

View File

@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
include::cmds-mainporcelain.txt[]
include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
include::cmds-ancillarymanipulators.txt[]
include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
include::cmds-ancillaryinterrogators.txt[]
include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
include::cmds-foreignscminterface.txt[]
include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
include::cmds-plumbingmanipulators.txt[]
include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
include::cmds-plumbinginterrogators.txt[]
include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
include::cmds-synchingrepositories.txt[]
include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
include::cmds-synchelpers.txt[]
include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
include::cmds-purehelpers.txt[]
include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
include::cmds-guide.txt[]
include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
include::cmds-userinterfaces.txt[]
include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
include::cmds-developerinterfaces.txt[]
include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
@@ -477,6 +477,14 @@ their values the same way as Boolean valued configuration variables, e.g.
Here are the variables:
System
~~~~~~
`HOME`::
Specifies the path to the user's home directory. On Windows, if
unset, Git will set a process environment variable equal to:
`$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;
otherwise `$USERPROFILE` if `$USERPROFILE` exists.
The Git Repository
~~~~~~~~~~~~~~~~~~
These environment variables apply to 'all' core Git commands. Nb: it

View File

@@ -1166,7 +1166,7 @@ internal merge and the final merge.
The merge driver can learn the pathname in which the merged result
will be stored via placeholder `%P`. The conflict labels to be used
for the common ancestor, local head and other head can be passed by
using '%S', '%X' and '%Y` respectively.
using `%S`, `%X` and `%Y` respectively.
`conflict-marker-size`
^^^^^^^^^^^^^^^^^^^^^^

View File

@@ -90,6 +90,15 @@ scripting Git:
for long options. An option that takes optional option-argument must be
written in the 'stuck' form.
* Despite the above suggestion, when Arg is a path relative to the
home directory of a user, e.g. `~/directory/file` or `~u/d/f`, you
may want to use the separate form, e.g. `git foo --file ~/mine`,
not `git foo --file=~/mine`. The shell will expand `~/` in the
former to your home directory, but most shells keep the tilde in
the latter. Some of our commands know how to tilde-expand the
option value even when given in the stuck form, but not all of
them do.
* When you give a revision parameter to a command, make sure the parameter is
not ambiguous with a name of a file in the work tree. E.g. do not write
`git log -1 HEAD` but write `git log -1 HEAD --`; the former will not work
@@ -152,6 +161,23 @@ can use `--no-track` to override that behaviour. The same goes for `--color`
and `--no-color`.
Options trump configuration and environment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When there is a configuration variable or an environment variable
that tweak the behaviour of an aspect of a Git command, and also a
command line option that tweaks the same, the command line option
overrides what the configuration and/or environment variable say.
For example, the `user.name` configuration variable is used to
specify the human-readable name used by the `git commit` command to
record the author and the committer name in a newly created commit.
The `GIT_AUTHOR_NAME` environment variable, if set, takes precedence
when deciding what author name to record. The `--author=<author>`
command line option of the `git commit` command, when given, takes
precedence over these two sources of information.
Aggregating short options
~~~~~~~~~~~~~~~~~~~~~~~~~
Commands that support the enhanced option parser allow you to aggregate short

View File

@@ -66,18 +66,7 @@ storage provided by the OS or other programs. Alternatively, a
credential-generating helper might generate credentials for certain servers via
some API.
To use a helper, you must first select one to use. Git currently
includes the following helpers:
cache::
Cache credentials in memory for a short period of time. See
linkgit:git-credential-cache[1] for details.
store::
Store credentials indefinitely on disk. See
linkgit:git-credential-store[1] for details.
To use a helper, you must first select one to use (see below for a list).
You may also have third-party helpers installed; search for
`credential-*` in the output of `git help -a`, and consult the
@@ -106,6 +95,28 @@ $ git config --global credential.helper foo
=== Available helpers
Git currently includes the following helpers:
cache::
Cache credentials in memory for a short period of time. See
linkgit:git-credential-cache[1] for details.
store::
Store credentials indefinitely on disk. See
linkgit:git-credential-store[1] for details.
Popular helpers with secure persistent storage include:
- git-credential-libsecret (Linux)
- git-credential-osxkeychain (macOS)
- git-credential-wincred (Windows)
- https://github.com/git-ecosystem/git-credential-manager[Git Credential Manager] (cross platform, included in Git for Windows)
The community maintains a comprehensive list of Git credential helpers at
https://git-scm.com/doc/credential-helpers.
@@ -116,6 +127,12 @@ OAuth credential helper. Initial authentication opens a browser window to the
host. Subsequent authentication happens in the background. Many popular Git
hosts support OAuth.
Popular helpers with OAuth support include:
- https://github.com/git-ecosystem/git-credential-manager[Git Credential Manager] (cross platform, included in Git for Windows)
- https://github.com/hickford/git-credential-oauth[git-credential-oauth] (cross platform, included in many Linux distributions)
CREDENTIAL CONTEXTS
-------------------
@@ -242,6 +259,12 @@ Here are some example specifications:
[credential]
helper = "foo --bar='whitespace arg'"
# store helper (discouraged) with custom location for the db file;
# use `--file ~/.git-secret.txt`, rather than `--file=~/.git-secret.txt`,
# to allow the shell to expand tilde to the home directory.
[credential]
helper = "store --file ~/.git-secret.txt"
# you can also use an absolute path, which will not use the git wrapper
[credential]
helper = "/path/to/my/helper --with-arguments"

View File

@@ -153,7 +153,7 @@ config.worktree::
linkgit:git-worktree[1]).
branches::
A slightly deprecated way to store shorthands to be used
A deprecated way to store shorthands to be used
to specify a URL to 'git fetch', 'git pull' and 'git push'.
A file can be stored as `branches/<name>` and then
'name' can be given to these commands in place of
@@ -162,7 +162,8 @@ branches::
and not likely to be found in modern repositories. This
directory is ignored if $GIT_COMMON_DIR is set and
"$GIT_COMMON_DIR/branches" will be used instead.
+
Git will stop reading remotes from this directory in Git 3.0.
hooks::
Hooks are customization scripts used by various Git
@@ -238,6 +239,8 @@ remotes::
and not likely to be found in modern repositories. This
directory is ignored if $GIT_COMMON_DIR is set and
"$GIT_COMMON_DIR/remotes" will be used instead.
+
Git will stop reading remotes from this directory in Git 3.0.
logs::
Records of changes made to refs are stored in this directory.

View File

@@ -48,7 +48,7 @@ do
file="$txt"
fi
echo "* link:$file[$title] $from
echo "* link:howto/$(basename "$file")[$title] $from
$abstract
"

View File

@@ -0,0 +1,62 @@
howto_sources = [
'coordinate-embargoed-releases.txt',
'keep-canonical-history-correct.txt',
'maintain-git.txt',
'new-command.txt',
'rebase-from-internal-branch.txt',
'rebuild-from-update-hook.txt',
'recover-corrupted-blob-object.txt',
'recover-corrupted-object-harder.txt',
'revert-a-faulty-merge.txt',
'revert-branch-rebase.txt',
'separating-topic-branches.txt',
'setup-git-server-over-http.txt',
'update-hook-example.txt',
'use-git-daemon.txt',
'using-merge-subtree.txt',
'using-signed-tag-in-pull-request.txt',
]
howto_index = custom_target(
command: [
shell,
meson.current_source_dir() / 'howto-index.sh',
'@INPUT@',
],
env: script_environment,
capture: true,
input: howto_sources,
output: 'howto-index.txt',
)
custom_target(
command: asciidoc_html_options,
input: howto_index,
output: 'howto-index.html',
depends: documentation_deps,
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
foreach howto : howto_sources
howto_stripped = custom_target(
command: [
find_program('sed'),
'-e',
'1,/^$/d',
'@INPUT@',
],
input: howto,
output: fs.stem(howto) + '.stripped',
capture: true,
)
custom_target(
command: asciidoc_html_options,
input: howto_stripped,
output: fs.stem(howto_stripped.full_path()) + '.html',
depends: documentation_deps,
install: true,
install_dir: get_option('datadir') / 'doc/git-doc/howto',
)
endforeach

View File

@@ -34,7 +34,7 @@ project find it more convenient to use legacy encodings, Git
does not forbid it. However, there are a few things to keep in
mind.
. 'git commit' and 'git commit-tree' issue
. `git commit` and `git commit-tree` issue
a warning if the commit log message given to it does not look
like a valid UTF-8 string, unless you explicitly say your
project uses a legacy encoding. The way to say this is to
@@ -50,7 +50,7 @@ of `i18n.commitEncoding` in their `encoding` header. This is to
help other people who look at them later. Lack of this header
implies that the commit log message is encoded in UTF-8.
. 'git log', 'git show', 'git blame' and friends look at the
. `git log`, `git show`, `git blame` and friends look at the
`encoding` header of a commit object, and try to re-code the
log message into UTF-8 unless otherwise specified. You can
specify the desired output encoding with

504
Documentation/meson.build Normal file
View File

@@ -0,0 +1,504 @@
manpages = {
# Category 1.
'git-add.txt' : 1,
'git-am.txt' : 1,
'git-annotate.txt' : 1,
'git-apply.txt' : 1,
'git-archimport.txt' : 1,
'git-archive.txt' : 1,
'git-bisect.txt' : 1,
'git-blame.txt' : 1,
'git-branch.txt' : 1,
'git-bugreport.txt' : 1,
'git-bundle.txt' : 1,
'git-cat-file.txt' : 1,
'git-check-attr.txt' : 1,
'git-check-ignore.txt' : 1,
'git-check-mailmap.txt' : 1,
'git-checkout-index.txt' : 1,
'git-checkout.txt' : 1,
'git-check-ref-format.txt' : 1,
'git-cherry-pick.txt' : 1,
'git-cherry.txt' : 1,
'git-citool.txt' : 1,
'git-clean.txt' : 1,
'git-clone.txt' : 1,
'git-column.txt' : 1,
'git-commit-graph.txt' : 1,
'git-commit-tree.txt' : 1,
'git-commit.txt' : 1,
'git-config.txt' : 1,
'git-count-objects.txt' : 1,
'git-credential-cache--daemon.txt' : 1,
'git-credential-cache.txt' : 1,
'git-credential-store.txt' : 1,
'git-credential.txt' : 1,
'git-cvsexportcommit.txt' : 1,
'git-cvsimport.txt' : 1,
'git-cvsserver.txt' : 1,
'git-daemon.txt' : 1,
'git-describe.txt' : 1,
'git-diagnose.txt' : 1,
'git-diff-files.txt' : 1,
'git-diff-index.txt' : 1,
'git-difftool.txt' : 1,
'git-diff-tree.txt' : 1,
'git-diff.txt' : 1,
'git-fast-export.txt' : 1,
'git-fast-import.txt' : 1,
'git-fetch-pack.txt' : 1,
'git-fetch.txt' : 1,
'git-filter-branch.txt' : 1,
'git-fmt-merge-msg.txt' : 1,
'git-for-each-ref.txt' : 1,
'git-for-each-repo.txt' : 1,
'git-format-patch.txt' : 1,
'git-fsck-objects.txt' : 1,
'git-fsck.txt' : 1,
'git-fsmonitor--daemon.txt' : 1,
'git-gc.txt' : 1,
'git-get-tar-commit-id.txt' : 1,
'git-grep.txt' : 1,
'git-gui.txt' : 1,
'git-hash-object.txt' : 1,
'git-help.txt' : 1,
'git-hook.txt' : 1,
'git-http-backend.txt' : 1,
'git-http-fetch.txt' : 1,
'git-http-push.txt' : 1,
'git-imap-send.txt' : 1,
'git-index-pack.txt' : 1,
'git-init-db.txt' : 1,
'git-init.txt' : 1,
'git-instaweb.txt' : 1,
'git-interpret-trailers.txt' : 1,
'git-log.txt' : 1,
'git-ls-files.txt' : 1,
'git-ls-remote.txt' : 1,
'git-ls-tree.txt' : 1,
'git-mailinfo.txt' : 1,
'git-mailsplit.txt' : 1,
'git-maintenance.txt' : 1,
'git-merge-base.txt' : 1,
'git-merge-file.txt' : 1,
'git-merge-index.txt' : 1,
'git-merge-one-file.txt' : 1,
'git-mergetool--lib.txt' : 1,
'git-mergetool.txt' : 1,
'git-merge-tree.txt' : 1,
'git-merge.txt' : 1,
'git-mktag.txt' : 1,
'git-mktree.txt' : 1,
'git-multi-pack-index.txt' : 1,
'git-mv.txt' : 1,
'git-name-rev.txt' : 1,
'git-notes.txt' : 1,
'git-p4.txt' : 1,
'git-pack-objects.txt' : 1,
'git-pack-redundant.txt' : 1,
'git-pack-refs.txt' : 1,
'git-patch-id.txt' : 1,
'git-prune-packed.txt' : 1,
'git-prune.txt' : 1,
'git-pull.txt' : 1,
'git-push.txt' : 1,
'git-quiltimport.txt' : 1,
'git-range-diff.txt' : 1,
'git-read-tree.txt' : 1,
'git-rebase.txt' : 1,
'git-receive-pack.txt' : 1,
'git-reflog.txt' : 1,
'git-refs.txt' : 1,
'git-remote-ext.txt' : 1,
'git-remote-fd.txt' : 1,
'git-remote.txt' : 1,
'git-repack.txt' : 1,
'git-replace.txt' : 1,
'git-replay.txt' : 1,
'git-request-pull.txt' : 1,
'git-rerere.txt' : 1,
'git-reset.txt' : 1,
'git-restore.txt' : 1,
'git-revert.txt' : 1,
'git-rev-list.txt' : 1,
'git-rev-parse.txt' : 1,
'git-rm.txt' : 1,
'git-send-email.txt' : 1,
'git-send-pack.txt' : 1,
'git-shell.txt' : 1,
'git-sh-i18n--envsubst.txt' : 1,
'git-sh-i18n.txt' : 1,
'git-shortlog.txt' : 1,
'git-show-branch.txt' : 1,
'git-show-index.txt' : 1,
'git-show-ref.txt' : 1,
'git-show.txt' : 1,
'git-sh-setup.txt' : 1,
'git-sparse-checkout.txt' : 1,
'git-stage.txt' : 1,
'git-stash.txt' : 1,
'git-status.txt' : 1,
'git-stripspace.txt' : 1,
'git-submodule.txt' : 1,
'git-svn.txt' : 1,
'git-switch.txt' : 1,
'git-symbolic-ref.txt' : 1,
'git-tag.txt' : 1,
'git-unpack-file.txt' : 1,
'git-unpack-objects.txt' : 1,
'git-update-index.txt' : 1,
'git-update-ref.txt' : 1,
'git-update-server-info.txt' : 1,
'git-upload-archive.txt' : 1,
'git-upload-pack.txt' : 1,
'git-var.txt' : 1,
'git-verify-commit.txt' : 1,
'git-verify-pack.txt' : 1,
'git-verify-tag.txt' : 1,
'git-version.txt' : 1,
'git-web--browse.txt' : 1,
'git-whatchanged.txt' : 1,
'git-worktree.txt' : 1,
'git-write-tree.txt' : 1,
'git.txt' : 1,
'gitk.txt' : 1,
'gitweb.txt' : 1,
'scalar.txt' : 1,
# Category 5.
'gitattributes.txt' : 5,
'gitformat-bundle.txt' : 5,
'gitformat-chunk.txt' : 5,
'gitformat-commit-graph.txt' : 5,
'gitformat-index.txt' : 5,
'gitformat-pack.txt' : 5,
'gitformat-signature.txt' : 5,
'githooks.txt' : 5,
'gitignore.txt' : 5,
'gitmailmap.txt' : 5,
'gitmodules.txt' : 5,
'gitprotocol-capabilities.txt' : 5,
'gitprotocol-common.txt' : 5,
'gitprotocol-http.txt' : 5,
'gitprotocol-pack.txt' : 5,
'gitprotocol-v2.txt' : 5,
'gitrepository-layout.txt' : 5,
'gitweb.conf.txt' : 5,
# Category 7.
'gitcli.txt' : 7,
'gitcore-tutorial.txt' : 7,
'gitcredentials.txt' : 7,
'gitcvs-migration.txt' : 7,
'gitdiffcore.txt' : 7,
'giteveryday.txt' : 7,
'gitfaq.txt' : 7,
'gitglossary.txt' : 7,
'gitpacking.txt' : 7,
'gitnamespaces.txt' : 7,
'gitremote-helpers.txt' : 7,
'gitrevisions.txt' : 7,
'gitsubmodules.txt' : 7,
'gittutorial-2.txt' : 7,
'gittutorial.txt' : 7,
'gitworkflows.txt' : 7,
}
docs_backend = get_option('docs_backend')
if docs_backend == 'auto'
if find_program('asciidoc', required: false).found()
docs_backend = 'asciidoc'
elif find_program('asciidoctor', required: false).found()
docs_backend = 'asciidoctor'
else
error('Neither asciidoc nor asciidoctor were found.')
endif
endif
if docs_backend == 'asciidoc'
asciidoc = find_program('asciidoc', required: true)
asciidoc_html = 'xhtml11'
asciidoc_docbook = 'docbook'
xmlto_extra = [ ]
asciidoc_conf = custom_target(
command: [
shell,
meson.project_source_root() / 'GIT-VERSION-GEN',
meson.project_source_root(),
'@INPUT@',
'@OUTPUT@',
],
input: 'asciidoc.conf.in',
output: 'asciidoc.conf',
depends: [git_version_file],
env: version_gen_environment,
)
asciidoc_common_options = [
asciidoc,
'--conf-file=' + asciidoc_conf.full_path(),
'--attribute=build_dir=' + meson.current_build_dir(),
]
documentation_deps = [
asciidoc_conf,
]
elif docs_backend == 'asciidoctor'
asciidoctor = find_program('asciidoctor', required: true)
asciidoc_html = 'xhtml5'
asciidoc_docbook = 'docbook5'
xmlto_extra = [
'--skip-validation',
'-x', meson.current_source_dir() / 'manpage.xsl',
]
asciidoctor_extensions = custom_target(
command: [
shell,
meson.project_source_root() / 'GIT-VERSION-GEN',
meson.project_source_root(),
'@INPUT@',
'@OUTPUT@',
],
input: 'asciidoctor-extensions.rb.in',
output: 'asciidoctor-extensions.rb',
depends: [git_version_file],
env: version_gen_environment,
)
asciidoc_common_options = [
asciidoctor,
'--attribute', 'compat-mode',
'--attribute', 'tabsize=8',
'--attribute', 'litdd=&#x2d;&#x2d;',
'--attribute', 'docinfo=shared',
'--attribute', 'build_dir=' + meson.current_build_dir(),
'--load-path', meson.current_build_dir(),
'--require', 'asciidoctor-extensions',
]
documentation_deps = [
asciidoctor_extensions,
]
endif
git = find_program('git', required: false)
xmlto = find_program('xmlto')
cmd_lists = [
'cmds-ancillaryinterrogators.txt',
'cmds-ancillarymanipulators.txt',
'cmds-mainporcelain.txt',
'cmds-plumbinginterrogators.txt',
'cmds-plumbingmanipulators.txt',
'cmds-synchingrepositories.txt',
'cmds-synchelpers.txt',
'cmds-guide.txt',
'cmds-developerinterfaces.txt',
'cmds-userinterfaces.txt',
'cmds-purehelpers.txt',
'cmds-foreignscminterface.txt',
]
documentation_deps += custom_target(
command: [
perl,
'@INPUT@',
meson.project_source_root(),
meson.current_build_dir(),
] + cmd_lists,
input: 'cmd-list.perl',
output: cmd_lists
)
foreach mode : [ 'diff', 'merge' ]
documentation_deps += custom_target(
command: [
shell,
'@INPUT@',
'..',
mode,
'@OUTPUT@'
],
env: [
'MERGE_TOOLS_DIR=' + meson.project_source_root() / 'mergetools',
],
input: 'generate-mergetool-list.sh',
output: 'mergetools-' + mode + '.txt',
)
endforeach
foreach manpage, category : manpages
if get_option('docs').contains('man')
manpage_xml_target = custom_target(
command: asciidoc_common_options + [
'--backend=' + asciidoc_docbook,
'--doctype=manpage',
'--out-file=@OUTPUT@',
'@INPUT@',
],
depends: documentation_deps,
input: manpage,
output: fs.stem(manpage) + '.xml',
)
manpage_path = fs.stem(manpage) + '.' + category.to_string()
manpage_target = custom_target(
command: [
xmlto,
'-m', '@INPUT0@',
'-m', '@INPUT1@',
'--stringparam',
'man.base.url.for.relative.links=' + get_option('prefix') / get_option('mandir'),
'man',
manpage_xml_target,
'-o',
meson.current_build_dir(),
] + xmlto_extra,
input: [
'manpage-normal.xsl',
'manpage-bold-literal.xsl',
],
output: manpage_path,
install: true,
install_dir: get_option('mandir') / 'man' + category.to_string(),
)
endif
if get_option('docs').contains('html')
custom_target(
command: asciidoc_common_options + [
'--backend=' + asciidoc_html,
'--doctype=manpage',
'--out-file=@OUTPUT@',
'@INPUT@',
],
depends: documentation_deps,
input: manpage,
output: fs.stem(manpage) + '.html',
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
endif
endforeach
if get_option('docs').contains('html')
configure_file(
input: 'docinfo-html.in',
output: 'docinfo.html',
copy: true,
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
configure_file(
input: 'docbook-xsl.css',
output: 'docbook-xsl.css',
copy: true,
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
install_symlink('index.html',
install_dir: get_option('datadir') / 'doc/git-doc',
pointing_to: 'git.html',
)
xsltproc = find_program('xsltproc')
user_manual_xml = custom_target(
command: asciidoc_common_options + [
'--backend=' + asciidoc_docbook,
'--doctype=book',
'--out-file=@OUTPUT@',
'@INPUT@',
],
input: 'user-manual.txt',
output: 'user-manual.xml',
depends: documentation_deps,
)
custom_target(
command: [
xsltproc,
'--xinclude',
'--stringparam', 'html.stylesheet', 'docbook-xsl.css',
'--param', 'generate.consistent.ids', '1',
'--output', '@OUTPUT@',
'@INPUT@',
user_manual_xml,
],
input: 'docbook.xsl',
output: 'user-manual.html',
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
articles = [
'DecisionMaking.txt',
'MyFirstContribution.txt',
'MyFirstObjectWalk.txt',
'ReviewingGuidelines.txt',
'SubmittingPatches',
'ToolsForGit.txt',
'git-bisect-lk2009.txt',
'git-tools.txt',
]
foreach article : articles
custom_target(
command: asciidoc_common_options + [
'--backend=' + asciidoc_html,
'--out-file=@OUTPUT@',
'@INPUT@',
],
input: article,
output: fs.stem(article) + '.html',
depends: documentation_deps,
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
endforeach
asciidoc_html_options = asciidoc_common_options + [
'--backend=' + asciidoc_html,
'--out-file=@OUTPUT@',
'--attribute', 'git-relative-html-prefix=../',
'@INPUT@',
]
subdir('howto')
subdir('technical')
endif
# Sanity check that we are not missing any tests present in 't/'. This check
# only runs once at configure time and is thus best-effort, only. Furthermore,
# it only verifies man pages for the sake of simplicity.
configured_manpages = manpages.keys() + [ 'git-bisect-lk2009.txt', 'git-tools.txt' ]
actual_manpages = run_command(shell, '-c', 'ls git*.txt scalar.txt',
check: true,
env: script_environment,
).stdout().strip().split('\n')
if configured_manpages != actual_manpages
missing_manpage = [ ]
foreach actual_manpage : actual_manpages
if actual_manpage not in configured_manpages
missing_manpage += actual_manpage
endif
endforeach
if missing_manpage.length() > 0
error('Man page found, but not configured:\n\n - ' + '\n - '.join(missing_manpage))
endif
superfluous_manpage = [ ]
foreach configured_manpage : configured_manpages
if configured_manpage not in actual_manpages
superfluous_manpage += configured_manpage
endif
endforeach
if superfluous_manpage.length() > 0
error('Man page configured, but not found:\n\n - ' + '\n - '.join(superfluous_manpage))
endif
endif

View File

@@ -412,7 +412,8 @@ Default mode::
--ancestry-path[=<commit>]::
When given a range of commits to display (e.g. 'commit1..commit2'
or 'commit2 {caret}commit1'), only display commits in that range
or 'commit2 {caret}commit1'), and a commit <commit> in that range,
only display commits in that range
that are ancestors of <commit>, descendants of <commit>, or
<commit> itself. If no commit is specified, use 'commit1' (the
excluded part of the range) as <commit>. Can be passed multiple

View File

@@ -1,8 +1,8 @@
ifdef::git-commit[]
-s::
`-s`::
endif::git-commit[]
--signoff::
--no-signoff::
`--signoff`::
`--no-signoff`::
Add a `Signed-off-by` trailer by the committer at the end of the commit
log message. The meaning of a signoff depends on the project
to which you're committing. For example, it may certify that
@@ -14,5 +14,5 @@ endif::git-commit[]
leadership of the project to which you're contributing to
understand how the signoffs are used in that project.
+
The --no-signoff option can be used to countermand an earlier --signoff
The `--no-signoff` option can be used to countermand an earlier `--signoff`
option on the command line.

View File

@@ -1,6 +1,17 @@
#!/bin/sh
if test $# -ne 2
then
echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
exit 1
fi
SOURCE_DIR="$1"
OUTPUT="$2"
(
cd "$SOURCE_DIR"
c=////////////////////////////////////////////////////////////////
skel=api-index-skel.txt
sed -e '/^\/\/ table of contents begin/q' "$skel"
@@ -18,11 +29,11 @@
done
echo "$c"
sed -n -e '/^\/\/ table of contents end/,$p' "$skel"
) >api-index.txt+
) >"$OUTPUT"+
if test -f api-index.txt && cmp api-index.txt api-index.txt+ >/dev/null
if test -f "$OUTPUT" && cmp "$OUTPUT" "$OUTPUT"+ >/dev/null
then
rm -f api-index.txt+
rm -f "$OUTPUT"+
else
mv api-index.txt+ api-index.txt
mv "$OUTPUT"+ "$OUTPUT"
fi

View File

@@ -0,0 +1,224 @@
= Build Systems
The build system is the primary way for both developers and system integrators
to interact with the Git project. As such, being easy to use and extend for
those who are not directly developing Git itself is just as important as other
requirements we have on any potential build system.
This document outlines the different requirements that we have for the build
system and then compares available build systems using these criteria.
== Requirements
The following subsections present a list of requirements that we have for any
potential build system. Sections are sorted by decreasing priority.
=== Platform support
The build system must have support for all of our platforms that we continually
test against as outlined by our platform support policy. These platforms are:
- Linux
- Windows
- macOS
Furthermore, the build system should have support for the following platforms
that generally have somebody running test pipelines against regularly:
- AIX
- FreeBSD
- NetBSD
- NonStop
- OpenBSD
The platforms which must be supported by the tool should be aligned with our
[platform support policy](platform-support.txt).
=== Auto-detection of supported features
The build system must support auto-detection of features which are or aren't
available on the current platform. Platform maintainers should not be required
to manually configure the complete build.
Auto-detection of the following items is considered to be important:
- Check for the existence of headers.
- Check for the existence of libraries.
- Check for the existence of exectuables.
- Check for the runtime behavior of specific functions.
- Check for specific link order requirements when multiple libraries are
involved.
=== Ease of use
The build system should be both easy to use and easy to extend. While this is
naturally a subjective metric it is likely not controversial to say that some
build systems are considerably harder to use than others.
=== IDE support
The build system should integrate with well-known IDEs. Well-known IDEs include:
- Microsoft Visual Studio
- Visual Studio Code
- Xcode
There are four levels of support:
- Native integration into the IDE.
- Integration into the IDE via a plugin.
- Integration into the IDE via generating a project description with the build
system.
- No integration.
Native integration is preferable, but integration via either a plugin or by
generating a project description via the build system are considered feasible
alternatives.
Another important distinction is the level of integration. There are two
features that one generally wants to have:
- Integration of build targets.
- Automatic setup of features like code completion with detected build
dependencies.
The first bullet point is the bare minimum, but is not sufficient to be
considered proper integration.
=== Out-of-tree builds
The build system should support out-of-tree builds. Out-of-tree builds allow a
developer to configure multiple different build directories with different
configuration, e.g. one "debug" build and one "release" build.
=== Cross-platform builds
The build system should support cross-platform builds, e.g. building for arm on
an x86-64 host.
=== Language support
The following languages and toolchains are of relevance and should be supported
by the build system:
- C: the primary compiled language used by Git, must be supported. Relevant
toolchains are GCC, Clang and MSVC.
- Rust: candidate as a second compiled lanugage, should be supported. Relevant
toolchains is the LLVM-based rustc.
Built-in support for the respective languages is preferred over support that
needs to be wired up manually to avoid unnecessary complexity. Native support
includes the following features:
- Compiling objects.
- Dependency tracking.
- Detection of available features.
- Discovery of relevant toolchains.
- Linking libraries and executables.
- Templating placeholders in scripts.
=== Test integration
It should be possible to integrate tests into the build system such that it is
possible to build and test Git within the build system. Features which are nice
to have:
- Track build-time dependencies for respective tests. Unit tests have
different requirements than integration tests.
- Allow filtering of which tests to run.
- Allow running tests such that utilities like `test_pause` or `debug` work.
== Comparison
The following list of build systems are considered:
- GNU Make
- autoconf
- CMake
- Meson
=== GNU Make
- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
- Auto-detection: no built-in support for auto-detection of features.
- Ease of use: easy to use, but discovering available options is hard. Makefile
rules can quickly get out of hand once reaching a certain scope.
- IDE support: execution of Makefile targets is supported by many IDEs
- Out-of-tree builds: supported in theory, not wired up in practice.
- Cross-platform builds: supported in theory, not wired up in practice.
- Language support:
- C: Limited built-in support, many parts need to be wired up manually.
- Rust: No built-in support, needs to be wired up manually.
- Test integration: partially supported, many parts need to be wired up
manually.
=== autoconf
- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
- Auto-detection: supported.
- Ease of use: easy to use, discovering available options is comparatively
easy. The autoconf syntax is prohibitively hard to extend though due to its
complex set of interacting files and the hard-to-understand M4 language.
- IDE support: no integration into IDEs at generation time. The generated
Makefiles have the same level of support as GNU Make.
- Out-of-tree builds: supported in theory, not wired up in practice.
- Cross-platform builds: supported.
- Language support:
- C: Limited built-in support, many parts need to be wired up manually.
- Rust: No built-in support, needs to be wired up manually.
- Test integration: partially supported, many parts need to be wired up
manually.
=== CMake
- Platform support: not as extensive as GNU Make or autoconf, but all major
platforms are supported.
- AIX
- Cygwin
- FreeBSD
- Linux
- OpenBSD
- Solaris
- Windows
- macOS
- Ease of use: easy to use, discovering available options is not always
trivial. The scripting language used by CMake is somewhat cumbersome to use,
but extending CMake build instructions is doable.
- IDE support: natively integrated into Microsoft Visual Studio. Can generate
project descriptions for Xcode. An extension is available for Visual Studio
Code. Many other IDEs have plugins for CMake.
- Out-of-tree builds: supported.
- Cross-platform builds: supported.
- Language support:
- C: Supported for GCC, Clang, MSVC and other toolchains.
- Rust: No built-in support, needs to be wired up manually.
- Test integration: supported, even though test dependencies are a bit
cumbersome to use via "test fixtures". Interactive test runs are not
supported.
=== Meson
- Platform: not as extensive as GNU Make or autoconf, but all major platforms
and some smaller ones are supported.
- AIX
- Cygwin
- DragonflyBSD
- FreeBSD
- Haiku
- Linux
- NetBSD
- OpenBSD
- Solaris
- Windows
- macOS
- Ease of use: easy to use, discovering available options is easy. The
scripting language is straight-forward to use.
- IDE support: Supports generating build instructions for Xcode and Microsoft
Visual Studio, a plugin exists for Visual Studio Code.
- Out-of-tree builds: supported.
- Cross-platform builds: supported.
- Language support:
- C: Supported for GCC, Clang, MSVC and other toolchains.
- Rust: Supported for rustc.
- Test integration: supported. Interactive tests are supported starting with
Meson 1.5.0 via the `--interactive` flag.

View File

@@ -0,0 +1,67 @@
api_docs = [
'api-error-handling.txt',
'api-merge.txt',
'api-parse-options.txt',
'api-simple-ipc.txt',
'api-trace2.txt',
]
articles = [
'bitmap-format.txt',
'build-systems.txt',
'bundle-uri.txt',
'commit-graph.txt',
'directory-rename-detection.txt',
'hash-function-transition.txt',
'long-running-process-protocol.txt',
'multi-pack-index.txt',
'packfile-uri.txt',
'pack-heuristics.txt',
'parallel-checkout.txt',
'partial-clone.txt',
'platform-support.txt',
'racy-git.txt',
'reftable.txt',
'remembering-renames.txt',
'repository-version.txt',
'rerere.txt',
'scalar.txt',
'send-pack-pipeline.txt',
'shallow.txt',
'sparse-checkout.txt',
'sparse-index.txt',
'trivial-merge.txt',
'unit-tests.txt',
]
api_index = custom_target(
command: [
shell,
meson.current_source_dir() / 'api-index.sh',
meson.current_source_dir(),
'@OUTPUT@',
],
env: script_environment,
input: api_docs,
output: 'api-index.txt',
)
custom_target(
command: asciidoc_html_options,
input: api_index,
output: 'api-index.html',
depends: documentation_deps,
install: true,
install_dir: get_option('datadir') / 'doc/git-doc/technical',
)
foreach article : api_docs + articles
custom_target(
command: asciidoc_html_options,
input: article,
output: fs.stem(article) + '.html',
depends: documentation_deps,
install: true,
install_dir: get_option('datadir') / 'doc/git-doc/technical',
)
endforeach

View File

@@ -1,11 +0,0 @@
[titles]
underlines="__","==","--","~~","^^"
[attributes]
caret=^
startsb=&#91;
endsb=&#93;
tilde=&#126;
[linkgit-inlinemacro]
<ulink url="{target}.html">{target}{0?({0})}</ulink>

49
GIT-BUILD-OPTIONS.in Normal file
View File

@@ -0,0 +1,49 @@
BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
DIFF=@DIFF@
FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
GITWEBDIR=@GITWEBDIR@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
GIT_PERF_REPO=@GIT_PERF_REPO@
GIT_TEST_CMP=@GIT_TEST_CMP@
GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
GIT_TEST_OPTS=@GIT_TEST_OPTS@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
GIT_TEST_POPATH=@GIT_TEST_POPATH@
GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
LOCALEDIR=@LOCALEDIR@
NO_CURL=@NO_CURL@
NO_EXPAT=@NO_EXPAT@
NO_GETTEXT=@NO_GETTEXT@
NO_GITWEB=@NO_GITWEB@
NO_ICONV=@NO_ICONV@
NO_PERL=@NO_PERL@
NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
NO_PTHREADS=@NO_PTHREADS@
NO_PYTHON=@NO_PYTHON@
NO_REGEX=@NO_REGEX@
NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
PAGER_ENV=@PAGER_ENV@
PERL_LOCALEDIR=@PERL_LOCALEDIR@
PERL_PATH=@PERL_PATH@
PYTHON_PATH=@PYTHON_PATH@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
SANITIZE_LEAK=@SANITIZE_LEAK@
SHELL_PATH=@SHELL_PATH@
TAR=@TAR@
TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
USE_LIBPCRE2=@USE_LIBPCRE2@
WITH_BREAKING_CHANGES=@WITH_BREAKING_CHANGES@
X=@X@

1
GIT-VERSION-FILE.in Normal file
View File

@@ -0,0 +1 @@
GIT_VERSION=@GIT_VERSION@

View File

@@ -1,40 +1,106 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
DEF_VER=v2.48.GIT
LF='
'
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
if test -f version
if test "$#" -lt 2 || test "$#" -gt 3
then
VN=$(cat version) || VN="$DEF_VER"
elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
git update-index -q --refresh
test -z "$(git diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
then
VN=$(echo "$VN" | sed -e 's/-/./g');
else
VN="$DEF_VER"
echo >&2 "USAGE: $0 <SOURCE_DIR> (--format=<STRING>|<INPUT>) [<OUTPUT>]"
exit 1
fi
VN=$(expr "$VN" : v*'\(.*\)')
SOURCE_DIR="$1"
if test -r $GVF
case "$2" in
--format=*)
INPUT="${2#--format=}"
;;
*)
if ! test -f "$2"
then
echo >&2 "Input is not a file: $2"
exit 1
fi
INPUT=$(cat "$2")
;;
esac
OUTPUT="$3"
# Protect us from reading Git version information outside of the Git directory
# in case it is not a repository itself, but embedded in an unrelated
# repository.
GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
export GIT_CEILING_DIRECTORIES
if test -z "$GIT_VERSION"
then
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
else
VC=unset
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
if test -f "$SOURCE_DIR"/version
then
VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
elif {
test -d "$SOURCE_DIR/.git" ||
test -d "${GIT_DIR:-.git}" ||
test -f "$SOURCE_DIR"/.git;
} &&
VN=$(git -C "$SOURCE_DIR" describe --dirty --match="v[0-9]*" 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
esac
then
VN=$(echo "$VN" | sed -e 's/-/./g');
else
VN="$DEF_VER"
fi
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
fi
if test -z "$GIT_BUILT_FROM_COMMIT"
then
GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
fi
if test -z "$GIT_DATE"
then
GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
fi
if test -z "$GIT_USER_AGENT"
then
GIT_USER_AGENT="git/$GIT_VERSION"
fi
# While released Git versions only have three numbers, development builds also
# have a fourth number that corresponds to the number of patches since the last
# release.
read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
EOF
REPLACED=$(printf "%s" "$INPUT" | sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
-e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
-e "s|@GIT_DATE@|$GIT_DATE|"
)
if test -z "$OUTPUT"
then
printf "%s\n" "$REPLACED"
else
printf "%s\n" "$REPLACED" >"$OUTPUT".$$+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT".$$+ "$OUTPUT" >/dev/null
then
mv "$OUTPUT".$$+ "$OUTPUT"
else
rm "$OUTPUT".$$+
fi
fi
test "$VN" = "$VC" || {
echo >&2 "GIT_VERSION = $VN"
echo "GIT_VERSION = $VN" >$GVF
}

283
Makefile
View File

@@ -591,10 +591,6 @@ include shared.mak
#
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
-include GIT-VERSION-FILE
# Set our default configuration.
#
# Among the variables below, these:
@@ -1277,7 +1273,9 @@ BUILTIN_OBJS += builtin/mv.o
BUILTIN_OBJS += builtin/name-rev.o
BUILTIN_OBJS += builtin/notes.o
BUILTIN_OBJS += builtin/pack-objects.o
ifndef WITH_BREAKING_CHANGES
BUILTIN_OBJS += builtin/pack-redundant.o
endif
BUILTIN_OBJS += builtin/pack-refs.o
BUILTIN_OBJS += builtin/patch-id.o
BUILTIN_OBJS += builtin/prune-packed.o
@@ -1343,21 +1341,22 @@ THIRD_PARTY_SOURCES += sha1dc/%
THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/%
THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/clar/%
CLAR_TEST_SUITES += ctype
CLAR_TEST_SUITES += strvec
CLAR_TEST_SUITES += u-ctype
CLAR_TEST_SUITES += u-hash
CLAR_TEST_SUITES += u-mem-pool
CLAR_TEST_SUITES += u-prio-queue
CLAR_TEST_SUITES += u-reftable-tree
CLAR_TEST_SUITES += u-strvec
CLAR_TEST_PROG = $(UNIT_TEST_BIN)/unit-tests$(X)
CLAR_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(CLAR_TEST_SUITES))
CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/clar/clar.o
CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o
UNIT_TEST_PROGRAMS += t-example-decorate
UNIT_TEST_PROGRAMS += t-hash
UNIT_TEST_PROGRAMS += t-hashmap
UNIT_TEST_PROGRAMS += t-mem-pool
UNIT_TEST_PROGRAMS += t-oid-array
UNIT_TEST_PROGRAMS += t-oidmap
UNIT_TEST_PROGRAMS += t-oidtree
UNIT_TEST_PROGRAMS += t-prio-queue
UNIT_TEST_PROGRAMS += t-reftable-basics
UNIT_TEST_PROGRAMS += t-reftable-block
UNIT_TEST_PROGRAMS += t-reftable-merged
@@ -1366,7 +1365,6 @@ UNIT_TEST_PROGRAMS += t-reftable-reader
UNIT_TEST_PROGRAMS += t-reftable-readwrite
UNIT_TEST_PROGRAMS += t-reftable-record
UNIT_TEST_PROGRAMS += t-reftable-stack
UNIT_TEST_PROGRAMS += t-reftable-tree
UNIT_TEST_PROGRAMS += t-strbuf
UNIT_TEST_PROGRAMS += t-strcmp-offset
UNIT_TEST_PROGRAMS += t-trailer
@@ -1464,6 +1462,18 @@ ifdef DEVELOPER
include config.mak.dev
endif
GIT-VERSION-FILE: FORCE
@OLD=$$(cat $@ 2>/dev/null || :) && \
$(call version_gen,"$(shell pwd)",GIT-VERSION-FILE.in,$@) && \
NEW=$$(cat $@ 2>/dev/null || :) && \
if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
# We need to set GIT_VERSION_OVERRIDE before including the version file as
# otherwise any user-provided value for GIT_VERSION would have been overridden
# already.
GIT_VERSION_OVERRIDE := $(GIT_VERSION)
-include GIT-VERSION-FILE
# what 'all' will build and 'install' will install in gitexecdir,
# excluding programs for built-in commands
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
@@ -1489,7 +1499,6 @@ ifneq ($(filter undefined,$(SANITIZERS)),)
BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
endif
ifneq ($(filter leak,$(SANITIZERS)),)
BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
BASIC_CFLAGS += -O0
SANITIZE_LEAK = YesCompiledWithIt
endif
@@ -1557,10 +1566,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2229,6 +2238,10 @@ ifdef FSMONITOR_OS_SETTINGS
COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
endif
ifdef WITH_BREAKING_CHANGES
BASIC_CFLAGS += -DWITH_BREAKING_CHANGES
endif
ifeq ($(TCLTK_PATH),)
NO_TCLTK = NoThanks
endif
@@ -2424,9 +2437,12 @@ endif
FUZZ_OBJS += oss-fuzz/dummy-cmd-main.o
FUZZ_OBJS += oss-fuzz/fuzz-commit-graph.o
FUZZ_OBJS += oss-fuzz/fuzz-config.o
FUZZ_OBJS += oss-fuzz/fuzz-credential-from-url-gently.o
FUZZ_OBJS += oss-fuzz/fuzz-date.o
FUZZ_OBJS += oss-fuzz/fuzz-pack-headers.o
FUZZ_OBJS += oss-fuzz/fuzz-pack-idx.o
FUZZ_OBJS += oss-fuzz/fuzz-parse-attr-line.o
FUZZ_OBJS += oss-fuzz/fuzz-url-decode-mem.o
.PHONY: fuzz-objs
fuzz-objs: $(FUZZ_OBJS)
@@ -2507,13 +2523,10 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
version.sp version.s version.o: EXTRA_CPPFLAGS = \
'-DGIT_VERSION="$(GIT_VERSION)"' \
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
'-DGIT_BUILT_FROM_COMMIT="$(shell \
GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
git rev-parse -q --verify HEAD 2>/dev/null)"'
version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
$(QUIET_GEN)$(call version_gen,"$(shell pwd)",$<,$@)
version.sp version.s version.o: version-def.h
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -2524,17 +2537,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
$(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
$(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
command-list.txt >$@
. $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
$(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
$(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
@@ -2547,33 +2560,15 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@@DIFF@@|$(DIFF_SQ)|' \
-e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
-e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
chmod +x $@+ && \
$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
$(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
mv $@+ $@
git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
$(QUIET_GEN)$(call version_gen,"$(shell pwd)",$<,$@)
git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
$(QUIET_RC)$(RC) \
$(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
$(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
-DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
git.res: git.rc GIT-PREFIX
$(QUIET_RC)$(RC) -i $< -o $@
# This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
@@ -2606,16 +2601,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
$(QUIET_GEN) \
sed -e '1{' \
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
$(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
@@ -2631,11 +2618,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
-e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
-e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
-e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
-e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
sed -e 's=@PATHSEP@=$(pathsep)=g' \
-e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
-e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
-e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
-e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2643,15 +2630,15 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
$(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
-e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2661,24 +2648,20 @@ endif # NO_PERL
$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
ifndef NO_PYTHON
$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
$(SCRIPT_PYTHON_GEN): generate-python.sh
$(SCRIPT_PYTHON_GEN): % : %.py
$(QUIET_GEN) \
sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
$(QUIET_GEN)$(SHELL_PATH) generate-python.sh ./GIT-BUILD-OPTIONS "$<" "$@"
else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
-e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -2724,6 +2707,7 @@ REFTABLE_OBJS += reftable/pq.o
REFTABLE_OBJS += reftable/reader.o
REFTABLE_OBJS += reftable/record.o
REFTABLE_OBJS += reftable/stack.o
REFTABLE_OBJS += reftable/system.o
REFTABLE_OBJS += reftable/tree.o
REFTABLE_OBJS += reftable/writer.o
@@ -3103,13 +3087,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
-e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
-e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
$(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3162,80 +3142,68 @@ GIT-LDFLAGS: FORCE
echo "$$FLAGS" >GIT-LDFLAGS; \
fi
ifdef RUNTIME_PREFIX
RUNTIME_PREFIX_OPTION = true
else
RUNTIME_PREFIX_OPTION = false
endif
# We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
@echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
@echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
@echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
@echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
@echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
@echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
@echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
@echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
@echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
@echo X=\'$(X)\' >>$@+
ifdef FSMONITOR_DAEMON_BACKEND
@echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
endif
ifdef FSMONITOR_OS_SETTINGS
@echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
endif
ifdef TEST_OUTPUT_DIRECTORY
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
endif
ifdef GIT_TEST_OPTS
@echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
endif
ifdef GIT_TEST_CMP
@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
endif
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
endif
ifdef GIT_TEST_UTF8_LOCALE
@echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
endif
@echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
ifdef GIT_PERF_REPEAT_COUNT
@echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
endif
ifdef GIT_PERF_REPO
@echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
endif
ifdef GIT_PERF_LARGE_REPO
@echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
endif
ifdef GIT_PERF_MAKE_OPTS
@echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
endif
ifdef GIT_PERF_MAKE_COMMAND
@echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
endif
ifdef GIT_INTEROP_MAKE_OPTS
@echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
endif
ifdef GIT_TEST_INDEX_VERSION
@echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
endif
ifdef GIT_TEST_PERL_FATAL_WARNINGS
@echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
endif
ifdef RUNTIME_PREFIX
@echo RUNTIME_PREFIX=\'true\' >>$@+
else
@echo RUNTIME_PREFIX=\'false\' >>$@+
endif
@sed \
-e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
-e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
-e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
-e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
-e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
-e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
-e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
-e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
-e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
-e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
-e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
-e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
-e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
-e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
-e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
-e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
-e "s|@NO_GITWEB@|\'$(NO_GITWEB)\'|" \
-e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
-e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
-e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
-e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
-e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
-e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
-e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
-e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
-e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
-e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
-e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
-e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
-e "s|@WITH_BREAKING_CHANGES@|\'$(WITH_BREAKING_CHANGES)\'|" \
-e "s|@X@|\'$(X)\'|" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
@@ -3255,11 +3223,14 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
-e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
-e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
-e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(shell pwd)/$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
@@ -3743,7 +3714,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) -r .build $(UNIT_TEST_BIN)
$(RM) GIT-TEST-SUITES
$(RM) po/git.pot po/git-core.pot
$(RM) git.res
$(RM) git.rc git.res
$(RM) $(OBJECTS)
$(RM) headless-git.o
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
@@ -3752,7 +3723,9 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
$(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
$(RM) version-def.h
$(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
$(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir

View File

@@ -1 +1 @@
Documentation/RelNotes/2.48.0.txt
Documentation/RelNotes/2.49.0.txt

View File

@@ -1,4 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "add-interactive.h"
@@ -71,14 +71,14 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
FREE_AND_NULL(s->interactive_diff_filter);
git_config_get_string("interactive.difffilter",
&s->interactive_diff_filter);
repo_config_get_string(r, "interactive.difffilter",
&s->interactive_diff_filter);
FREE_AND_NULL(s->interactive_diff_algorithm);
git_config_get_string("diff.algorithm",
&s->interactive_diff_algorithm);
repo_config_get_string(r, "diff.algorithm",
&s->interactive_diff_algorithm);
git_config_get_bool("interactive.singlekey", &s->use_single_key);
repo_config_get_bool(r, "interactive.singlekey", &s->use_single_key);
if (s->use_single_key)
setbuf(stdin, NULL);
}
@@ -534,7 +534,7 @@ static int get_modified_files(struct repository *r,
size_t *binary_count)
{
struct object_id head_oid;
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(r),
"HEAD", RESOLVE_REF_READING,
&head_oid, NULL);
struct collection_status s = { 0 };
@@ -559,7 +559,7 @@ static int get_modified_files(struct repository *r,
s.skip_unseen = filter && i;
opt.def = is_initial ?
empty_tree_oid_hex(the_repository->hash_algo) : oid_to_hex(&head_oid);
empty_tree_oid_hex(r->hash_algo) : oid_to_hex(&head_oid);
repo_init_revisions(r, &rev, NULL);
setup_revisions(0, NULL, &rev, &opt);
@@ -764,7 +764,7 @@ static int run_revert(struct add_i_state *s, const struct pathspec *ps,
size_t count, i, j;
struct object_id oid;
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r),
"HEAD", RESOLVE_REF_READING,
&oid,
NULL);
@@ -995,7 +995,7 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
ssize_t count, i;
struct object_id oid;
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r),
"HEAD", RESOLVE_REF_READING,
&oid,
NULL);

View File

@@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "add-interactive.h"
@@ -1463,7 +1464,7 @@ static int patch_update_file(struct add_p_state *s,
if (file_diff->hunk_nr) {
if (rendered_hunk_index != hunk_index) {
if (use_pager) {
setup_pager();
setup_pager(the_repository);
sigchain_push(SIGPIPE, SIG_IGN);
}
render_hunk(s, hunk, 0, colored, &s->buf);

View File

@@ -53,6 +53,7 @@ static struct {
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge" },
[ADVICE_DETACHED_HEAD] = { "detachedHead" },
[ADVICE_DIVERGING] = { "diverging" },
[ADVICE_FETCH_SET_HEAD_WARN] = { "fetchRemoteHEADWarn" },
[ADVICE_FETCH_SHOW_FORCED_UPDATES] = { "fetchShowForcedUpdates" },
[ADVICE_FORCE_DELETE_BRANCH] = { "forceDeleteBranch" },
[ADVICE_GRAFT_FILE_DEPRECATED] = { "graftFileDeprecated" },
@@ -93,7 +94,7 @@ static struct {
static const char turn_off_instructions[] =
N_("\n"
"Disable this message with \"git config advice.%s false\"");
"Disable this message with \"git config set advice.%s false\"");
static void vadvise(const char *advice, int display_instructions,
const char *key, va_list params)
@@ -160,7 +161,6 @@ void advise_if_enabled(enum advice_type type, const char *advice, ...)
int git_default_advice_config(const char *var, const char *value)
{
const char *k, *slot_name;
int i;
if (!strcmp(var, "color.advice")) {
advice_use_color = git_config_colorbool(var, value);
@@ -179,7 +179,7 @@ int git_default_advice_config(const char *var, const char *value)
if (!skip_prefix(var, "advice.", &k))
return 0;
for (i = 0; i < ARRAY_SIZE(advice_setting); i++) {
for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++) {
if (strcasecmp(k, advice_setting[i].key))
continue;
advice_setting[i].level = git_config_bool(var, value)
@@ -193,9 +193,7 @@ int git_default_advice_config(const char *var, const char *value)
void list_config_advices(struct string_list *list, const char *prefix)
{
int i;
for (i = 0; i < ARRAY_SIZE(advice_setting); i++)
for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++)
list_config_item(list, prefix, advice_setting[i].key);
}

View File

@@ -20,6 +20,7 @@ enum advice_type {
ADVICE_COMMIT_BEFORE_MERGE,
ADVICE_DETACHED_HEAD,
ADVICE_DIVERGING,
ADVICE_FETCH_SET_HEAD_WARN,
ADVICE_FETCH_SHOW_FORCED_UPDATES,
ADVICE_FORCE_DELETE_BRANCH,
ADVICE_GRAFT_FILE_DEPRECATED,

View File

@@ -8,6 +8,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "abspath.h"

View File

@@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "abspath.h"

41
attr.c
View File

@@ -7,6 +7,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"
@@ -259,42 +260,6 @@ const struct git_attr *git_attr(const char *name)
return git_attr_internal(name, strlen(name));
}
/* What does a matched pattern decide? */
struct attr_state {
const struct git_attr *attr;
const char *setto;
};
struct pattern {
const char *pattern;
int patternlen;
int nowildcardlen;
unsigned flags; /* PATTERN_FLAG_* */
};
/*
* One rule, as from a .gitattributes file.
*
* If is_macro is true, then u.attr is a pointer to the git_attr being
* defined.
*
* If is_macro is false, then u.pat is the filename pattern to which the
* rule applies.
*
* In either case, num_attr is the number of attributes affected by
* this rule, and state is an array listing them. The attributes are
* listed as they appear in the file (macros unexpanded).
*/
struct match_attr {
union {
struct pattern pat;
const struct git_attr *attr;
} u;
char is_macro;
size_t num_attr;
struct attr_state state[FLEX_ARRAY];
};
static const char blank[] = " \t\r\n";
/* Flags usable in read_attr() and parse_attr_line() family of functions. */
@@ -353,8 +318,8 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
return ep + strspn(ep, blank);
}
static struct match_attr *parse_attr_line(const char *line, const char *src,
int lineno, unsigned flags)
struct match_attr *parse_attr_line(const char *line, const char *src,
int lineno, unsigned flags)
{
size_t namelen, num_attr, i;
const char *cp, *name, *states;

43
attr.h
View File

@@ -240,4 +240,47 @@ int git_attr_system_is_enabled(void);
extern char *git_attr_tree;
/*
* Exposed for fuzz-testing only.
*/
/* What does a matched pattern decide? */
struct attr_state {
const struct git_attr *attr;
const char *setto;
};
struct pattern {
const char *pattern;
int patternlen;
int nowildcardlen;
unsigned flags; /* PATTERN_FLAG_* */
};
/*
* One rule, as from a .gitattributes file.
*
* If is_macro is true, then u.attr is a pointer to the git_attr being
* defined.
*
* If is_macro is false, then u.pat is the filename pattern to which the
* rule applies.
*
* In either case, num_attr is the number of attributes affected by
* this rule, and state is an array listing them. The attributes are
* listed as they appear in the file (macros unexpanded).
*/
struct match_attr {
union {
struct pattern pat;
const struct git_attr *attr;
} u;
char is_macro;
size_t num_attr;
struct attr_state state[FLEX_ARRAY];
};
struct match_attr *parse_attr_line(const char *line, const char *src,
int lineno, unsigned flags);
#endif /* ATTR_H */

View File

@@ -29,10 +29,9 @@ static const char en85[] = {
static char de85[256];
static void prep_base85(void)
{
int i;
if (de85['Z'])
return;
for (i = 0; i < ARRAY_SIZE(en85); i++) {
for (size_t i = 0; i < ARRAY_SIZE(en85); i++) {
int ch = en85[i];
de85[ch] = i + 1;
}

9
bin-wrappers/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
/git
/git-cvsserver
/git-receive-pack
/git-shell
/git-upload-archive
/git-upload-pack
/scalar
/test-fake-ssh
/test-tool

28
bin-wrappers/meson.build Normal file
View File

@@ -0,0 +1,28 @@
bin_wrappers_config = configuration_data()
foreach key, value : {
'BUILD_DIR': meson.project_build_root(),
'MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
'TEMPLATE_DIR': meson.project_build_root() / 'templates',
'GIT_TEXTDOMAINDIR': meson.project_build_root() / 'po',
'GITPERLLIB': meson.project_build_root() / 'perl/lib',
}
# Paths need to be Unix-style without drive prefixes as they get added to the
# PATH variable. And given that drive prefixes contain a colon we'd otherwise
# end up with a broken PATH if we didn't convert them.
if cygpath.found()
value = run_command(cygpath, value, check: true).stdout().strip()
endif
bin_wrappers_config.set(key, value)
endforeach
foreach executable : bin_wrappers
executable_config = configuration_data()
executable_config.merge_from(bin_wrappers_config)
executable_config.set('PROG', executable.full_path())
configure_file(
input: 'wrap-for-bin.sh',
output: fs.stem(executable.full_path()),
configuration: executable_config,
)
endforeach

37
bin-wrappers/wrap-for-bin.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
# wrap-for-bin.sh: Template for git executable wrapper scripts
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
exec "@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
exec gdb --args "@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
exec ${GIT_DEBUGGER_ARGS} "@PROG@" "$@"
;;
esac

View File

@@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"
@@ -779,10 +780,10 @@ static struct commit *get_commit_reference(struct repository *r,
}
static struct commit **get_bad_and_good_commits(struct repository *r,
int *rev_nr)
size_t *rev_nr)
{
struct commit **rev;
int i, n = 0;
size_t i, n = 0;
ALLOC_ARRAY(rev, 1 + good_revs.nr);
rev[n++] = get_commit_reference(r, current_bad_oid);
@@ -854,7 +855,7 @@ static void handle_skipped_merge_base(const struct object_id *mb)
* for early success, this will be converted back to 0 in
* check_good_are_ancestors_of_bad().
*/
static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int no_checkout)
static enum bisect_error check_merge_bases(size_t rev_nr, struct commit **rev, int no_checkout)
{
enum bisect_error res = BISECT_OK;
struct commit_list *result = NULL;
@@ -886,7 +887,7 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
return res;
}
static int check_ancestors(struct repository *r, int rev_nr,
static int check_ancestors(struct repository *r, size_t rev_nr,
struct commit **rev, const char *prefix)
{
struct strvec rev_argv = STRVEC_INIT;
@@ -921,7 +922,8 @@ static enum bisect_error check_good_are_ancestors_of_bad(struct repository *r,
{
char *filename;
struct stat st;
int fd, rev_nr;
int fd;
size_t rev_nr;
enum bisect_error res = BISECT_OK;
struct commit **rev;

View File

@@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "refs.h"

View File

@@ -1,3 +1,5 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "bloom.h"
#include "diff.h"

View File

@@ -372,7 +372,7 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)
*/
int validate_branchname(const char *name, struct strbuf *ref)
{
if (strbuf_check_branch_ref(ref, name)) {
if (check_branch_ref(ref, name)) {
int code = die_message(_("'%s' is not a valid branch name"), name);
advise_if_enabled(ADVICE_REF_SYNTAX,
_("See `man git check-ref-format`"));

View File

@@ -3,6 +3,7 @@
*
* Copyright (C) 2006 Linus Torvalds
*/
#include "builtin.h"
#include "advice.h"
#include "config.h"
@@ -39,9 +40,9 @@ static int chmod_pathspec(struct repository *repo,
char flip,
int show_only)
{
int i, ret = 0;
int ret = 0;
for (i = 0; i < repo->index->cache_nr; i++) {
for (size_t i = 0; i < repo->index->cache_nr; i++) {
struct cache_entry *ce = repo->index->cache[i];
int err;
@@ -69,9 +70,9 @@ static int renormalize_tracked_files(struct repository *repo,
const struct pathspec *pathspec,
int flags)
{
int i, retval = 0;
int retval = 0;
for (i = 0; i < repo->index->cache_nr; i++) {
for (size_t i = 0; i < repo->index->cache_nr; i++) {
struct cache_entry *ce = repo->index->cache[i];
if (!include_sparse &&

View File

@@ -5,6 +5,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "advice.h"
@@ -1210,7 +1211,7 @@ static int parse_mail(struct am_state *state, const char *mail)
int ret = 0;
struct mailinfo mi;
setup_mailinfo(&mi);
setup_mailinfo(the_repository, &mi);
if (state->utf8)
mi.metainfo_charset = get_commit_output_encoding();
@@ -1785,7 +1786,7 @@ static int do_interactive(struct am_state *state)
}
strbuf_release(&msg);
} else if (*reply == 'v' || *reply == 'V') {
const char *pager = git_pager(1);
const char *pager = git_pager(the_repository, 1);
struct child_process cp = CHILD_PROCESS_INIT;
if (!pager)
@@ -2245,7 +2246,7 @@ static int show_patch(struct am_state *state, enum resume_type resume_mode)
if (len < 0)
die_errno(_("failed to read '%s'"), patch_path);
setup_pager();
setup_pager(the_repository);
write_in_full(1, sb.buf, sb.len);
strbuf_release(&sb);
return 0;
@@ -2426,8 +2427,7 @@ int cmd_am(int argc,
OPT_END()
};
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(usage, options);
show_usage_with_options_if_asked(argc, argv, usage, options);
git_config(git_default_config, NULL);

View File

@@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "copy.h"
#include "environment.h"

View File

@@ -4,7 +4,9 @@
* Copyright (c) 2006, 2014 by its authors
* See COPYING for licensing conditions
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "color.h"
@@ -465,9 +467,14 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
reset = GIT_COLOR_RESET;
}
if (abbrev < MINIMUM_ABBREV)
BUG("abbreviation is smaller than minimum length: %d < %d",
abbrev, MINIMUM_ABBREV);
for (cnt = 0; cnt < ent->num_lines; cnt++) {
char ch;
int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? the_hash_algo->hexsz : abbrev;
size_t length = (opt & OUTPUT_LONG_OBJECT_NAME) ?
the_hash_algo->hexsz : (size_t) abbrev;
if (opt & OUTPUT_COLOR_LINE) {
if (cnt > 0) {
@@ -482,9 +489,9 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
fputs(color, stdout);
if (suspect->commit->object.flags & UNINTERESTING) {
if (blank_boundary)
memset(hex, ' ', length);
else if (!(opt & OUTPUT_ANNOTATE_COMPAT)) {
if (blank_boundary) {
memset(hex, ' ', strlen(hex));
} else if (!(opt & OUTPUT_ANNOTATE_COMPAT)) {
length--;
putchar('^');
}
@@ -498,7 +505,8 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
length--;
putchar('?');
}
printf("%.*s", length, hex);
printf("%.*s", (int)(length < GIT_MAX_HEXSZ ? length : GIT_MAX_HEXSZ), hex);
if (opt & OUTPUT_ANNOTATE_COMPAT) {
const char *name;
if (opt & OUTPUT_SHOW_EMAIL)
@@ -1186,14 +1194,16 @@ parse_done:
sb.found_guilty_entry = &found_guilty_entry;
sb.found_guilty_entry_data = &pi;
if (show_progress)
pi.progress = start_delayed_progress(_("Blaming lines"), num_lines);
pi.progress = start_delayed_progress(the_repository,
_("Blaming lines"),
num_lines);
assign_blame(&sb, opt);
stop_progress(&pi.progress);
if (!incremental)
setup_pager();
setup_pager(the_repository);
else
goto cleanup;

View File

@@ -4,7 +4,9 @@
* Copyright (c) 2006 Kristian Høgsberg <krh@redhat.com>
* Based on git-branch.sh by Junio C Hamano.
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "color.h"
@@ -257,7 +259,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
char *target = NULL;
int flags = 0;
strbuf_branchname(&bname, argv[i], allowed_interpret);
copy_branchname(&bname, argv[i], allowed_interpret);
free(name);
name = mkpathdup(fmt, bname.buf);
@@ -471,7 +473,7 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
if (verify_ref_format(format))
die(_("unable to parse format string"));
filter_ahead_behind(the_repository, format, &array);
filter_ahead_behind(the_repository, &array);
ref_array_sort(sorting, &array);
if (column_active(colopts)) {
@@ -579,7 +581,7 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
int recovery = 0, oldref_usage = 0;
struct worktree **worktrees = get_worktrees();
if (strbuf_check_branch_ref(&oldref, oldname)) {
if (check_branch_ref(&oldref, oldname)) {
/*
* Bad name --- this could be an attempt to rename a
* ref that we used to allow to be created by accident.
@@ -782,8 +784,8 @@ int cmd_branch(int argc,
filter.kind = FILTER_REFS_BRANCHES;
filter.abbrev = -1;
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(builtin_branch_usage, options);
show_usage_with_options_if_asked(argc, argv,
builtin_branch_usage, options);
/*
* Try to set sort keys from config. If config does not set any,
@@ -882,7 +884,6 @@ int cmd_branch(int argc,
string_list_clear(&output, 0);
ref_sorting_release(sorting);
ref_filter_clear(&filter);
ref_format_clear(&format);
ret = 0;
goto out;
@@ -896,7 +897,7 @@ int cmd_branch(int argc,
die(_("cannot give description to detached HEAD"));
branch_name = head;
} else if (argc == 1) {
strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
copy_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
branch_name = buf.buf;
} else {
die(_("cannot edit description of more than one branch"));
@@ -939,7 +940,7 @@ int cmd_branch(int argc,
if (!argc)
branch = branch_get(NULL);
else if (argc == 1) {
strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
copy_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
branch = branch_get(buf.buf);
} else
die(_("too many arguments to set new upstream"));
@@ -969,7 +970,7 @@ int cmd_branch(int argc,
if (!argc)
branch = branch_get(NULL);
else if (argc == 1) {
strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
copy_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
branch = branch_get(buf.buf);
} else
die(_("too many arguments to unset upstream"));

View File

@@ -167,7 +167,7 @@ int cmd_bugreport(int argc,
strbuf_addftime(&zip_path, option_suffix, localtime_r(&now, &tm), 0, 0);
strbuf_addstr(&zip_path, ".zip");
if (create_diagnostics_archive(&zip_path, diagnose))
if (create_diagnostics_archive(the_repository, &zip_path, diagnose))
die_errno(_("unable to create diagnostics archive %s"), zip_path.buf);
strbuf_release(&zip_path);

View File

@@ -222,7 +222,7 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix,
strvec_pushl(&extra_index_pack_args, "-v", "--progress-title",
_("Unbundling objects"), NULL);
ret = !!unbundle(the_repository, &header, bundle_fd,
&extra_index_pack_args, 0) ||
&extra_index_pack_args, NULL) ||
list_bundle_refs(&header, argc, argv);
bundle_header_release(&header);

View File

@@ -3,7 +3,10 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "convert.h"
@@ -827,15 +830,16 @@ static int batch_objects(struct batch_options *opt)
cb.seen = &seen;
for_each_loose_object(batch_unordered_loose, &cb, 0);
for_each_packed_object(batch_unordered_packed, &cb,
FOR_EACH_OBJECT_PACK_ORDER);
for_each_packed_object(the_repository, batch_unordered_packed,
&cb, FOR_EACH_OBJECT_PACK_ORDER);
oidset_clear(&seen);
} else {
struct oid_array sa = OID_ARRAY_INIT;
for_each_loose_object(collect_loose_object, &sa, 0);
for_each_packed_object(collect_packed_object, &sa, 0);
for_each_packed_object(the_repository, collect_packed_object,
&sa, 0);
oid_array_for_each_unique(&sa, batch_object_cb, &cb);

View File

@@ -42,7 +42,7 @@ static int check_ref_format_branch(const char *arg)
int nongit;
setup_git_directory_gently(&nongit);
if (strbuf_check_branch_ref(&sb, arg) ||
if (check_branch_ref(&sb, arg) ||
!skip_prefix(sb.buf, "refs/heads/", &name))
die("'%s' is not a valid branch name", arg);
printf("%s\n", name);
@@ -64,8 +64,8 @@ int cmd_check_ref_format(int argc,
BUG_ON_NON_EMPTY_PREFIX(prefix);
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(builtin_check_ref_format_usage);
show_usage_if_asked(argc, argv,
builtin_check_ref_format_usage);
if (argc == 3 && !strcmp(argv[1], "--branch"))
return check_ref_format_branch(argv[2]);

View File

@@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "entry.h"
@@ -126,9 +128,9 @@ int cmd_checkout__worker(int argc,
OPT_END()
};
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(checkout_worker_usage,
checkout_worker_options);
show_usage_with_options_if_asked(argc, argv,
checkout_worker_usage,
checkout_worker_options);
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, checkout_worker_options,

View File

@@ -4,7 +4,10 @@
* Copyright (C) 2005 Linus Torvalds
*
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@@ -247,9 +250,9 @@ int cmd_checkout_index(int argc,
OPT_END()
};
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(builtin_checkout_index_usage,
builtin_checkout_index_options);
show_usage_with_options_if_asked(argc, argv,
builtin_checkout_index_usage,
builtin_checkout_index_options);
git_config(git_default_config, NULL);
prefix_length = prefix ? strlen(prefix) : 0;

View File

@@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
#include "branch.h"
@@ -742,7 +744,7 @@ static void setup_branch_path(struct branch_info *branch)
&branch->oid, &branch->refname, 0))
repo_get_oid_committish(the_repository, branch->name, &branch->oid);
strbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);
copy_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);
if (strcmp(buf.buf, branch->name)) {
free(branch->name);
branch->name = xstrdup(buf.buf);

View File

@@ -5,7 +5,10 @@
*
* Based on git-clean.sh by Pavel Roskin
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
#include "config.h"

View File

@@ -7,7 +7,10 @@
*
* Clone a repository into a different directory that does not yet exist.
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"

View File

@@ -305,6 +305,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
oidset_init(&commits, 0);
if (opts.progress)
progress = start_delayed_progress(
the_repository,
_("Collecting commits from input"), 0);
while (strbuf_getline(&buf, stdin) != EOF) {

View File

@@ -119,8 +119,8 @@ int cmd_commit_tree(int argc,
git_config(git_default_config, NULL);
if (argc < 2 || !strcmp(argv[1], "-h"))
usage_with_options(commit_tree_usage, options);
show_usage_with_options_if_asked(argc, argv,
commit_tree_usage, options);
argc = parse_options(argc, argv, prefix, options, commit_tree_usage, 0);

View File

@@ -4,7 +4,10 @@
* Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com>
* Based on git-commit.sh by Junio C Hamano and Linus Torvalds
*/
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
#include "config.h"
@@ -41,7 +44,7 @@
#include "trailer.h"
static const char * const builtin_commit_usage[] = {
N_("git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
N_("git commit [-a | --interactive | --patch] [-s] [-v] [-u[<mode>]] [--amend]\n"
" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>]\n"
" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
@@ -1556,8 +1559,8 @@ struct repository *repo UNUSED)
OPT_END(),
};
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(builtin_status_usage, builtin_status_options);
show_usage_with_options_if_asked(argc, argv,
builtin_status_usage, builtin_status_options);
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
@@ -1733,8 +1736,8 @@ int cmd_commit(int argc,
struct strbuf err = STRBUF_INIT;
int ret = 0;
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(builtin_commit_usage, builtin_commit_options);
show_usage_with_options_if_asked(argc, argv,
builtin_commit_usage, builtin_commit_options);
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;

View File

@@ -67,7 +67,7 @@ static int count_loose(const struct object_id *oid, const char *path,
else {
loose_size += on_disk_bytes(st);
loose++;
if (verbose && has_object_pack(oid))
if (verbose && has_object_pack(the_repository, oid))
packed_loose++;
}
return 0;

View File

@@ -142,9 +142,9 @@ static void serve_one_client(FILE *in, FILE *out)
fprintf(out, "username=%s\n", e->item.username);
if (e->item.password)
fprintf(out, "password=%s\n", e->item.password);
if (credential_has_capability(&c.capa_authtype, CREDENTIAL_OP_HELPER) && e->item.authtype)
if (credential_has_capability(&c.capa_authtype, CREDENTIAL_OP_RESPONSE) && e->item.authtype)
fprintf(out, "authtype=%s\n", e->item.authtype);
if (credential_has_capability(&c.capa_authtype, CREDENTIAL_OP_HELPER) && e->item.credential)
if (credential_has_capability(&c.capa_authtype, CREDENTIAL_OP_RESPONSE) && e->item.credential)
fprintf(out, "credential=%s\n", e->item.credential);
if (e->item.password_expiry_utc != TIME_MAX)
fprintf(out, "password_expiry_utc=%"PRItime"\n",

View File

@@ -18,7 +18,8 @@ int cmd_credential(int argc,
git_config(git_default_config, NULL);
if (argc != 2 || !strcmp(argv[1], "-h"))
show_usage_if_asked(argc, argv, usage_msg);
if (argc != 2)
usage(usage_msg);
op = argv[1];
@@ -32,15 +33,15 @@ int cmd_credential(int argc,
die("unable to read credential from stdin");
if (!strcmp(op, "fill")) {
credential_fill(&c, 0);
credential_fill(the_repository, &c, 0);
credential_next_state(&c);
credential_write(&c, stdout, CREDENTIAL_OP_RESPONSE);
} else if (!strcmp(op, "approve")) {
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
credential_approve(&c);
credential_approve(the_repository, &c);
} else if (!strcmp(op, "reject")) {
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
credential_reject(&c);
credential_reject(the_repository, &c);
} else {
usage(usage_msg);
}

Some files were not shown because too many files have changed in this diff Show More