aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/RelNotes/2.50.0.adoc52
-rw-r--r--Documentation/config/checkout.adoc14
-rw-r--r--Documentation/config/commit.adoc7
-rw-r--r--Documentation/config/fmt-merge-msg.adoc8
-rw-r--r--Documentation/config/gitcvs.adoc3
-rw-r--r--Documentation/config/http.adoc3
-rw-r--r--Documentation/config/merge.adoc84
-rw-r--r--Documentation/config/mergetool.adoc54
-rw-r--r--Documentation/git-checkout.adoc228
-rw-r--r--Documentation/git-column.adoc6
-rw-r--r--Documentation/git-fast-export.adoc12
-rw-r--r--Documentation/git-fast-import.adoc3
-rw-r--r--Documentation/git-merge.adoc51
-rw-r--r--Documentation/git-mergetool.adoc62
-rw-r--r--Documentation/git-multi-pack-index.adoc11
-rw-r--r--Documentation/git-notes.adoc54
-rw-r--r--Documentation/git-stripspace.adoc3
-rw-r--r--Documentation/git-switch.adoc114
-rw-r--r--Documentation/merge-options.adoc110
-rw-r--r--Documentation/merge-strategies.adoc58
-rw-r--r--Documentation/mergetools/vimdiff.adoc16
-rw-r--r--Documentation/rerere-options.adoc4
-rw-r--r--Documentation/technical/sparse-checkout.adoc2
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--apply.c2
-rw-r--r--builtin/fast-export.c7
-rw-r--r--builtin/gc.c4
-rw-r--r--compat/posix.h10
-rw-r--r--config.mak.uname5
-rwxr-xr-xgenerate-configlist.sh1
-rw-r--r--git-compat-util.h16
-rwxr-xr-xgit-cvsserver.perl27
-rw-r--r--git-gui/.gitattributes1
-rw-r--r--git-gui/.gitignore2
-rw-r--r--git-gui/GIT-GUI-BUILD-OPTIONS.in7
-rwxr-xr-xgit-gui/GIT-VERSION-GEN44
-rw-r--r--git-gui/Makefile115
-rwxr-xr-xgit-gui/generate-git-gui.sh29
-rwxr-xr-xgit-gui/generate-macos-app.sh30
-rwxr-xr-xgit-gui/generate-macos-wrapper.sh35
-rwxr-xr-xgit-gui/generate-tclindex.sh32
-rw-r--r--git-gui/lib/meson.build74
-rw-r--r--git-gui/meson.build148
-rw-r--r--git-gui/po/meson.build38
-rw-r--r--gitk-git/Makefile2
-rwxr-xr-xgitk-git/gitk10
-rw-r--r--http-push.c8
-rw-r--r--http.c50
-rw-r--r--imap-send.c6
-rw-r--r--midx-write.c22
-rw-r--r--midx.c12
-rw-r--r--name-hash.c6
-rw-r--r--packfile.c11
-rw-r--r--refs/files-backend.c3
-rw-r--r--reftable/basics.h4
-rw-r--r--remote-curl.c12
-rwxr-xr-xt/t0602-reffiles-fsck.sh19
-rwxr-xr-xt/t4129-apply-samemode.sh231
-rwxr-xr-xt/t5410-receive-pack.sh17
-rwxr-xr-xt/t9350-fast-export.sh20
-rw-r--r--t/test-lib.sh2
-rw-r--r--thread-utils.c8
62 files changed, 1358 insertions, 673 deletions
diff --git a/Documentation/RelNotes/2.50.0.adoc b/Documentation/RelNotes/2.50.0.adoc
index c6c34d1a1d..99acf81487 100644
--- a/Documentation/RelNotes/2.50.0.adoc
+++ b/Documentation/RelNotes/2.50.0.adoc
@@ -89,6 +89,8 @@ UI, Workflows & Features
check, which can be useful when the repository arranges to ensure
connectivity by some other means.
+ * "git notes --help" documentation updates.
+
Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
@@ -100,7 +102,9 @@ Performance, Internal Implementation, Development Support etc.
* "git fsck" becomes more careful when checking the refs.
* "git fast-export | git fast-import" learns to deal with commit and
- tag objects with embedded signatures a bit better.
+ tag objects with embedded signatures a bit better. This is highly
+ experimental and the format of the data stream may change in the
+ future without compatibility guarantees.
* The code paths to check whether a refname X is available (by seeing
if another ref X/Y exists, etc.) have been optimized.
@@ -193,6 +197,21 @@ Performance, Internal Implementation, Development Support etc.
do not pass the leak checker tests, as they should no longer be
needed.
+ * When a stale .midx file refers to .pack files that no longer exist,
+ we ended up checking for these non-existent files repeatedly, which
+ has been optimized by memoizing the non-existence.
+
+ * Build settings have been improved for BSD based systems.
+
+ * Newer version of libcURL detected curl_easy_setopt() calls we made
+ with platform-natural "int" when we should have used "long", which
+ all have been corrected.
+
+ * Tests that compare $HOME and $(pwd), which should be the same
+ directory unless the tests chdir's around, would fail when the user
+ enters the test directory via symbolic links, which has been
+ corrected.
+
Fixes since v2.49
-----------------
@@ -292,7 +311,7 @@ Fixes since v2.49
(merge e7ef4be7c2 mh/left-right-limited later to maint).
* Document the convention to disable hooks altogether by setting the
- hooksPath configuration variable to /dev/nulll
+ hooksPath configuration variable to /dev/null.
(merge 1b2eee94f1 ds/doc-disable-hooks later to maint).
* Make sure outage of third-party sites that supply P4, Git-LFS, and
@@ -310,6 +329,7 @@ Fixes since v2.49
* Update to arm64 Windows port.
(merge 436a42215e js/windows-arm64 later to maint).
+
* hashmap API clean-up to ensure hashmap_clear() leaves a cleared map
in a reusable state.
(merge 9481877de3 en/hashmap-clear-fix later to maint).
@@ -343,7 +363,7 @@ Fixes since v2.49
(merge 5dbaec628d pw/sequencer-reflog-use-after-free later to maint).
* win+Meson CI pipeline, unlike other pipelines for Windows,
- used to build artifacts in develper mode, which has been changed to
+ used to build artifacts in developer mode, which has been changed to
build them in release mode for consistency.
(merge 184abdcf05 js/ci-build-win-in-release-mode later to maint).
@@ -355,6 +375,31 @@ Fixes since v2.49
expand sparse-index while working.
(merge ecf9ba20e3 ds/sparse-apply-add-p later to maint).
+ * Avoid adding directory path to a sparse-index tree entries to the
+ name-hash, since they would bloat the hashtable without anybody
+ querying for them. This was done already for a single threaded
+ part of the code, but now the multi-threaded code also does the
+ same.
+ (merge 2e60aabc75 am/sparse-index-name-hash-fix later to maint).
+
+ * Recent versions of Perl started warning against "! A =~ /pattern/"
+ which does not negate the result of the matching. As it turns out
+ that the problematic function is not even called, it was removed.
+ (merge 67cae845d2 op/cvsserver-perl-warning later to maint).
+
+ * "git apply --index/--cached" when applying a deletion patch in
+ reverse failed to give the mode bits of the path "removed" by the
+ patch to the file it creates, which has been corrected.
+
+ * "git verify-refs" (and hence "git fsck --reference") started
+ erroring out in a repository in which secondary worktrees were
+ prepared with Git 2.43 or lower.
+ (merge d5b3c38b8a sj/ref-contents-check-fix later to maint).
+
+ * Update total_ram() functrion on BSD variants.
+
+ * Update online_cpus() functrion on BSD variants.
+
* Other code cleanup, docfix, build fix, etc.
(merge 227c4f33a0 ja/doc-block-delimiter-markup-fix later to maint).
(merge 2bfd3b3685 ab/decorate-code-cleanup later to maint).
@@ -387,3 +432,4 @@ Fixes since v2.49
(merge 91db6c735d ly/reftable-writer-leakfix later to maint).
(merge 20e4e9ad0b jc/doc-synopsis-option-markup later to maint).
(merge cddcee7f64 es/meson-configure-build-options-fix later to maint).
+ (merge cea9f55f00 wk/sparse-checkout-doc-fix later to maint).
diff --git a/Documentation/config/checkout.adoc b/Documentation/config/checkout.adoc
index a323022993..e35d212969 100644
--- a/Documentation/config/checkout.adoc
+++ b/Documentation/config/checkout.adoc
@@ -1,9 +1,9 @@
-checkout.defaultRemote::
+`checkout.defaultRemote`::
When you run `git checkout <something>`
or `git switch <something>` and only have one
remote, it may implicitly fall back on checking out and
tracking e.g. `origin/<something>`. This stops working as soon
- as you have more than one remote with a `<something>`
+ as you have more than one remote with a _<something>_
reference. This setting allows for setting the name of a
preferred remote that should always win when it comes to
disambiguation. The typical use-case is to set this to
@@ -12,17 +12,17 @@ checkout.defaultRemote::
Currently this is used by linkgit:git-switch[1] and
linkgit:git-checkout[1] when `git checkout <something>`
or `git switch <something>`
-will checkout the `<something>` branch on another remote,
+will checkout the _<something>_ branch on another remote,
and by linkgit:git-worktree[1] when `git worktree add` refers to a
remote branch. This setting might be used for other checkout-like
commands or functionality in the future.
-checkout.guess::
+`checkout.guess`::
Provides the default value for the `--guess` or `--no-guess`
option in `git checkout` and `git switch`. See
linkgit:git-switch[1] and linkgit:git-checkout[1].
-checkout.workers::
+`checkout.workers`::
The number of parallel workers to use when updating the working tree.
The default is one, i.e. sequential execution. If set to a value less
than one, Git will use as many workers as the number of logical cores
@@ -30,13 +30,13 @@ checkout.workers::
all commands that perform checkout. E.g. checkout, clone, reset,
sparse-checkout, etc.
+
-Note: Parallel checkout usually delivers better performance for repositories
+NOTE: Parallel checkout usually delivers better performance for repositories
located on SSDs or over NFS. For repositories on spinning disks and/or machines
with a small number of cores, the default sequential checkout often performs
better. The size and compression level of a repository might also influence how
well the parallel version performs.
-checkout.thresholdForParallelism::
+`checkout.thresholdForParallelism`::
When running parallel checkout with a small number of files, the cost
of subprocess spawning and inter-process communication might outweigh
the parallelization gains. This setting allows you to define the minimum
diff --git a/Documentation/config/commit.adoc b/Documentation/config/commit.adoc
index d3f4624fd2..208ae76c81 100644
--- a/Documentation/config/commit.adoc
+++ b/Documentation/config/commit.adoc
@@ -8,10 +8,11 @@ endif::git-commit[]
This setting overrides the default of the `--cleanup` option in
`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
+ with the comment character (`core.commentChar`, default `#`)
+ 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).
+ have to remove the help lines that begin with the comment character
+ in the commit log template yourself, if you do this).
`commit.gpgSign`::
A boolean to specify whether all commits should be GPG signed.
diff --git a/Documentation/config/fmt-merge-msg.adoc b/Documentation/config/fmt-merge-msg.adoc
index 3fbf40e24f..696ba0531a 100644
--- a/Documentation/config/fmt-merge-msg.adoc
+++ b/Documentation/config/fmt-merge-msg.adoc
@@ -1,19 +1,19 @@
-merge.branchdesc::
+`merge.branchdesc`::
In addition to branch names, populate the log message with
the branch description text associated with them. Defaults
to false.
-merge.log::
+`merge.log`::
In addition to branch names, populate the log message with at
most the specified number of one-line descriptions from the
actual commits that are being merged. Defaults to false, and
true is a synonym for 20.
-merge.suppressDest::
+`merge.suppressDest`::
By adding a glob that matches the names of integration
branches to this multi-valued configuration variable, the
default merge message computed for merges into these
- integration branches will omit "into <branch name>" from
+ integration branches will omit "into _<branch-name>_" from
its title.
+
An element with an empty value can be used to clear the list
diff --git a/Documentation/config/gitcvs.adoc b/Documentation/config/gitcvs.adoc
index 02da427fd9..31d7be3992 100644
--- a/Documentation/config/gitcvs.adoc
+++ b/Documentation/config/gitcvs.adoc
@@ -47,7 +47,8 @@ gitcvs.dbDriver::
May not contain double colons (`:`). Default: 'SQLite'.
See linkgit:git-cvsserver[1].
-gitcvs.dbUser, gitcvs.dbPass::
+gitcvs.dbUser::
+gitcvs.dbPass::
Database user and password. Only useful if setting `gitcvs.dbDriver`,
since SQLite has no concept of database users and/or passwords.
'gitcvs.dbUser' supports variable substitution (see
diff --git a/Documentation/config/http.adoc b/Documentation/config/http.adoc
index 67393282fa..9da5c298cc 100644
--- a/Documentation/config/http.adoc
+++ b/Documentation/config/http.adoc
@@ -289,7 +289,8 @@ for most push problems, but can increase memory consumption
significantly since the entire buffer is allocated even for small
pushes.
-http.lowSpeedLimit, http.lowSpeedTime::
+http.lowSpeedLimit::
+http.lowSpeedTime::
If the HTTP transfer speed, in bytes per second, is less than
'http.lowSpeedLimit' for longer than 'http.lowSpeedTime' seconds,
the transfer is aborted.
diff --git a/Documentation/config/merge.adoc b/Documentation/config/merge.adoc
index d2d0f21a71..86359f6dd2 100644
--- a/Documentation/config/merge.adoc
+++ b/Documentation/config/merge.adoc
@@ -1,9 +1,9 @@
-merge.conflictStyle::
+`merge.conflictStyle`::
Specify the style in which conflicted hunks are written out to
working tree files upon merge. The default is "merge", which
- shows a `<<<<<<<` conflict marker, changes made by one side,
+ shows a +<<<<<<<+ conflict marker, changes made by one side,
a `=======` marker, changes made by the other side, and then
- a `>>>>>>>` marker. An alternate style, "diff3", adds a `|||||||`
+ a +>>>>>>>+ marker. An alternate style, "diff3", adds a +|||||||+
marker and the original text before the `=======` marker. The
"merge" style tends to produce smaller conflict regions than diff3,
both because of the exclusion of the original text, and because
@@ -13,17 +13,17 @@ merge.conflictStyle::
the conflict region when those matching lines appear near either
the beginning or end of a conflict region.
-merge.defaultToUpstream::
+`merge.defaultToUpstream`::
If merge is called without any commit argument, merge the upstream
branches configured for the current branch by using their last
observed values stored in their remote-tracking branches.
The values of the `branch.<current branch>.merge` that name the
- branches at the remote named by `branch.<current branch>.remote`
+ branches at the remote named by `branch.<current-branch>.remote`
are consulted, and then they are mapped via `remote.<remote>.fetch`
to their corresponding remote-tracking branches, and the tips of
these tracking branches are merged. Defaults to true.
-merge.ff::
+`merge.ff`::
By default, Git does not create an extra merge commit when merging
a commit that is a descendant of the current commit. Instead, the
tip of the current branch is fast-forwarded. When set to `false`,
@@ -33,42 +33,46 @@ merge.ff::
allowed (equivalent to giving the `--ff-only` option from the
command line).
-merge.verifySignatures::
- If true, this is equivalent to the --verify-signatures command
+`merge.verifySignatures`::
+ If true, this is equivalent to the `--verify-signatures` command
line option. See linkgit:git-merge[1] for details.
include::fmt-merge-msg.adoc[]
-merge.renameLimit::
+`merge.renameLimit`::
The number of files to consider in the exhaustive portion of
rename detection during a merge. If not specified, defaults
- to the value of diff.renameLimit. If neither
- merge.renameLimit nor diff.renameLimit are specified,
+ to the value of `diff.renameLimit`. If neither
+ `merge.renameLimit` nor `diff.renameLimit` are specified,
currently defaults to 7000. This setting has no effect if
rename detection is turned off.
-merge.renames::
- Whether Git detects renames. If set to "false", rename detection
- is disabled. If set to "true", basic rename detection is enabled.
+`merge.renames`::
+ Whether Git detects renames. If set to `false`, rename detection
+ is disabled. If set to `true`, basic rename detection is enabled.
Defaults to the value of diff.renames.
-merge.directoryRenames::
+`merge.directoryRenames`::
Whether Git detects directory renames, affecting what happens at
merge time to new files added to a directory on one side of
history when that directory was renamed on the other side of
- history. If merge.directoryRenames is set to "false", directory
- rename detection is disabled, meaning that such new files will be
- left behind in the old directory. If set to "true", directory
- rename detection is enabled, meaning that such new files will be
- moved into the new directory. If set to "conflict", a conflict
- will be reported for such paths. If merge.renames is false,
- merge.directoryRenames is ignored and treated as false. Defaults
- to "conflict".
-
-merge.renormalize::
+ history. Possible values are:
++
+--
+`false`;; Directory rename detection is disabled, meaning that such new files will be
+ left behind in the old directory.
+`true`;; Directory rename detection is enabled, meaning that such new files will be
+ moved into the new directory.
+`conflict`;; A conflict will be reported for such paths.
+--
++
+If `merge.renames` is `false`, `merge.directoryRenames` is ignored and treated
+as `false`. Defaults to `conflict`.
+
+`merge.renormalize`::
Tell Git that canonical representation of files in the
repository has changed over time (e.g. earlier commits record
- text files with CRLF line endings, but recent ones use LF line
+ text files with _CRLF_ line endings, but recent ones use _LF_ line
endings). In such a repository, for each file where a
three-way content merge is needed, Git can convert the data
recorded in commits to a canonical form before performing a
@@ -76,35 +80,35 @@ merge.renormalize::
see section "Merging branches with differing checkin/checkout
attributes" in linkgit:gitattributes[5].
-merge.stat::
- Whether to print the diffstat between ORIG_HEAD and the merge result
+`merge.stat`::
+ Whether to print the diffstat between `ORIG_HEAD` and the merge result
at the end of the merge. True by default.
-merge.autoStash::
- When set to true, automatically create a temporary stash entry
+`merge.autoStash`::
+ When set to `true`, automatically create a temporary stash entry
before the operation begins, and apply it after the operation
ends. This means that you can run merge on a dirty worktree.
However, use with care: the final stash application after a
successful merge might result in non-trivial conflicts.
This option can be overridden by the `--no-autostash` and
`--autostash` options of linkgit:git-merge[1].
- Defaults to false.
+ Defaults to `false`.
-merge.tool::
+`merge.tool`::
Controls which merge tool is used by linkgit:git-mergetool[1].
The list below shows the valid built-in values.
Any other value is treated as a custom merge tool and requires
- that a corresponding mergetool.<tool>.cmd variable is defined.
+ that a corresponding `mergetool.<tool>.cmd` variable is defined.
-merge.guitool::
+`merge.guitool`::
Controls which merge tool is used by linkgit:git-mergetool[1] when the
- -g/--gui flag is specified. The list below shows the valid built-in values.
+ `-g`/`--gui` flag is specified. The list below shows the valid built-in values.
Any other value is treated as a custom merge tool and requires that a
- corresponding mergetool.<guitool>.cmd variable is defined.
+ corresponding `mergetool.<guitool>.cmd` variable is defined.
include::{build_dir}/mergetools-merge.adoc[]
-merge.verbosity::
+`merge.verbosity`::
Controls the amount of output shown by the recursive merge
strategy. Level 0 outputs nothing except a final error
message if conflicts were detected. Level 1 outputs only
@@ -112,15 +116,15 @@ merge.verbosity::
above outputs debugging information. The default is level 2.
Can be overridden by the `GIT_MERGE_VERBOSITY` environment variable.
-merge.<driver>.name::
+`merge.<driver>.name`::
Defines a human-readable name for a custom low-level
merge driver. See linkgit:gitattributes[5] for details.
-merge.<driver>.driver::
+`merge.<driver>.driver`::
Defines the command that implements a custom low-level
merge driver. See linkgit:gitattributes[5] for details.
-merge.<driver>.recursive::
+`merge.<driver>.recursive`::
Names a low-level merge driver to be used when
performing an internal merge between common ancestors.
See linkgit:gitattributes[5] for details.
diff --git a/Documentation/config/mergetool.adoc b/Documentation/config/mergetool.adoc
index 00bf665aa0..6be506145c 100644
--- a/Documentation/config/mergetool.adoc
+++ b/Documentation/config/mergetool.adoc
@@ -1,24 +1,24 @@
-mergetool.<tool>.path::
+`mergetool.<tool>.path`::
Override the path for the given tool. This is useful in case
- your tool is not in the PATH.
+ your tool is not in the `$PATH`.
-mergetool.<tool>.cmd::
+`mergetool.<tool>.cmd`::
Specify the command to invoke the specified merge tool. The
specified command is evaluated in shell with the following
- variables available: 'BASE' is the name of a temporary file
+ variables available: `BASE` is the name of a temporary file
containing the common base of the files to be merged, if available;
- 'LOCAL' is the name of a temporary file containing the contents of
- the file on the current branch; 'REMOTE' is the name of a temporary
+ `LOCAL` is the name of a temporary file containing the contents of
+ the file on the current branch; `REMOTE` is the name of a temporary
file containing the contents of the file from the branch being
- merged; 'MERGED' contains the name of the file to which the merge
+ merged; `MERGED` contains the name of the file to which the merge
tool should write the results of a successful merge.
-mergetool.<tool>.hideResolved::
+`mergetool.<tool>.hideResolved`::
Allows the user to override the global `mergetool.hideResolved` value
for a specific tool. See `mergetool.hideResolved` for the full
description.
-mergetool.<tool>.trustExitCode::
+`mergetool.<tool>.trustExitCode`::
For a custom merge command, specify whether the exit code of
the merge command can be used to determine whether the merge was
successful. If this is not set to true then the merge target file
@@ -26,7 +26,7 @@ mergetool.<tool>.trustExitCode::
if the file has been updated; otherwise, the user is prompted to
indicate the success of the merge.
-mergetool.meld.hasOutput::
+`mergetool.meld.hasOutput`::
Older versions of `meld` do not support the `--output` option.
Git will attempt to detect whether `meld` supports `--output`
by inspecting the output of `meld --help`. Configuring
@@ -35,7 +35,7 @@ mergetool.meld.hasOutput::
to `true` tells Git to unconditionally use the `--output` option,
and `false` avoids using `--output`.
-mergetool.meld.useAutoMerge::
+`mergetool.meld.useAutoMerge`::
When the `--auto-merge` is given, meld will merge all non-conflicting
parts automatically, highlight the conflicting parts, and wait for
user decision. Setting `mergetool.meld.useAutoMerge` to `true` tells
@@ -45,15 +45,15 @@ mergetool.meld.useAutoMerge::
value of `false` avoids using `--auto-merge` altogether, and is the
default value.
-mergetool.<vimdiff variant>.layout::
- Configure the split window layout for vimdiff's `<variant>`, which is any of `vimdiff`,
+`mergetool.<variant>.layout`::
+ Configure the split window layout for vimdiff's _<variant>_, which is any of `vimdiff`,
`nvimdiff`, `gvimdiff`.
Upon launching `git mergetool` with `--tool=<variant>` (or without `--tool`
- if `merge.tool` is configured as `<variant>`), Git will consult
+ if `merge.tool` is configured as _<variant>_), Git will consult
`mergetool.<variant>.layout` to determine the tool's layout. If the
- variant-specific configuration is not available, `vimdiff`'s is used as
+ variant-specific configuration is not available, `vimdiff` ' s is used as
fallback. If that too is not available, a default layout with 4 windows
- will be used. To configure the layout, see the `BACKEND SPECIFIC HINTS`
+ will be used. To configure the layout, see the 'BACKEND SPECIFIC HINTS'
ifdef::git-mergetool[]
section.
endif::[]
@@ -61,39 +61,39 @@ ifndef::git-mergetool[]
section in linkgit:git-mergetool[1].
endif::[]
-mergetool.hideResolved::
+`mergetool.hideResolved`::
During a merge, Git will automatically resolve as many conflicts as
- possible and write the 'MERGED' file containing conflict markers around
- any conflicts that it cannot resolve; 'LOCAL' and 'REMOTE' normally
- represent the versions of the file from before Git's conflict
- resolution. This flag causes 'LOCAL' and 'REMOTE' to be overwritten so
+ possible and write the `$MERGED` file containing conflict markers around
+ any conflicts that it cannot resolve; `$LOCAL` and `$REMOTE` normally
+ are the versions of the file from before Git`s conflict
+ resolution. This flag causes `$LOCAL` and `$REMOTE` to be overwritten so
that only the unresolved conflicts are presented to the merge tool. Can
be configured per-tool via the `mergetool.<tool>.hideResolved`
configuration variable. Defaults to `false`.
-mergetool.keepBackup::
+`mergetool.keepBackup`::
After performing a merge, the original file with conflict markers
can be saved as a file with a `.orig` extension. If this variable
is set to `false` then this file is not preserved. Defaults to
`true` (i.e. keep the backup files).
-mergetool.keepTemporaries::
+`mergetool.keepTemporaries`::
When invoking a custom merge tool, Git uses a set of temporary
files to pass to the tool. If the tool returns an error and this
variable is set to `true`, then these temporary files will be
preserved; otherwise, they will be removed after the tool has
exited. Defaults to `false`.
-mergetool.writeToTemp::
- Git writes temporary 'BASE', 'LOCAL', and 'REMOTE' versions of
+`mergetool.writeToTemp`::
+ Git writes temporary `BASE`, `LOCAL`, and `REMOTE` versions of
conflicting files in the worktree by default. Git will attempt
to use a temporary directory for these files when set `true`.
Defaults to `false`.
-mergetool.prompt::
+`mergetool.prompt`::
Prompt before each invocation of the merge resolution program.
-mergetool.guiDefault::
+`mergetool.guiDefault`::
Set `true` to use the `merge.guitool` by default (equivalent to
specifying the `--gui` argument), or `auto` to select `merge.guitool`
or `merge.tool` depending on the presence of a `DISPLAY` environment
diff --git a/Documentation/git-checkout.adoc b/Documentation/git-checkout.adoc
index a66c53a5cd..ee83b6d9ba 100644
--- a/Documentation/git-checkout.adoc
+++ b/Documentation/git-checkout.adoc
@@ -7,54 +7,54 @@ git-checkout - Switch branches or restore working tree files
SYNOPSIS
--------
-[verse]
-'git checkout' [-q] [-f] [-m] [<branch>]
-'git checkout' [-q] [-f] [-m] --detach [<branch>]
-'git checkout' [-q] [-f] [-m] [--detach] <commit>
-'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new-branch>] [<start-point>]
-'git checkout' [-f] <tree-ish> [--] <pathspec>...
-'git checkout' [-f] <tree-ish> --pathspec-from-file=<file> [--pathspec-file-nul]
-'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [--] <pathspec>...
-'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] --pathspec-from-file=<file> [--pathspec-file-nul]
-'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]
+[synopsis]
+git checkout [-q] [-f] [-m] [<branch>]
+git checkout [-q] [-f] [-m] --detach [<branch>]
+git checkout [-q] [-f] [-m] [--detach] <commit>
+git checkout [-q] [-f] [-m] [[-b|-B|--orphan] <new-branch>] [<start-point>]
+git checkout [-f] <tree-ish> [--] <pathspec>...
+git checkout [-f] <tree-ish> --pathspec-from-file=<file> [--pathspec-file-nul]
+git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [--] <pathspec>...
+git checkout [-f|--ours|--theirs|-m|--conflict=<style>] --pathspec-from-file=<file> [--pathspec-file-nul]
+git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>...]
DESCRIPTION
-----------
Updates files in the working tree to match the version in the index
-or the specified tree. If no pathspec was given, 'git checkout' will
+or the specified tree. If no pathspec was given, `git checkout` will
also update `HEAD` to set the specified branch as the current
branch.
-'git checkout' [<branch>]::
- To prepare for working on `<branch>`, switch to it by updating
+`git checkout [<branch>]`::
+ To prepare for working on _<branch>_, switch to it by updating
the index and the files in the working tree, and by pointing
`HEAD` at the branch. Local modifications to the files in the
working tree are kept, so that they can be committed to the
- `<branch>`.
+ _<branch>_.
+
-If `<branch>` is not found but there does exist a tracking branch in
-exactly one remote (call it `<remote>`) with a matching name and
+If _<branch>_ is not found but there does exist a tracking branch in
+exactly one remote (call it _<remote>_) with a matching name and
`--no-guess` is not specified, treat as equivalent to
+
------------
$ git checkout -b <branch> --track <remote>/<branch>
------------
+
-You could omit `<branch>`, in which case the command degenerates to
+You could omit _<branch>_, in which case the command degenerates to
"check out the current branch", which is a glorified no-op with
rather expensive side-effects to show only the tracking information,
if it exists, for the current branch.
-'git checkout' -b|-B <new-branch> [<start-point>]::
+`git checkout (-b|-B) <new-branch> [<start-point>]`::
Specifying `-b` causes a new branch to be created as if
linkgit:git-branch[1] were called and then checked out. In
this case you can use the `--track` or `--no-track` options,
- which will be passed to 'git branch'. As a convenience,
+ which will be passed to `git branch`. As a convenience,
`--track` without `-b` implies branch creation; see the
description of `--track` below.
+
-If `-B` is given, `<new-branch>` is created if it doesn't exist; otherwise, it
+If `-B` is given, _<new-branch>_ is created if it doesn't exist; otherwise, it
is reset. This is the transactional equivalent of
+
------------
@@ -67,30 +67,30 @@ successful (e.g., when the branch is in use in another worktree, not
just the current branch stays the same, but the branch is not reset to
the start-point, either).
-'git checkout' --detach [<branch>]::
-'git checkout' [--detach] <commit>::
+`git checkout --detach [<branch>]`::
+`git checkout [--detach] <commit>`::
- Prepare to work on top of `<commit>`, by detaching `HEAD` at it
+ Prepare to work on top of _<commit>_, by detaching `HEAD` at it
(see "DETACHED HEAD" section), and updating the index and the
files in the working tree. Local modifications to the files
in the working tree are kept, so that the resulting working
tree will be the state recorded in the commit plus the local
modifications.
+
-When the `<commit>` argument is a branch name, the `--detach` option can
+When the _<commit>_ argument is a branch name, the `--detach` option can
be used to detach `HEAD` at the tip of the branch (`git checkout
<branch>` would check out that branch without detaching `HEAD`).
+
-Omitting `<branch>` detaches `HEAD` at the tip of the current branch.
+Omitting _<branch>_ detaches `HEAD` at the tip of the current branch.
-'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>...::
-'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] --pathspec-from-file=<file> [--pathspec-file-nul]::
+`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>...`::
+`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] --pathspec-from-file=<file> [--pathspec-file-nul]`::
Overwrite the contents of the files that match the pathspec.
- When the `<tree-ish>` (most often a commit) is not given,
+ When the _<tree-ish>_ (most often a commit) is not given,
overwrite working tree with the contents in the index.
- When the `<tree-ish>` is given, overwrite both the index and
- the working tree with the contents at the `<tree-ish>`.
+ When the _<tree-ish>_ is given, overwrite both the index and
+ the working tree with the contents at the _<tree-ish>_.
+
The index may contain unmerged entries because of a previous failed merge.
By default, if you try to check out such an entry from the index, the
@@ -100,7 +100,7 @@ specific side of the merge can be checked out of the index by
using `--ours` or `--theirs`. With `-m`, changes made to the working tree
file can be discarded to re-create the original conflicted merge result.
-'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]::
+`git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>...]`::
This is similar to the previous mode, but lets you use the
interactive interface to show the "diff" output and choose which
hunks to use in the result. See below for the description of
@@ -108,19 +108,19 @@ file can be discarded to re-create the original conflicted merge result.
OPTIONS
-------
--q::
---quiet::
+`-q`::
+`--quiet`::
Quiet, suppress feedback messages.
---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`.
--f::
---force::
+`-f`::
+`--force`::
When switching branches, proceed even if the index or the
working tree differs from `HEAD`, and even if there are untracked
files in the way. This is used to throw away local changes and
@@ -129,13 +129,13 @@ OPTIONS
When checking out paths from the index, do not fail upon unmerged
entries; instead, unmerged entries are ignored.
---ours::
---theirs::
+`--ours`::
+`--theirs`::
When checking out paths from the index, check out stage #2
- ('ours') or #3 ('theirs') for unmerged paths.
+ (`ours`) or #3 (`theirs`) for unmerged paths.
+
-Note that during `git rebase` and `git pull --rebase`, 'ours' and
-'theirs' may appear swapped; `--ours` gives the version from the
+Note that during `git rebase` and `git pull --rebase`, `ours` and
+`theirs` may appear swapped; `--ours` gives the version from the
branch the changes are rebased onto, while `--theirs` gives the
version from the branch that holds your work that is being rebased.
+
@@ -149,22 +149,22 @@ as `ours` (i.e. "our shared canonical history"), while what you did
on your side branch as `theirs` (i.e. "one contributor's work on top
of it").
--b <new-branch>::
- Create a new branch named `<new-branch>`, start it at
- `<start-point>`, and check the resulting branch out;
+`-b <new-branch>`::
+ Create a new branch named _<new-branch>_, start it at
+ _<start-point>_, and check the resulting branch out;
see linkgit:git-branch[1] for details.
--B <new-branch>::
- Creates the branch `<new-branch>`, start it at `<start-point>`;
- if it already exists, then reset it to `<start-point>`. And then
+`-B <new-branch>`::
+ Creates the branch _<new-branch>_, start it at _<start-point>_;
+ if it already exists, then reset it to _<start-point>_. And then
check the resulting branch out. This is equivalent to running
- "git branch" with "-f" followed by "git checkout" of that branch;
+ `git branch` with `-f` followed by `git checkout` of that branch;
see linkgit:git-branch[1] for details.
--t::
---track[=(direct|inherit)]::
+`-t`::
+`--track[=(direct|inherit)]`::
When creating a new branch, set up "upstream" configuration. See
- "--track" in linkgit:git-branch[1] for details.
+ `--track` in linkgit:git-branch[1] for details.
+
If no `-b` option is given, the name of the new branch will be
derived from the remote-tracking branch, by looking at the local part of
@@ -176,14 +176,14 @@ off of `origin/hack` (or `remotes/origin/hack`, or even
guessing results in an empty name, the guessing is aborted. You can
explicitly give a name with `-b` in such a case.
---no-track::
+`--no-track`::
Do not set up "upstream" configuration, even if the
`branch.autoSetupMerge` configuration variable is true.
---guess::
---no-guess::
- If `<branch>` is not found but there does exist a tracking
- branch in exactly one remote (call it `<remote>`) with a
+`--guess`::
+`--no-guess`::
+ If _<branch>_ is not found but there does exist a tracking
+ branch in exactly one remote (call it _<remote>_) with a
matching name, treat as equivalent to
+
------------
@@ -192,10 +192,10 @@ $ git checkout -b <branch> --track <remote>/<branch>
+
If the branch exists in multiple remotes and one of them is named by
the `checkout.defaultRemote` configuration variable, we'll use that
-one for the purposes of disambiguation, even if the `<branch>` isn't
+one for the purposes of disambiguation, even if the _<branch>_ isn't
unique across all remotes. Set it to
e.g. `checkout.defaultRemote=origin` to always checkout remote
-branches from there if `<branch>` is ambiguous but exists on the
+branches from there if _<branch>_ is ambiguous but exists on the
'origin' remote. See also `checkout.defaultRemote` in
linkgit:git-config[1].
+
@@ -204,28 +204,28 @@ linkgit:git-config[1].
The default behavior can be set via the `checkout.guess` configuration
variable.
--l::
+`-l`::
Create the new branch's reflog; see linkgit:git-branch[1] for
details.
--d::
---detach::
+`-d`::
+`--detach`::
Rather than checking out a branch to work on it, check out a
commit for inspection and discardable experiments.
This is the default behavior of `git checkout <commit>` when
- `<commit>` is not a branch name. See the "DETACHED HEAD" section
+ _<commit>_ is not a branch name. See the "DETACHED HEAD" section
below for details.
---orphan <new-branch>::
- Create a new unborn branch, named `<new-branch>`, started from
- `<start-point>` and switch to it. The first commit made on this
+`--orphan <new-branch>`::
+ Create a new unborn branch, named _<new-branch>_, started from
+ _<start-point>_ and switch to it. The first commit made on this
new branch will have no parents and it will be the root of a new
history totally disconnected from all the other branches and
commits.
+
The index and the working tree are adjusted as if you had previously run
`git checkout <start-point>`. This allows you to start a new history
-that records a set of paths similar to `<start-point>` by easily running
+that records a set of paths similar to _<start-point>_ by easily running
`git commit -a` to make the root commit.
+
This can be useful when you want to publish the tree from a commit
@@ -235,20 +235,20 @@ whose full history contains proprietary or otherwise encumbered bits of
code.
+
If you want to start a disconnected history that records a set of paths
-that is totally different from the one of `<start-point>`, then you should
+that is totally different from the one of _<start-point>_, then you should
clear the index and the working tree right after creating the orphan
branch by running `git rm -rf .` from the top level of the working tree.
Afterwards you will be ready to prepare your new files, repopulating the
working tree, by copying them from elsewhere, extracting a tarball, etc.
---ignore-skip-worktree-bits::
- In sparse checkout mode, `git checkout -- <paths>` would
- update only entries matched by `<paths>` and sparse patterns
+`--ignore-skip-worktree-bits`::
+ In sparse checkout mode, `git checkout -- <path>...` would
+ update only entries matched by _<paths>_ and sparse patterns
in `$GIT_DIR/info/sparse-checkout`. This option ignores
- the sparse patterns and adds back any files in `<paths>`.
+ the sparse patterns and adds back any files in `<path>...`.
--m::
---merge::
+`-m`::
+`--merge`::
When switching branches,
if you have local modifications to one or more files that
are different between the current branch and the branch to
@@ -269,40 +269,40 @@ used when checking out paths from a tree-ish.
+
When switching branches with `--merge`, staged changes may be lost.
---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".
+ `merge` (default), `diff3`, and `zdiff3`.
--p::
---patch::
+`-p`::
+`--patch`::
Interactively select hunks in the difference between the
- `<tree-ish>` (or the index, if unspecified) and the working
+ _<tree-ish>_ (or the index, if unspecified) and the working
tree. The chosen hunks are then applied in reverse to the
- working tree (and if a `<tree-ish>` was specified, the index).
+ working tree (and if a _<tree-ish>_ was specified, the index).
+
This means that you can use `git checkout -p` to selectively discard
-edits from your current working tree. See the ``Interactive Mode''
+edits from your current working tree. See the "Interactive Mode"
section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
+
Note that this option uses the no overlay mode by default (see also
`--overlay`), and currently doesn't support overlay mode.
---ignore-other-worktrees::
+`--ignore-other-worktrees`::
`git checkout` refuses when the wanted branch is already checked
out or otherwise in use by another worktree. This option makes
it check the branch out anyway. In other words, the branch can
be in use by more than one worktree.
---overwrite-ignore::
---no-overwrite-ignore::
+`--overwrite-ignore`::
+`--no-overwrite-ignore`::
Silently overwrite ignored files when switching branches. This
is the default behavior. Use `--no-overwrite-ignore` to abort
the operation when the new branch contains ignored files.
---recurse-submodules::
---no-recurse-submodules::
+`--recurse-submodules`::
+`--no-recurse-submodules`::
Using `--recurse-submodules` will update the content of all active
submodules according to the commit recorded in the superproject. If
local modifications in a submodule would be overwritten the checkout
@@ -311,25 +311,25 @@ Note that this option uses the no overlay mode by default (see also
Just like linkgit:git-submodule[1], this will detach `HEAD` of the
submodule.
---overlay::
---no-overlay::
+`--overlay`::
+`--no-overlay`::
In the default overlay mode, `git checkout` never
removes files from the index or the working tree. When
specifying `--no-overlay`, files that appear in the index and
- working tree, but not in `<tree-ish>` are removed, to make them
- match `<tree-ish>` exactly.
+ working tree, but not in _<tree-ish>_ are removed, to make them
+ match _<tree-ish>_ exactly.
---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).
<branch>::
@@ -343,33 +343,33 @@ You can use the `@{-N}` syntax to refer to the N-th last
branch/commit checked out using "git checkout" operation. You may
also specify `-` which is synonymous to `@{-1}`.
+
-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`.
-<new-branch>::
+_<new-branch>_::
Name for the new branch.
-<start-point>::
+_<start-point>_::
The name of a commit at which to start the new branch; see
linkgit:git-branch[1] for details. Defaults to `HEAD`.
+
-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`.
-<tree-ish>::
+_<tree-ish>_::
Tree to checkout from (when paths are given). If not specified,
the index will be used.
+
-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`.
-\--::
+`--`::
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].
@@ -391,7 +391,7 @@ a---b---c branch 'master' (refers to commit 'c')
------------
When a commit is created in this state, the branch is updated to refer to
-the new commit. Specifically, 'git commit' creates a new commit `d`, whose
+the new commit. Specifically, `git commit` creates a new commit `d`, whose
parent is commit `c`, and then updates branch `master` to refer to new
commit `d`. `HEAD` still refers to branch `master` and so indirectly now refers
to commit `d`:
@@ -510,11 +510,11 @@ ARGUMENT DISAMBIGUATION
-----------------------
When there is only one argument given and it is not `--` (e.g. `git
-checkout abc`), and when the argument is both a valid `<tree-ish>`
-(e.g. a branch `abc` exists) and a valid `<pathspec>` (e.g. a file
+checkout abc`), and when the argument is both a valid _<tree-ish>_
+(e.g. a branch `abc` exists) and a valid _<pathspec>_ (e.g. a file
or a directory whose name is "abc" exists), Git would usually ask
you to disambiguate. Because checking out a branch is so common an
-operation, however, `git checkout abc` takes "abc" as a `<tree-ish>`
+operation, however, `git checkout abc` takes "abc" as a _<tree-ish>_
in such a situation. Use `git checkout -- <pathspec>` if you want
to checkout these paths out of the index.
diff --git a/Documentation/git-column.adoc b/Documentation/git-column.adoc
index 5a4f2b6fde..8e0047214d 100644
--- a/Documentation/git-column.adoc
+++ b/Documentation/git-column.adoc
@@ -50,7 +50,7 @@ EXAMPLES
--------
Format data by columns:
-+
+
------------
$ seq 1 24 | git column --mode=column --padding=5
1 4 7 10 13 16 19 22
@@ -59,7 +59,7 @@ $ seq 1 24 | git column --mode=column --padding=5
------------
Format data by rows:
-+
+
------------
$ seq 1 21 | git column --mode=row --padding=5
1 2 3 4 5 6 7
@@ -68,7 +68,7 @@ $ seq 1 21 | git column --mode=row --padding=5
------------
List some tags in a table with unequal column widths:
-+
+
------------
$ git tag --list 'v2.4.*' --column=row,dense
v2.4.0 v2.4.0-rc0 v2.4.0-rc1 v2.4.0-rc2 v2.4.0-rc3
diff --git a/Documentation/git-fast-export.adoc b/Documentation/git-fast-export.adoc
index 413a527496..43bbb4f63c 100644
--- a/Documentation/git-fast-export.adoc
+++ b/Documentation/git-fast-export.adoc
@@ -46,14 +46,12 @@ resulting tag will have an invalid signature.
--signed-commits=(verbatim|warn-verbatim|warn-strip|strip|abort)::
Specify how to handle signed commits. Behaves exactly as
- '--signed-tags', but for commits. Default is 'abort'.
+ '--signed-tags', but for commits. Default is 'strip', which
+ is the same as how earlier versions of this command without
+ this option behaved.
+
-Earlier versions this command that did not have '--signed-commits'
-behaved as if '--signed-commits=strip'. As an escape hatch for users
-of tools that call 'git fast-export' but do not yet support
-'--signed-commits', you may set the environment variable
-'FAST_EXPORT_SIGNED_COMMITS_NOABORT=1' in order to change the default
-from 'abort' to 'warn-strip'.
+NOTE: This is highly experimental and the format of the data stream may
+change in the future without compatibility guarantees.
--tag-of-filtered-object=(abort|drop|rewrite)::
Specify how to handle tags whose tagged object is filtered out.
diff --git a/Documentation/git-fast-import.adoc b/Documentation/git-fast-import.adoc
index 7b107f5e8e..250d866652 100644
--- a/Documentation/git-fast-import.adoc
+++ b/Documentation/git-fast-import.adoc
@@ -523,6 +523,9 @@ that signs the commit data.
Here <alg> specifies which hashing algorithm is used for this
signature, either `sha1` or `sha256`.
+NOTE: This is highly experimental and the format of the data stream may
+change in the future without compatibility guarantees.
+
`encoding`
^^^^^^^^^^
The optional `encoding` command indicates the encoding of the commit
diff --git a/Documentation/git-merge.adoc b/Documentation/git-merge.adoc
index 64281d6d44..12aa859d16 100644
--- a/Documentation/git-merge.adoc
+++ b/Documentation/git-merge.adoc
@@ -8,13 +8,13 @@ git-merge - Join two or more development histories together
SYNOPSIS
--------
-[verse]
-'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
+[synopsis]
+git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
[--no-verify] [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
[--[no-]allow-unrelated-histories]
[--[no-]rerere-autoupdate] [-m <msg>] [-F <file>]
[--into-name <branch>] [<commit>...]
-'git merge' (--continue | --abort | --quit)
+git merge (--continue | --abort | --quit)
DESCRIPTION
-----------
@@ -57,7 +57,7 @@ merge started (and especially if those changes were further modified
after the merge was started), `git merge --abort` will in some cases be
unable to reconstruct the original (pre-merge) changes. Therefore:
-*Warning*: Running `git merge` with non-trivial uncommitted changes is
+WARNING: Running `git merge` with non-trivial uncommitted changes is
discouraged: while possible, it may leave you in a state that is hard to
back out of in the case of a conflict.
@@ -67,7 +67,7 @@ OPTIONS
include::merge-options.adoc[]
--m <msg>::
+`-m <msg>`::
Set the commit message to be used for the merge commit (in
case one is created).
+
@@ -78,13 +78,13 @@ The `git fmt-merge-msg` command can be
used to give a good default for automated `git merge`
invocations. The automated message can include the branch description.
---into-name <branch>::
+`--into-name <branch>`::
Prepare the default merge message as if merging to the branch
- `<branch>`, instead of the name of the real branch to which
+ _<branch>_, instead of the name of the real branch to which
the merge is made.
--F <file>::
---file=<file>::
+`-F <file>`::
+`--file=<file>`::
Read the commit message to be used for the merge commit (in
case one is created).
+
@@ -93,12 +93,12 @@ will be appended to the specified message.
include::rerere-options.adoc[]
---overwrite-ignore::
---no-overwrite-ignore::
+`--overwrite-ignore`::
+`--no-overwrite-ignore`::
Silently overwrite ignored files from the merge result. This
is the default behavior. Use `--no-overwrite-ignore` to abort.
---abort::
+`--abort`::
Abort the current conflict resolution process, and
try to reconstruct the pre-merge state. If an autostash entry is
present, apply it to the worktree.
@@ -114,17 +114,17 @@ which case `git merge --abort` applies the stash entry to the worktree
whereas `git reset --merge` will save the stashed changes in the stash
list.
---quit::
+`--quit`::
Forget about the current merge in progress. Leave the index
and the working tree as-is. If `MERGE_AUTOSTASH` is present, the
stash entry will be saved to the stash list.
---continue::
+`--continue`::
After a `git merge` stops due to conflicts you can conclude the
merge by running `git merge --continue` (see "HOW TO RESOLVE
CONFLICTS" section below).
-<commit>...::
+`<commit>...`::
Commits, usually other branch heads, to merge into our branch.
Specifying more than one commit will create a merge with
more than two parents (affectionately called an Octopus merge).
@@ -152,7 +152,7 @@ To avoid recording unrelated changes in the merge commit,
`git pull` and `git merge` will also abort if there are any changes
registered in the index relative to the `HEAD` commit. (Special
narrow exceptions to this rule may exist depending on which merge
-strategy is in use, but generally, the index must match HEAD.)
+strategy is in use, but generally, the index must match `HEAD`.)
If all named commits are already ancestors of `HEAD`, `git merge`
will exit early with the message "Already up to date."
@@ -195,11 +195,11 @@ happens:
stage 2 from `HEAD`, and stage 3 from `MERGE_HEAD` (you
can inspect the stages with `git ls-files -u`). The working
tree files contain the result of the merge operation; i.e. 3-way
- merge results with familiar conflict markers `<<<` `===` `>>>`.
+ merge results with familiar conflict markers +<<<+ `===` +>>>+.
5. A ref named `AUTO_MERGE` is written, pointing to a tree
corresponding to the current content of the working tree (including
conflict markers for textual conflicts). Note that this ref is only
- written when the 'ort' merge strategy is used (the default).
+ written when the `ort` merge strategy is used (the default).
6. No other changes are made. In particular, the local
modifications you had before you started merge will stay the
same and the index entries for them stay as they were,
@@ -231,7 +231,6 @@ git merge v1.2.3^0
git merge --ff-only v1.2.3
----
-
HOW CONFLICTS ARE PRESENTED
---------------------------
@@ -260,7 +259,7 @@ And here is another line that is cleanly resolved or unmodified.
------------
The area where a pair of conflicting changes happened is marked with markers
-`<<<<<<<`, `=======`, and `>>>>>>>`. The part before the `=======`
++<<<<<<<+, `=======`, and +>>>>>>>+. The part before the `=======`
is typically your side, and the part afterwards is typically their side.
The default format does not show what the original said in the conflicting
@@ -270,7 +269,7 @@ side wants to say it is hard and you'd prefer to go shopping, while the
other side wants to claim it is easy.
An alternative style can be used by setting the `merge.conflictStyle`
-configuration variable to either "diff3" or "zdiff3". In "diff3"
+configuration variable to either `diff3` or `zdiff3`. In `diff3`
style, the above conflict may look like this:
------------
@@ -290,7 +289,7 @@ Git makes conflict resolution easy.
And here is another line that is cleanly resolved or unmodified.
------------
-while in "zdiff3" style, it may look like this:
+while in `zdiff3` style, it may look like this:
------------
Here are lines that are either unchanged from the common
@@ -308,8 +307,8 @@ Git makes conflict resolution easy.
And here is another line that is cleanly resolved or unmodified.
------------
-In addition to the `<<<<<<<`, `=======`, and `>>>>>>>` markers, it uses
-another `|||||||` marker that is followed by the original text. You can
+In addition to the +<<<<<<<+, `=======`, and +>>>>>>>+ markers, it uses
+another +|||||||+ marker that is followed by the original text. You can
tell that the original just stated a fact, and your side simply gave in to
that statement and gave up, while the other side tried to have a more
positive attitude. You can sometimes come up with a better resolution by
@@ -390,8 +389,8 @@ include::merge-strategies.adoc[]
CONFIGURATION
-------------
-branch.<name>.mergeOptions::
- Sets default options for merging into branch <name>. The syntax and
+`branch.<name>.mergeOptions`::
+ Sets default options for merging into branch _<name>_. The syntax and
supported options are the same as those of `git merge`, but option
values containing whitespace characters are currently not supported.
diff --git a/Documentation/git-mergetool.adoc b/Documentation/git-mergetool.adoc
index 046c3258f0..77d0b50550 100644
--- a/Documentation/git-mergetool.adoc
+++ b/Documentation/git-mergetool.adoc
@@ -7,95 +7,95 @@ git-mergetool - Run merge conflict resolution tools to resolve merge conflicts
SYNOPSIS
--------
-[verse]
-'git mergetool' [--tool=<tool>] [-y | --[no-]prompt] [<file>...]
+[synopsis]
+git mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>...]
DESCRIPTION
-----------
Use `git mergetool` to run one of several merge utilities to resolve
-merge conflicts. It is typically run after 'git merge'.
+merge conflicts. It is typically run after `git merge`.
If one or more <file> parameters are given, the merge tool program will
be run to resolve differences in each file (skipping those without
conflicts). Specifying a directory will include all unresolved files in
-that path. If no <file> names are specified, 'git mergetool' will run
+that path. If no _<file>_ names are specified, `git mergetool` will run
the merge tool program on every file with merge conflicts.
OPTIONS
-------
--t <tool>::
---tool=<tool>::
- Use the merge resolution program specified by <tool>.
- Valid values include emerge, gvimdiff, kdiff3,
- meld, vimdiff, and tortoisemerge. Run `git mergetool --tool-help`
- for the list of valid <tool> settings.
+`-t <tool>`::
+`--tool=<tool>`::
+ Use the merge resolution program specified by _<tool>_.
+ Valid values include `emerge`, `gvimdiff`, `kdiff3`,
+ `meld`, `vimdiff`, and `tortoisemerge`. Run `git mergetool --tool-help`
+ for the list of valid _<tool>_ settings.
+
-If a merge resolution program is not specified, 'git mergetool'
+If a merge resolution program is not specified, `git mergetool`
will use the configuration variable `merge.tool`. If the
-configuration variable `merge.tool` is not set, 'git mergetool'
+configuration variable `merge.tool` is not set, `git mergetool`
will pick a suitable default.
+
You can explicitly provide a full path to the tool by setting the
configuration variable `mergetool.<tool>.path`. For example, you
can configure the absolute path to kdiff3 by setting
-`mergetool.kdiff3.path`. Otherwise, 'git mergetool' assumes the
-tool is available in PATH.
+`mergetool.kdiff3.path`. Otherwise, `git mergetool` assumes the
+tool is available in `$PATH`.
+
Instead of running one of the known merge tool programs,
-'git mergetool' can be customized to run an alternative program
+`git mergetool` can be customized to run an alternative program
by specifying the command line to invoke in a configuration
variable `mergetool.<tool>.cmd`.
+
-When 'git mergetool' is invoked with this tool (either through the
+When `git mergetool` is invoked with this tool (either through the
`-t` or `--tool` option or the `merge.tool` configuration
-variable), the configured command line will be invoked with `$BASE`
+variable), the configured command line will be invoked with `BASE`
set to the name of a temporary file containing the common base for
-the merge, if available; `$LOCAL` set to the name of a temporary
+the merge, if available; `LOCAL` set to the name of a temporary
file containing the contents of the file on the current branch;
-`$REMOTE` set to the name of a temporary file containing the
-contents of the file to be merged, and `$MERGED` set to the name
+`REMOTE` set to the name of a temporary file containing the
+contents of the file to be merged, and `MERGED` set to the name
of the file to which the merge tool should write the result of the
merge resolution.
+
If the custom merge tool correctly indicates the success of a
merge resolution with its exit code, then the configuration
variable `mergetool.<tool>.trustExitCode` can be set to `true`.
-Otherwise, 'git mergetool' will prompt the user to indicate the
+Otherwise, `git mergetool` will prompt the user to indicate the
success of the resolution after the custom tool has exited.
---tool-help::
+`--tool-help`::
Print a list of merge tools that may be used with `--tool`.
--y::
---no-prompt::
+`-y`::
+`--no-prompt`::
Don't prompt before each invocation of the merge resolution
program.
This is the default if the merge resolution program is
explicitly specified with the `--tool` option or with the
`merge.tool` configuration variable.
---prompt::
+`--prompt`::
Prompt before each invocation of the merge resolution program
to give the user a chance to skip the path.
--g::
---gui::
- When 'git-mergetool' is invoked with the `-g` or `--gui` option,
+`-g`::
+`--gui`::
+ When `git-mergetool` is invoked with the `-g` or `--gui` option,
the default merge tool will be read from the configured
`merge.guitool` variable instead of `merge.tool`. If
`merge.guitool` is not set, we will fallback to the tool
configured under `merge.tool`. This may be autoselected using
the configuration variable `mergetool.guiDefault`.
---no-gui::
+`--no-gui`::
This overrides a previous `-g` or `--gui` setting or
`mergetool.guiDefault` configuration and reads the default merge
tool from the configured `merge.tool` variable.
--O<orderfile>::
+`-O<orderfile>`::
Process files in the order specified in the
- <orderfile>, which has one shell glob pattern per line.
+ _<orderfile>_, which has one shell glob pattern per line.
This overrides the `diff.orderFile` configuration variable
(see linkgit:git-config[1]). To cancel `diff.orderFile`,
use `-O/dev/null`.
diff --git a/Documentation/git-multi-pack-index.adoc b/Documentation/git-multi-pack-index.adoc
index 631d5c7d15..b6cd0d7f85 100644
--- a/Documentation/git-multi-pack-index.adoc
+++ b/Documentation/git-multi-pack-index.adoc
@@ -38,10 +38,13 @@ write::
+
--
--preferred-pack=<pack>::
- Optionally specify the tie-breaking pack used when
- multiple packs contain the same object. `<pack>` must
- contain at least one object. If not given, ties are
- broken in favor of the pack with the lowest mtime.
+ When specified, break ties in favor of this pack when
+ there are additional copies of its objects in other
+ packs. Ties for objects not found in the preferred
+ pack are always resolved in favor of the copy in the
+ pack with the highest mtime. If unspecified, the pack
+ with the lowest mtime is used by default. The
+ preferred pack must have at least one object.
--[no-]bitmap::
Control whether or not a multi-pack bitmap is written.
diff --git a/Documentation/git-notes.adoc b/Documentation/git-notes.adoc
index bcfe3dacd3..46a232ca71 100644
--- a/Documentation/git-notes.adoc
+++ b/Documentation/git-notes.adoc
@@ -87,6 +87,9 @@ In `--stdin` mode, take lines in the format
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.)
++
+`--stdin` cannot be combined with object names given on the command
+line.
`append`::
Append new message(s) given by `-m` or `-F` options to an
@@ -124,6 +127,10 @@ When done, the user can either finalize the merge with
giving zero or one object from the command line, this is
equivalent to specifying an empty note message to
the `edit` subcommand.
++
+In `--stdin` mode, also remove the object names given on standard
+input. In other words, `--stdin` can be combined with object names from
+the command line.
`prune`::
Remove all notes for non-existing/unreachable objects.
@@ -144,26 +151,18 @@ OPTIONS
Use the given note message (instead of prompting).
If multiple `-m` options are given, their values
are concatenated as separate paragraphs.
- 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`.
`-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>`::
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.
+ copy notes between objects.) Implies `--no-stripspace` since
+ the default behavior is to copy the message verbatim.
`-c <object>`::
`--reedit-message=<object>`::
@@ -174,21 +173,34 @@ OPTIONS
Allow an empty note object to be stored. The default behavior is
to automatically remove empty notes.
-`--[no-]separator`::
`--separator=<paragraph-break>`::
+`--separator`::
+`--no-separator`::
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`::
- 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>`::
+`--stripspace`::
+`--no-stripspace`::
+ Clean up whitespace. Specifically (see
+ linkgit:git-stripspace[1]):
++
+--
+- remove trailing whitespace from all lines
+- collapse multiple consecutive empty lines into one empty line
+- remove empty lines from the beginning and end of the input
+- add a missing `\n` to the last line if necessary.
+--
++
+`--stripspace` is the default except for
+`-C`/`--reuse-message`. However, keep in mind that this depends on the
+order of similar options. For example, for `-C <object> -m<message>`,
+`--stripspace` will be used because the default for `-m` overrides the
+previous `-C`. This is a known limitation that may be fixed in the
+future.
+
+`--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
@@ -200,9 +212,7 @@ OPTIONS
object that does not have notes attached to it.
`--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).
+ Only valid for `remove` and `copy`. See the respective subcommands.
`-n`::
`--dry-run`::
diff --git a/Documentation/git-stripspace.adoc b/Documentation/git-stripspace.adoc
index a293327581..37287f211f 100644
--- a/Documentation/git-stripspace.adoc
+++ b/Documentation/git-stripspace.adoc
@@ -37,7 +37,8 @@ OPTIONS
-------
-s::
--strip-comments::
- Skip and remove all lines starting with a comment character (default '#').
+ Skip and remove all lines starting with a comment character
+ (`core.commentChar`, default `#`).
-c::
--comment-lines::
diff --git a/Documentation/git-switch.adoc b/Documentation/git-switch.adoc
index f55315c51e..9f62abf9e2 100644
--- a/Documentation/git-switch.adoc
+++ b/Documentation/git-switch.adoc
@@ -7,11 +7,11 @@ git-switch - Switch branches
SYNOPSIS
--------
-[verse]
-'git switch' [<options>] [--no-guess] <branch>
-'git switch' [<options>] --detach [<start-point>]
-'git switch' [<options>] (-c|-C) <new-branch> [<start-point>]
-'git switch' [<options>] --orphan <new-branch>
+[synopsis]
+git switch [<options>] [--no-guess] <branch>
+git switch [<options>] --detach [<start-point>]
+git switch [<options>] (-c|-C) <new-branch> [<start-point>]
+git switch [<options>] --orphan <new-branch>
DESCRIPTION
-----------
@@ -33,33 +33,33 @@ THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
OPTIONS
-------
-<branch>::
+_<branch>_::
Branch to switch to.
-<new-branch>::
+_<new-branch>_::
Name for the new branch.
-<start-point>::
+_<start-point>_::
The starting point for the new branch. Specifying a
- `<start-point>` allows you to create a branch based on some
- other point in history than where HEAD currently points. (Or,
+ _<start-point>_ allows you to create a branch based on some
+ other point in history than where `HEAD` currently points. (Or,
in the case of `--detach`, allows you to inspect and detach
from some other point.)
+
-You can use the `@{-N}` syntax to refer to the N-th last
-branch/commit switched to using "git switch" or "git checkout"
+You can use the `@{-<N>}` syntax to refer to the _<N>_-th last
+branch/commit switched to using `git switch` or `git checkout`
operation. You may also specify `-` which is synonymous to `@{-1}`.
This is often used to switch quickly between two branches, or to undo
a branch switch by mistake.
+
-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`.
-
--c <new-branch>::
---create <new-branch>::
- Create a new branch named `<new-branch>` starting at
- `<start-point>` before switching to the branch. This is the
+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`.
+
+`-c <new-branch>`::
+`--create <new-branch>`::
+ Create a new branch named _<new-branch>_ starting at
+ _<start-point>_ before switching to the branch. This is the
transactional equivalent of
+
------------
@@ -67,32 +67,32 @@ $ git branch <new-branch>
$ git switch <new-branch>
------------
+
-that is to say, the branch is not reset/created unless "git switch" is
+that is to say, the branch is not reset/created unless `git switch` is
successful (e.g., when the branch is in use in another worktree, not
just the current branch stays the same, but the branch is not reset to
the start-point, either).
--C <new-branch>::
---force-create <new-branch>::
- Similar to `--create` except that if `<new-branch>` already
- exists, it will be reset to `<start-point>`. This is a
+`-C <new-branch>`::
+`--force-create <new-branch>`::
+ Similar to `--create` except that if _<new-branch>_ already
+ exists, it will be reset to _<start-point>_. This is a
convenient shortcut for:
+
------------
-$ git branch -f <new-branch>
-$ git switch <new-branch>
+$ git branch -f _<new-branch>_
+$ git switch _<new-branch>_
------------
--d::
---detach::
+`-d`::
+`--detach`::
Switch to a commit for inspection and discardable
experiments. See the "DETACHED HEAD" section in
linkgit:git-checkout[1] for details.
---guess::
---no-guess::
- If `<branch>` is not found but there does exist a tracking
- branch in exactly one remote (call it `<remote>`) with a
+`--guess`::
+`--no-guess`::
+ If _<branch>_ is not found but there does exist a tracking
+ branch in exactly one remote (call it _<remote>_) with a
matching name, treat as equivalent to
+
------------
@@ -101,9 +101,9 @@ $ git switch -c <branch> --track <remote>/<branch>
+
If the branch exists in multiple remotes and one of them is named by
the `checkout.defaultRemote` configuration variable, we'll use that
-one for the purposes of disambiguation, even if the `<branch>` isn't
+one for the purposes of disambiguation, even if the _<branch>_ isn't
unique across all remotes. Set it to e.g. `checkout.defaultRemote=origin`
-to always checkout remote branches from there if `<branch>` is
+to always checkout remote branches from there if _<branch>_ is
ambiguous but exists on the 'origin' remote. See also
`checkout.defaultRemote` in linkgit:git-config[1].
+
@@ -112,19 +112,19 @@ ambiguous but exists on the 'origin' remote. See also
The default behavior can be set via the `checkout.guess` configuration
variable.
--f::
---force::
+`-f`::
+`--force`::
An alias for `--discard-changes`.
---discard-changes::
+`--discard-changes`::
Proceed even if the index or the working tree differs from
`HEAD`. Both the index and working tree are restored to match
the switching target. If `--recurse-submodules` is specified,
submodule content is also restored to match the switching
target. This is used to throw away local changes.
--m::
---merge::
+`-m`::
+`--merge`::
If you have local modifications to one or more files that are
different between the current branch and the branch to which
you are switching, the command refuses to switch branches in
@@ -138,25 +138,25 @@ paths are left unmerged, and you need to resolve the conflicts
and mark the resolved paths with `git add` (or `git rm` if the merge
should result in deletion of the path).
---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".
+ `merge` (default), `diff3`, and `zdiff3`.
--q::
---quiet::
+`-q`::
+`--quiet`::
Quiet, suppress feedback messages.
---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`.
--t::
---track [direct|inherit]::
+`-t`::
+`--track[ (direct|inherit)]`::
When creating a new branch, set up "upstream" configuration.
`-c` is implied. See `--track` in linkgit:git-branch[1] for
details.
@@ -171,22 +171,22 @@ given name has no slash, or the above guessing results in an empty
name, the guessing is aborted. You can explicitly give a name with
`-c` in such a case.
---no-track::
+`--no-track`::
Do not set up "upstream" configuration, even if the
`branch.autoSetupMerge` configuration variable is true.
---orphan <new-branch>::
- Create a new unborn branch, named `<new-branch>`. All
+`--orphan <new-branch>`::
+ Create a new unborn branch, named _<new-branch>_. All
tracked files are removed.
---ignore-other-worktrees::
+`--ignore-other-worktrees`::
`git switch` refuses when the wanted ref is already
checked out by another worktree. This option makes it check
the ref out anyway. In other words, the ref can be held by
more than one worktree.
---recurse-submodules::
---no-recurse-submodules::
+`--recurse-submodules`::
+`--no-recurse-submodules`::
Using `--recurse-submodules` will update the content of all
active submodules according to the commit recorded in the
superproject. If nothing (or `--no-recurse-submodules`) is
@@ -239,7 +239,7 @@ $ git switch -
------------
You can grow a new branch from any commit. For example, switch to
-"HEAD~3" and create branch "fixup":
+"`HEAD~3`" and create branch "`fixup`":
------------
$ git switch -c fixup HEAD~3
@@ -251,8 +251,8 @@ name:
------------
$ git switch new-topic
-Branch 'new-topic' set up to track remote branch 'new-topic' from 'origin'
-Switched to a new branch 'new-topic'
+Branch `new-topic` set up to track remote branch `new-topic` from `origin`
+Switched to a new branch `new-topic`
------------
To check out commit `HEAD~3` for temporary inspection or experiment
diff --git a/Documentation/merge-options.adoc b/Documentation/merge-options.adoc
index 0022185201..078f4f6157 100644
--- a/Documentation/merge-options.adoc
+++ b/Documentation/merge-options.adoc
@@ -1,23 +1,23 @@
---commit::
---no-commit::
+`--commit`::
+`--no-commit`::
Perform the merge and commit the result. This option can
- be used to override --no-commit.
+ be used to override `--no-commit`.
ifdef::git-pull[]
Only useful when merging.
endif::git-pull[]
+
-With --no-commit perform the merge and stop just before creating
+With `--no-commit` perform the merge and stop just before creating
a merge commit, to give the user a chance to inspect and further
tweak the merge result before committing.
+
Note that fast-forward updates do not create a merge commit and
-therefore there is no way to stop those merges with --no-commit.
+therefore there is no way to stop those merges with `--no-commit`.
Thus, if you want to ensure your branch is not changed or updated
-by the merge command, use --no-ff with --no-commit.
+by the merge command, use `--no-ff` with `--no-commit`.
---edit::
--e::
---no-edit::
+`--edit`::
+`-e`::
+`--no-edit`::
Invoke an editor before committing successful mechanical merge to
further edit the auto-generated merge message, so that the user
can explain and justify the merge. The `--no-edit` option can be
@@ -35,17 +35,17 @@ they run `git merge`. To make it easier to adjust such scripts to the
updated behaviour, the environment variable `GIT_MERGE_AUTOEDIT` can be
set to `no` at the beginning of them.
---cleanup=<mode>::
+`--cleanup=<mode>`::
This option determines how the merge message will be cleaned up before
committing. See linkgit:git-commit[1] for more details. In addition, if
- the '<mode>' is given a value of `scissors`, scissors will be appended
+ the _<mode>_ is given a value of `scissors`, scissors will be appended
to `MERGE_MSG` before being passed on to the commit machinery in the
case of a merge conflict.
ifdef::git-merge[]
---ff::
---no-ff::
---ff-only::
+`--ff`::
+`--no-ff`::
+`--ff-only`::
Specifies how a merge is handled when the merged-in history is
already a descendant of the current history. `--ff` is the
default unless merging an annotated (and possibly signed) tag
@@ -53,13 +53,13 @@ ifdef::git-merge[]
hierarchy, in which case `--no-ff` is assumed.
endif::git-merge[]
ifdef::git-pull[]
---ff-only::
+`--ff-only`::
Only update to the new history if there is no divergent local
history. This is the default when no method for reconciling
divergent histories is provided (via the --rebase=* flags).
---ff::
---no-ff::
+`--ff`::
+`--no-ff`::
When merging rather than rebasing, specifies how a merge is
handled when the merged-in history is already a descendant of
the current history. If merging is requested, `--ff` is the
@@ -81,40 +81,40 @@ With `--ff-only`, resolve the merge as a fast-forward when possible.
When not possible, refuse to merge and exit with a non-zero status.
endif::git-merge[]
--S[<keyid>]::
---gpg-sign[=<keyid>]::
---no-gpg-sign::
- GPG-sign the resulting merge commit. The `keyid` argument is
+`-S[<key-id>]`::
+`--gpg-sign[=<key-id>]`::
+`--no-gpg-sign`::
+ GPG-sign the resulting merge commit. The _<key-id>_ argument 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`.
---log[=<n>]::
---no-log::
+`--log[=<n>]`::
+`--no-log`::
In addition to branch names, populate the log message with
- one-line descriptions from at most <n> actual commits that are being
+ one-line descriptions from at most _<n>_ actual commits that are being
merged. See also linkgit:git-fmt-merge-msg[1].
ifdef::git-pull[]
Only useful when merging.
endif::git-pull[]
+
-With --no-log do not list one-line descriptions from the
+With `--no-log` do not list one-line descriptions from the
actual commits being merged.
include::signoff-option.adoc[]
---stat::
--n::
---no-stat::
+`--stat`::
+`-n`::
+`--no-stat`::
Show a diffstat at the end of the merge. The diffstat is also
controlled by the configuration option merge.stat.
+
-With -n or --no-stat do not show a diffstat at the end of the
+With `-n` or `--no-stat` do not show a diffstat at the end of the
merge.
---squash::
---no-squash::
+`--squash`::
+`--no-squash`::
Produce the working tree and index state as if a real merge
happened (except for the merge information), but do not actually
make a commit, move the `HEAD`, or record `$GIT_DIR/MERGE_HEAD`
@@ -123,16 +123,16 @@ merge.
the current branch whose effect is the same as merging another
branch (or more in case of an octopus).
+
-With --no-squash perform the merge and commit the result. This
-option can be used to override --squash.
+With `--no-squash` perform the merge and commit the result. This
+option can be used to override `--squash`.
+
-With --squash, --commit is not allowed, and will fail.
+With `--squash`, `--commit` is not allowed, and will fail.
ifdef::git-pull[]
+
Only useful when merging.
endif::git-pull[]
---[no-]verify::
+`--[no-]verify`::
By default, the pre-merge and commit-msg hooks are run.
When `--no-verify` is given, these are bypassed.
See also linkgit:githooks[5].
@@ -140,21 +140,21 @@ ifdef::git-pull[]
Only useful when merging.
endif::git-pull[]
--s <strategy>::
---strategy=<strategy>::
+`-s <strategy>`::
+`--strategy=<strategy>`::
Use the given merge strategy; can be supplied more than
once to specify them in the order they should be tried.
If there is no `-s` option, a built-in list of strategies
is used instead (`ort` when merging a single head,
`octopus` otherwise).
--X <option>::
---strategy-option=<option>::
+`-X <option>`::
+`--strategy-option=<option>`::
Pass merge strategy specific option through to the merge
strategy.
---verify-signatures::
---no-verify-signatures::
+`--verify-signatures`::
+`--no-verify-signatures`::
Verify that the tip commit of the side branch being merged is
signed with a valid key, i.e. a key that has a valid uid: in the
default trust model, this means the signing key has been signed by
@@ -165,22 +165,22 @@ ifdef::git-pull[]
Only useful when merging.
endif::git-pull[]
---summary::
---no-summary::
- Synonyms to --stat and --no-stat; these are deprecated and will be
+`--summary`::
+`--no-summary`::
+ Synonyms to `--stat` and `--no-stat`; these are deprecated and will be
removed in the future.
ifndef::git-pull[]
--q::
---quiet::
- Operate quietly. Implies --no-progress.
+`-q`::
+`--quiet`::
+ Operate quietly. Implies `--no-progress`.
--v::
---verbose::
+`-v`::
+`--verbose`::
Be verbose.
---progress::
---no-progress::
+`--progress`::
+`--no-progress`::
Turn progress on/off explicitly. If neither is specified,
progress is shown if standard error is connected to a terminal.
Note that not all merge strategies may support progress
@@ -188,8 +188,8 @@ ifndef::git-pull[]
endif::git-pull[]
---autostash::
---no-autostash::
+`--autostash`::
+`--no-autostash`::
Automatically create a temporary stash entry before the operation
begins, record it in the ref `MERGE_AUTOSTASH`
and apply it after the operation ends. This means
@@ -197,13 +197,13 @@ endif::git-pull[]
with care: the final stash application after a successful
merge might result in non-trivial conflicts.
---allow-unrelated-histories::
+`--allow-unrelated-histories`::
By default, `git merge` command refuses to merge histories
that do not share a common ancestor. This option can be
used to override this safety when merging histories of two
projects that started their lives independently. As that is
a very rare occasion, no configuration variable to enable
- this by default exists and will not be added.
+ this by default exists or will be added.
ifdef::git-pull[]
+
Only useful when merging.
diff --git a/Documentation/merge-strategies.adoc b/Documentation/merge-strategies.adoc
index 9e034f447e..2ba43f84e7 100644
--- a/Documentation/merge-strategies.adoc
+++ b/Documentation/merge-strategies.adoc
@@ -6,7 +6,7 @@ backend 'merge strategies' to be chosen with `-s` option. Some strategies
can also take their own options, which can be passed by giving `-X<option>`
arguments to `git merge` and/or `git pull`.
-ort::
+`ort`::
This is the default merge strategy when pulling or merging one
branch. This strategy can only resolve two heads using a
3-way merge algorithm. When there is more than one common
@@ -29,26 +29,26 @@ descendant. Otherwise, Git will treat this case as a conflict, suggesting
as a resolution a submodule commit that is descendant of the conflicting
ones, if one exists.
+
-The 'ort' strategy can take the following options:
+The `ort` strategy can take the following options:
-ours;;
+`ours`;;
This option forces conflicting hunks to be auto-resolved cleanly by
favoring 'our' version. Changes from the other tree that do not
conflict with our side are reflected in the merge result.
For a binary file, the entire contents are taken from our side.
+
-This should not be confused with the 'ours' merge strategy, which does not
+This should not be confused with the `ours` merge strategy, which does not
even look at what the other tree contains at all. It discards everything
the other tree did, declaring 'our' history contains all that happened in it.
-theirs;;
- This is the opposite of 'ours'; note that, unlike 'ours', there is
- no 'theirs' merge strategy to confuse this merge option with.
+`theirs`;;
+ This is the opposite of `ours`; note that, unlike `ours`, there is
+ no `theirs` merge strategy to confuse this merge option with.
-ignore-space-change;;
-ignore-all-space;;
-ignore-space-at-eol;;
-ignore-cr-at-eol;;
+`ignore-space-change`;;
+`ignore-all-space`;;
+`ignore-space-at-eol`;;
+`ignore-cr-at-eol`;;
Treats lines with the indicated type of whitespace change as
unchanged for the sake of a three-way merge. Whitespace
changes mixed with other changes to a line are not ignored.
@@ -61,7 +61,7 @@ ignore-cr-at-eol;;
version includes a substantial change, 'their' version is used;
* Otherwise, the merge proceeds in the usual way.
-renormalize;;
+`renormalize`;;
This runs a virtual check-out and check-in of all three stages
of any file which needs a three-way merge. This option is
meant to be used when merging branches with different clean
@@ -69,31 +69,31 @@ renormalize;;
branches with differing checkin/checkout attributes" in
linkgit:gitattributes[5] for details.
-no-renormalize;;
+`no-renormalize`;;
Disables the `renormalize` option. This overrides the
`merge.renormalize` configuration variable.
-find-renames[=<n>];;
+`find-renames[=<n>]`;;
Turn on rename detection, optionally setting the similarity
threshold. This is the default. This overrides the
- 'merge.renames' configuration variable.
+ `merge.renames` configuration variable.
See also linkgit:git-diff[1] `--find-renames`.
-rename-threshold=<n>;;
+`rename-threshold=<n>`;;
Deprecated synonym for `find-renames=<n>`.
-no-renames;;
+`no-renames`;;
Turn off rename detection. This overrides the `merge.renames`
configuration variable.
See also linkgit:git-diff[1] `--no-renames`.
-histogram;;
+`histogram`;;
Deprecated synonym for `diff-algorithm=histogram`.
-patience;;
+`patience`;;
Deprecated synonym for `diff-algorithm=patience`.
-diff-algorithm=[histogram|minimal|myers|patience];;
+`diff-algorithm=(histogram|minimal|myers|patience)`;;
Use a different diff algorithm while merging, which can help
avoid mismerges that occur due to unimportant matching lines
(such as braces from distinct functions). See also
@@ -101,49 +101,49 @@ diff-algorithm=[histogram|minimal|myers|patience];;
defaults to `diff-algorithm=histogram`, while regular diffs
currently default to the `diff.algorithm` config setting.
-subtree[=<path>];;
+`subtree[=<path>]`;;
This option is a more advanced form of 'subtree' strategy, where
the strategy makes a guess on how two trees must be shifted to
match with each other when merging. Instead, the specified path
is prefixed (or stripped from the beginning) to make the shape of
two trees to match.
-recursive::
+`recursive`::
This is now a synonym for `ort`. It was an alternative
implementation until v2.49.0, but was redirected to mean `ort`
in v2.50.0. The previous recursive strategy was the default
strategy for resolving two heads from Git v0.99.9k until
v2.33.0.
-resolve::
+`resolve`::
This can only resolve two heads (i.e. the current branch
and another branch you pulled from) using a 3-way merge
algorithm. It tries to carefully detect criss-cross
merge ambiguities. It does not handle renames.
-octopus::
+`octopus`::
This resolves cases with more than two heads, but refuses to do
a complex merge that needs manual resolution. It is
primarily meant to be used for bundling topic branch
heads together. This is the default merge strategy when
pulling or merging more than one branch.
-ours::
+`ours`::
This resolves any number of heads, but the resulting tree of the
merge is always that of the current branch head, effectively
ignoring all changes from all other branches. It is meant to
be used to supersede old development history of side
- branches. Note that this is different from the -Xours option to
- the 'ort' merge strategy.
+ branches. Note that this is different from the `-Xours` option to
+ the `ort` merge strategy.
-subtree::
+`subtree`::
This is a modified `ort` strategy. When merging trees A and
B, if B corresponds to a subtree of A, B is first adjusted to
match the tree structure of A, instead of reading the trees at
the same level. This adjustment is also done to the common
ancestor tree.
-With the strategies that use 3-way merge (including the default, 'ort'),
+With the strategies that use 3-way merge (including the default, `ort`),
if a change is made on both branches, but later reverted on one of the
branches, that change will be present in the merged result; some people find
this behavior confusing. It occurs because only the heads and the merge base
diff --git a/Documentation/mergetools/vimdiff.adoc b/Documentation/mergetools/vimdiff.adoc
index ab915df408..abfd426f74 100644
--- a/Documentation/mergetools/vimdiff.adoc
+++ b/Documentation/mergetools/vimdiff.adoc
@@ -183,13 +183,13 @@ latter will be used as fallback if the variant-specific one is not set).
In addition, for backwards compatibility with previous Git versions, you can
also append `1`, `2` or `3` to either `vimdiff` or any of the variants (ex:
`vimdiff3`, `nvimdiff1`, etc...) to use a predefined layout.
-In other words, using `--tool=[g,n,]vimdiffx` is the same as using
-`--tool=[g,n,]vimdiff` and setting configuration variable
-`mergetool.[g,n,]vimdiff.layout` to...
+In other words, using `--tool=[g|n]vimdiff<x>` is the same as using
+`--tool=[g|n]vimdiff` and setting configuration variable
+`mergetool.[g|n]vimdiff.layout` to...
- * `x=1`: `"@LOCAL, REMOTE"`
- * `x=2`: `"LOCAL, MERGED, REMOTE"`
- * `x=3`: `"MERGED"`
+ * `<x>=1`: `"@LOCAL, REMOTE"`
+ * `<x>=2`: `"LOCAL, MERGED, REMOTE"`
+ * `<x>=3`: `"MERGED"`
-Example: using `--tool=gvimdiff2` will open `gvim` with three columns (LOCAL,
-MERGED and REMOTE).
+Example: using `--tool=gvimdiff2` will open `gvim` with three columns (`LOCAL`,
+`MERGED` and `REMOTE`).
diff --git a/Documentation/rerere-options.adoc b/Documentation/rerere-options.adoc
index c3321ddea2..b0b920144a 100644
--- a/Documentation/rerere-options.adoc
+++ b/Documentation/rerere-options.adoc
@@ -1,5 +1,5 @@
---rerere-autoupdate::
---no-rerere-autoupdate::
+`--rerere-autoupdate`::
+`--no-rerere-autoupdate`::
After the rerere mechanism reuses a recorded resolution on
the current conflict to update the files in the working
tree, allow it to also update the index with the result of
diff --git a/Documentation/technical/sparse-checkout.adoc b/Documentation/technical/sparse-checkout.adoc
index dc2e763bbe..8202172b70 100644
--- a/Documentation/technical/sparse-checkout.adoc
+++ b/Documentation/technical/sparse-checkout.adoc
@@ -66,7 +66,7 @@ sparsity patterns: patterns from $GIT_DIR/info/sparse-checkout used to
reasons: (1) users in cone mode specify directories rather than
patterns (their directories are transformed into patterns, but
users may think you are talking about non-cone mode if you use the
- word "patterns"), and (b) the sparse specification might
+ word "patterns"), and (2) the sparse specification might
transiently differ in the working tree or index from the sparsity
patterns (see "Sparse specification vs. sparsity patterns").
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index cea2a13401..208e91a17f 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,6 @@
#!/bin/sh
-DEF_VER=v2.50.0-rc0
+DEF_VER=v2.50.0-rc2
LF='
'
diff --git a/apply.c b/apply.c
index 381d2e3652..8bbe6ed224 100644
--- a/apply.c
+++ b/apply.c
@@ -2219,7 +2219,7 @@ static void reverse_patches(struct patch *p)
struct fragment *frag = p->fragments;
SWAP(p->new_name, p->old_name);
- if (p->new_mode)
+ if (p->new_mode || p->is_delete)
SWAP(p->new_mode, p->old_mode);
SWAP(p->is_new, p->is_delete);
SWAP(p->lines_added, p->lines_deleted);
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 37c01d6c6f..fcf6b00d5f 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -39,7 +39,7 @@ enum sign_mode { SIGN_ABORT, SIGN_VERBATIM, SIGN_STRIP, SIGN_WARN_VERBATIM, SIGN
static int progress;
static enum sign_mode signed_tag_mode = SIGN_ABORT;
-static enum sign_mode signed_commit_mode = SIGN_ABORT;
+static enum sign_mode signed_commit_mode = SIGN_STRIP;
static enum tag_of_filtered_mode { TAG_FILTERING_ABORT, DROP, REWRITE } tag_of_filtered_mode = TAG_FILTERING_ABORT;
static enum reencode_mode { REENCODE_ABORT, REENCODE_YES, REENCODE_NO } reencode_mode = REENCODE_ABORT;
static int fake_missing_tagger;
@@ -1269,7 +1269,6 @@ int cmd_fast_export(int argc,
const char *prefix,
struct repository *repo UNUSED)
{
- const char *env_signed_commits_noabort;
struct rev_info revs;
struct commit *commit;
char *export_filename = NULL,
@@ -1327,10 +1326,6 @@ int cmd_fast_export(int argc,
if (argc == 1)
usage_with_options (fast_export_usage, options);
- env_signed_commits_noabort = getenv("FAST_EXPORT_SIGNED_COMMITS_NOABORT");
- if (env_signed_commits_noabort && *env_signed_commits_noabort)
- signed_commit_mode = SIGN_WARN_STRIP;
-
/* we handle encodings */
git_config(git_default_config, NULL);
diff --git a/builtin/gc.c b/builtin/gc.c
index e33ba946e4..7dc94f243d 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -516,7 +516,7 @@ static uint64_t total_ram(void)
total *= (uint64_t)si.mem_unit;
return total;
}
-#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM))
+#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM) || defined(HW_PHYSMEM64))
int64_t physical_memory;
int mib[2];
size_t length;
@@ -524,6 +524,8 @@ static uint64_t total_ram(void)
mib[0] = CTL_HW;
# if defined(HW_MEMSIZE)
mib[1] = HW_MEMSIZE;
+# elif defined(HW_PHYSMEM64)
+ mib[1] = HW_PHYSMEM64;
# else
mib[1] = HW_PHYSMEM;
# endif
diff --git a/compat/posix.h b/compat/posix.h
index f4c71f9427..067a00f33b 100644
--- a/compat/posix.h
+++ b/compat/posix.h
@@ -60,11 +60,11 @@
# else
# define _XOPEN_SOURCE 500
# endif
-#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
- !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
- !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \
- !defined(__CYGWIN__)
-#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
+#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
+ !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__MirBSD__) && \
+ !defined(__USLC__) && !defined(_M_UNIX) && !defined(__sgi) && \
+ !defined(__TANDEM) && !defined(__QNX__) && !defined(__CYGWIN__)
+#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500 */
#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
#endif
#define _ALL_SOURCE 1
diff --git a/config.mak.uname b/config.mak.uname
index 7fc2c5bf8d..3e26bb074a 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -301,17 +301,14 @@ ifeq ($(uname_S),FreeBSD)
FILENO_IS_A_MACRO = UnfortunatelyYes
endif
ifeq ($(uname_S),OpenBSD)
- NO_STRCASESTR = YesPlease
- NO_MEMMEM = YesPlease
+ DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
USE_ST_TIMESPEC = YesPlease
NEEDS_LIBICONV = YesPlease
BASIC_CFLAGS += -I/usr/local/include
BASIC_LDFLAGS += -L/usr/local/lib
HAVE_PATHS_H = YesPlease
HAVE_BSD_SYSCTL = YesPlease
- HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
CSPRNG_METHOD = arc4random
- PROCFS_EXECUTABLE_PATH = /proc/curproc/file
FREAD_READS_DIRECTORIES = UnfortunatelyYes
FILENO_IS_A_MACRO = UnfortunatelyYes
endif
diff --git a/generate-configlist.sh b/generate-configlist.sh
index b06da53c89..9d2ad6165d 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -19,7 +19,6 @@ EOF
s/::$//;
s/`//g;
s/^.*$/ "&",/;
- s/, */",\n "/g;
p;};
d' \
"$SOURCE_DIR"/Documentation/*config.adoc \
diff --git a/git-compat-util.h b/git-compat-util.h
index 36b9577c8d..4678e21c4c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -668,6 +668,22 @@ static inline int cast_size_t_to_int(size_t a)
return (int)a;
}
+static inline uint64_t u64_mult(uint64_t a, uint64_t b)
+{
+ if (unsigned_mult_overflows(a, b))
+ die("uint64_t overflow: %"PRIuMAX" * %"PRIuMAX,
+ (uintmax_t)a, (uintmax_t)b);
+ return a * b;
+}
+
+static inline uint64_t u64_add(uint64_t a, uint64_t b)
+{
+ if (unsigned_add_overflows(a, b))
+ die("uint64_t overflow: %"PRIuMAX" + %"PRIuMAX,
+ (uintmax_t)a, (uintmax_t)b);
+ return a + b;
+}
+
/*
* Limit size of IO chunks, because huge chunks only cause pain. OS X
* 64-bit is buggy, returning EINVAL if len >= INT_MAX; and even in
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index a4e1bad33c..d8d5422cbc 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -4986,13 +4986,13 @@ sub gethistorydense
return $result;
}
-=head2 escapeRefName
+=head2 unescapeRefName
-Apply an escape mechanism to compensate for characters that
+Undo an escape mechanism to compensate for characters that
git ref names can have that CVS tags can not.
=cut
-sub escapeRefName
+sub unescapeRefName
{
my($self,$refName)=@_;
@@ -5009,27 +5009,6 @@ sub escapeRefName
# = "_-xx-" Where "xx" is the hexadecimal representation of the
# desired ASCII character byte. (for anything else)
- if(! $refName=~/^[1-9][0-9]*(\.[1-9][0-9]*)*$/)
- {
- $refName=~s/_-/_-u--/g;
- $refName=~s/\./_-p-/g;
- $refName=~s%/%_-s-%g;
- $refName=~s/[^-_a-zA-Z0-9]/sprintf("_-%02x-",$1)/eg;
- }
-}
-
-=head2 unescapeRefName
-
-Undo an escape mechanism to compensate for characters that
-git ref names can have that CVS tags can not.
-
-=cut
-sub unescapeRefName
-{
- my($self,$refName)=@_;
-
- # see escapeRefName() for description of escape mechanism.
-
$refName=~s/_-([spu]|[0-9a-f][0-9a-f])-/unescapeRefNameChar($1)/eg;
# allowed tag names
diff --git a/git-gui/.gitattributes b/git-gui/.gitattributes
index 118d56cfbd..889d58257f 100644
--- a/git-gui/.gitattributes
+++ b/git-gui/.gitattributes
@@ -4,3 +4,4 @@ git-gui.sh encoding=UTF-8
/po/*.po encoding=UTF-8
/GIT-VERSION-GEN eol=lf
Makefile whitespace=!indent,trail,space
+meson.build whitespace=space
diff --git a/git-gui/.gitignore b/git-gui/.gitignore
index 6483b21cbf..ff6e0be4b4 100644
--- a/git-gui/.gitignore
+++ b/git-gui/.gitignore
@@ -2,7 +2,7 @@
config.mak
Git Gui.app*
git-gui.tcl
+GIT-GUI-BUILD-OPTIONS
GIT-VERSION-FILE
-GIT-GUI-VARS
git-gui
lib/tclIndex
diff --git a/git-gui/GIT-GUI-BUILD-OPTIONS.in b/git-gui/GIT-GUI-BUILD-OPTIONS.in
new file mode 100644
index 0000000000..5fd885c2bf
--- /dev/null
+++ b/git-gui/GIT-GUI-BUILD-OPTIONS.in
@@ -0,0 +1,7 @@
+GITGUI_GITEXECDIR=@GITGUI_GITEXECDIR@
+GITGUI_LIBDIR=@GITGUI_LIBDIR@
+GITGUI_RELATIVE=@GITGUI_RELATIVE@
+SHELL_PATH=@SHELL_PATH@
+TCLTK_PATH=@TCLTK_PATH@
+TCL_PATH=@TCL_PATH@
+TKEXECUTABLE=@TKEXECUTABLE@
diff --git a/git-gui/GIT-VERSION-GEN b/git-gui/GIT-VERSION-GEN
index 92373d251a..c2767b4136 100755
--- a/git-gui/GIT-VERSION-GEN
+++ b/git-gui/GIT-VERSION-GEN
@@ -1,19 +1,33 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=0.21.GITGUI
LF='
'
+if test "$#" -ne 2
+then
+ echo >&2 "usage: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+# 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
+
tree_search ()
{
head=$1
tree=$2
- for p in $(git rev-list --parents --max-count=1 $head 2>/dev/null)
+ for p in $(git -C "$SOURCE_DIR" rev-list --parents --max-count=1 $head 2>/dev/null)
do
- test $tree = $(git rev-parse $p^{tree} 2>/dev/null) &&
- vn=$(git describe --abbrev=4 $p 2>/dev/null) &&
+ test $tree = $(git -C "$SOURCE_DIR" rev-parse $p^{tree} 2>/dev/null) &&
+ vn=$(git -C "$SOURCE_DIR" describe --abbrev=4 $p 2>/dev/null) &&
case "$vn" in
gitgui-[0-9]*) echo $vn; break;;
esac
@@ -34,14 +48,14 @@ tree_search ()
# If we are at the toplevel or the merge assumption fails
# try looking for a gitgui-* tag.
-if test -f version &&
- VN=$(cat version)
+if test -f "$SOURCE_DIR"/version &&
+ VN=$(cat "$SOURCE_DIR"/version)
then
: happy
-elif prefix="$(git rev-parse --show-prefix 2>/dev/null)"
+elif prefix="$(git -C "$SOURCE_DIR" rev-parse --show-prefix 2>/dev/null)"
test -n "$prefix" &&
- head=$(git rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
- tree=$(git rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
+ head=$(git -C "$SOURCE_DIR" rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
+ tree=$(git -C "$SOURCE_DIR" rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
VN=$(tree_search $head $tree)
case "$VN" in
gitgui-[0-9]*) : happy ;;
@@ -49,7 +63,7 @@ elif prefix="$(git rev-parse --show-prefix 2>/dev/null)"
esac
then
VN=$(echo "$VN" | sed -e 's/^gitgui-//;s/-/./g');
-elif VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
+elif VN=$(git -C "$SOURCE_DIR" describe --abbrev=4 HEAD 2>/dev/null) &&
case "$VN" in
gitgui-[0-9]*) : happy ;;
*) (exit 1) ;;
@@ -60,7 +74,7 @@ else
VN="$DEF_VER"
fi
-dirty=$(sh -c 'git diff-index --name-only HEAD' 2>/dev/null) || dirty=
+dirty=$(git -C "$SOURCE_DIR" diff-index --name-only HEAD 2>/dev/null) || dirty=
case "$dirty" in
'')
;;
@@ -68,13 +82,13 @@ case "$dirty" in
VN="$VN-dirty" ;;
esac
-if test -r $GVF
+if test -r "$OUTPUT"
then
- VC=$(sed -e 's/^GITGUI_VERSION = //' <$GVF)
+ VC=$(sed -e 's/^GITGUI_VERSION=//' <"$OUTPUT")
else
VC=unset
fi
test "$VN" = "$VC" || {
- echo >&2 "GITGUI_VERSION = $VN"
- echo "GITGUI_VERSION = $VN" >$GVF
+ echo >&2 "GITGUI_VERSION=$VN"
+ echo "GITGUI_VERSION=$VN" >"$OUTPUT"
}
diff --git a/git-gui/Makefile b/git-gui/Makefile
index e3b4f324b6..8672dd2d6b 100644
--- a/git-gui/Makefile
+++ b/git-gui/Makefile
@@ -9,10 +9,7 @@ all::
#
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
-ifneq ($(MAKECMDGOALS),clean)
--include GIT-VERSION-FILE
-endif
+ @$(SHELL_PATH) ./GIT-VERSION-GEN . $@
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
@@ -76,7 +73,6 @@ ifndef V
QUIET_INDEX = $(QUIET)echo ' ' INDEX $(dir $@) &&
QUIET_MSGFMT0 = $(QUIET)printf ' MSGFMT %12s ' $@ && v=`
QUIET_MSGFMT1 = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages*//g'
- QUIET_2DEVNULL = 2>/dev/null
INSTALL_D0 = dir=
INSTALL_D1 = && echo ' ' DEST $$dir && $(INSTALL) -d -m 755 "$$dir"
@@ -114,7 +110,8 @@ ifeq ($(uname_S),Darwin)
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
endif
endif
- TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
+ TKEXECUTABLE = $(TKFRAMEWORK)/Contents/MacOS/$(shell basename "$(TKFRAMEWORK)" .app)
+ TKEXECUTABLE_SQ = $(subst ','\'',$(TKEXECUTABLE))
endif
ifeq ($(findstring $(firstword -$(MAKEFLAGS)),s),s)
@@ -128,21 +125,17 @@ gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH))
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
-TCLTK_PATH_SED = $(subst ','\'',$(subst \,\\,$(TCLTK_PATH)))
gg_libdir ?= $(sharedir)/git-gui/lib
libdir_SQ = $(subst ','\'',$(gg_libdir))
-libdir_SED = $(subst ','\'',$(subst \,\\,$(gg_libdir_sed_in)))
exedir = $(dir $(gitexecdir))share/git-gui/lib
-GITGUI_SCRIPT := $$0
GITGUI_RELATIVE :=
GITGUI_MACOSXAPP :=
ifeq ($(exedir),$(gg_libdir))
GITGUI_RELATIVE := 1
endif
-gg_libdir_sed_in := $(gg_libdir)
ifeq ($(uname_S),Darwin)
ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y)
GITGUI_MACOSXAPP := YesPlease
@@ -159,41 +152,15 @@ endif
ifdef GITGUI_MACOSXAPP
GITGUI_MAIN := git-gui.tcl
-git-gui: GIT-VERSION-FILE GIT-GUI-VARS
- $(QUIET_GEN)rm -f $@ $@+ && \
- echo '#!$(SHELL_PATH_SQ)' >$@+ && \
- echo 'if test "z$$*" = zversion ||' >>$@+ && \
- echo ' test "z$$*" = z--version' >>$@+ && \
- echo then >>$@+ && \
- echo ' 'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
- echo else >>$@+ && \
- echo ' libdir="$${GIT_GUI_LIB_DIR:-$(libdir_SQ)}"' >>$@+ && \
- echo ' 'exec \"'$$libdir/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\" \
- '"$$0" "$$@"' >>$@+ && \
- echo fi >>$@+ && \
- chmod +x $@+ && \
- mv $@+ $@
-
-Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \
+git-gui: generate-macos-wrapper.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
+ $(QUIET_GEN)$(SHELL_PATH) generate-macos-wrapper.sh "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
+
+Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS \
macosx/Info.plist \
macosx/git-gui.icns \
macosx/AppMain.tcl \
- $(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)
- $(QUIET_GEN)rm -rf '$@' '$@'+ && \
- mkdir -p '$@'+/Contents/MacOS && \
- mkdir -p '$@'+/Contents/Resources/Scripts && \
- cp '$(subst ','\'',$(subst \,,$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)))' \
- '$@'+/Contents/MacOS && \
- cp macosx/git-gui.icns '$@'+/Contents/Resources && \
- sed -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
- -e 's/@@GITGUI_TKEXECUTABLE@@/$(TKEXECUTABLE)/g' \
- macosx/Info.plist \
- >'$@'+/Contents/Info.plist && \
- sed -e 's|@@gitexecdir@@|$(gitexecdir_SQ)|' \
- -e 's|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \
- macosx/AppMain.tcl \
- >'$@'+/Contents/Resources/Scripts/AppMain.tcl && \
- mv '$@'+ '$@'
+ $(TKEXECUTABLE)
+ $(QUIET_GEN)$(SHELL_PATH) generate-macos-app.sh . "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
endif
ifdef GITGUI_WINDOWS_WRAPPER
@@ -203,18 +170,8 @@ git-gui: windows/git-gui.sh
cp $< $@
endif
-$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS
- $(QUIET_GEN)rm -f $@ $@+ && \
- sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
- -e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \
- -e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
- -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
- -e 's|@@GITGUI_RELATIVE@@|$(GITGUI_RELATIVE)|' \
- -e '$(GITGUI_RELATIVE)s|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \
- git-gui.sh >$@+ && \
- chmod +x $@+ && \
- mv $@+ $@
+$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
+ $(QUIET_GEN)$(SHELL_PATH) generate-git-gui.sh "$<" "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
XGETTEXT ?= xgettext
ifdef NO_MSGFMT
@@ -239,35 +196,21 @@ update-po:: $(PO_TEMPLATE)
$(ALL_MSGFILES): %.msg : %.po
$(QUIET_MSGFMT0)$(MSGFMT) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $< $(QUIET_MSGFMT1)
-lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
- $(QUIET_INDEX)if echo \
- $(foreach p,$(PRELOAD_FILES),source $p\;) \
- auto_mkindex lib $(patsubst lib/%,%,$(sort $(ALL_LIBFILES))) \
- | $(TCL_PATH) $(QUIET_2DEVNULL); then : ok; \
- else \
- echo >&2 " * $(TCL_PATH) failed; using unoptimized loading"; \
- rm -f $@ ; \
- echo '# Autogenerated by git-gui Makefile' >$@ && \
- echo >>$@ && \
- $(foreach p,$(PRELOAD_FILES) $(sort $(ALL_LIBFILES)),echo '$(subst lib/,,$p)' >>$@ &&) \
- echo >>$@ ; \
- fi
-
-TRACK_VARS = \
- $(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \
- $(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \
- $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \
- $(subst ','\'',gitexecdir='$(gitexecdir_SQ)') \
- $(subst ','\'',gg_libdir='$(libdir_SQ)') \
- GITGUI_MACOSXAPP=$(GITGUI_MACOSXAPP) \
-#end TRACK_VARS
-
-GIT-GUI-VARS: FORCE
- @VARS='$(TRACK_VARS)'; \
- if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
- echo >&2 " * new locations or Tcl/Tk interpreter"; \
- echo >$@ "$$VARS"; \
- fi
+lib/tclIndex: $(ALL_LIBFILES) generate-tclindex.sh GIT-GUI-BUILD-OPTIONS
+ $(QUIET_INDEX)$(SHELL_PATH) generate-tclindex.sh . ./GIT-GUI-BUILD-OPTIONS $(ALL_LIBFILES)
+
+GIT-GUI-BUILD-OPTIONS: FORCE
+ @sed \
+ -e 's|@GITGUI_GITEXECDIR@|$(gitexecdir_SQ)|' \
+ -e 's|@GITGUI_LIBDIR@|$(libdir_SQ)|' \
+ -e 's|@GITGUI_RELATIVE@|$(GITGUI_RELATIVE)|' \
+ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
+ -e 's|@TCLTK_PATH@|$(TCLTK_PATH_SQ)|' \
+ -e 's|@TCL_PATH@|$(TCL_PATH_SQ)|' \
+ -e 's|@TKEXECUTABLE@|$(TKEXECUTABLE_SQ)|' \
+ $@.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
ifdef GITGUI_MACOSXAPP
all:: git-gui Git\ Gui.app
@@ -317,13 +260,13 @@ endif
$(QUIET)$(REMOVE_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(REMOVE_D1)
$(QUIET)$(REMOVE_D0)`dirname '$(DESTDIR_SQ)$(libdir_SQ)'` $(REMOVE_D1)
-dist-version:
+dist-version: GIT-VERSION-FILE
@mkdir -p $(TARDIR)
- @echo $(GITGUI_VERSION) > $(TARDIR)/version
+ @sed 's|^GITGUI_VERSION=||' <GIT-VERSION-FILE >$(TARDIR)/version
clean::
$(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg $(PO_TEMPLATE)
- $(RM_RF) GIT-VERSION-FILE GIT-GUI-VARS
+ $(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
ifdef GITGUI_MACOSXAPP
$(RM_RF) 'Git Gui.app'* git-gui
endif
diff --git a/git-gui/generate-git-gui.sh b/git-gui/generate-git-gui.sh
new file mode 100755
index 0000000000..39dfafdc4a
--- /dev/null
+++ b/git-gui/generate-git-gui.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -e
+
+if test "$#" -ne 4
+then
+ echo >&2 "usage: $0 <INPUT> <OUTPUT> <BUILD_OPTIONS> <VERSION_FILE>"
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+VERSION_FILE="$4"
+
+. "${BUILD_OPTIONS}"
+. "${VERSION_FILE}"
+
+rm -f "$OUTPUT" "$OUTPUT+"
+sed \
+ -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@@SHELL_PATH@@|$SHELL_PATH|" \
+ -e "1,30s|^ exec wish | exec '$TCLTK_PATH' |" \
+ -e "s|@@GITGUI_VERSION@@|$GITGUI_VERSION|g" \
+ -e "s|@@GITGUI_RELATIVE@@|$GITGUI_RELATIVE|" \
+ -e "${GITGUI_RELATIVE}s|@@GITGUI_LIBDIR@@|$GITGUI_LIBDIR|" \
+ "$INPUT" >"$OUTPUT"+
+chmod +x "$OUTPUT"+
+mv "$OUTPUT"+ "$OUTPUT"
diff --git a/git-gui/generate-macos-app.sh b/git-gui/generate-macos-app.sh
new file mode 100755
index 0000000000..71b9fa67a4
--- /dev/null
+++ b/git-gui/generate-macos-app.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -e
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+VERSION_FILE="$4"
+
+. "$BUILD_OPTIONS"
+. "$VERSION_FILE"
+
+rm -rf "$OUTPUT" "$OUTPUT+"
+
+mkdir -p "$OUTPUT+/Contents/MacOS"
+mkdir -p "$OUTPUT+/Contents/Resources/Scripts"
+
+cp "$TKEXECUTABLE" "$OUTPUT+/Contents/MacOS"
+cp "$SOURCE_DIR/macosx/git-gui.icns" "$OUTPUT+/Contents/Resources"
+sed \
+ -e "s/@@GITGUI_VERSION@@/$GITGUI_VERSION/g" \
+ -e "s/@@GITGUI_TKEXECUTABLE@@/$(basename "$TKEXECUTABLE")/g" \
+ "$SOURCE_DIR/macosx/Info.plist" \
+ >"$OUTPUT+/Contents/Info.plist"
+sed \
+ -e "s|@@gitexecdir@@|$GITGUI_GITEXECDIR|" \
+ -e "s|@@GITGUI_LIBDIR@@|$GITGUI_LIBDIR|" \
+ "$SOURCE_DIR/macosx/AppMain.tcl" \
+ >"$OUTPUT+/Contents/Resources/Scripts/AppMain.tcl"
+mv "$OUTPUT+" "$OUTPUT"
diff --git a/git-gui/generate-macos-wrapper.sh b/git-gui/generate-macos-wrapper.sh
new file mode 100755
index 0000000000..0304937f41
--- /dev/null
+++ b/git-gui/generate-macos-wrapper.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+if test "$#" -ne 3
+then
+ echo >&2 "usage: $0 <OUTPUT> <BUILD_OPTIONS> <VERSION_FILE>"
+ exit 1
+fi
+
+OUTPUT="$1"
+BUILD_OPTIONS="$2"
+VERSION_FILE="$3"
+
+. "$BUILD_OPTIONS"
+
+rm -f "$OUTPUT" "$OUTPUT+"
+
+(
+ echo "#!$SHELL_PATH"
+ cat "$BUILD_OPTIONS" "$VERSION_FILE"
+ cat <<-'EOF'
+ if test "z$*" = zversion ||
+ test "z$*" = z--version
+ then
+ echo "git-gui version $GITGUI_VERSION"
+ else
+ libdir="${GIT_GUI_LIB_DIR:-$GITGUI_LIBDIR}"
+ exec "$libdir/Git Gui.app/Contents/MacOS/$(basename "$TKEXECUTABLE")" "$0" "$@"
+ fi
+ EOF
+) >"$OUTPUT+"
+
+chmod +x "$OUTPUT+"
+mv "$OUTPUT+" "$OUTPUT"
diff --git a/git-gui/generate-tclindex.sh b/git-gui/generate-tclindex.sh
new file mode 100755
index 0000000000..0b031d8339
--- /dev/null
+++ b/git-gui/generate-tclindex.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+if test "$#" -lt 3
+then
+ echo >&2 "usage: $0 <BUILD_DIR> <BUILD_OPTIONS> <LIBFILE> [<LIBFILE>...]"
+ exit 1
+fi
+
+BUILD_DIR="$1"
+BUILD_OPTIONS="$2"
+shift 2
+LIBFILES="$(echo "$@" | sort | sed 's|lib/||g')"
+
+. "$BUILD_OPTIONS"
+
+cd "$BUILD_DIR"
+
+if {
+ echo "source lib/class.tcl;"
+ echo "auto_mkindex lib $LIBFILES"
+} | "$TCL_PATH"
+then
+ : ok
+else
+ echo >&2 " * $TCL_PATH failed; using unoptimized loading"
+ rm -f lib/tclIndex
+ echo '# Autogenerated by git-gui Makefile' >lib/tclIndex
+ echo >>lib/tclIndex
+ echo "class.tcl" >>lib/tclIndex
+ printf "%s\n" $LIBFILES >>lib/tclIndex
+ echo >>lib/tclIndex
+fi
diff --git a/git-gui/lib/meson.build b/git-gui/lib/meson.build
new file mode 100644
index 0000000000..4b9efab774
--- /dev/null
+++ b/git-gui/lib/meson.build
@@ -0,0 +1,74 @@
+libfiles = [
+ 'about.tcl',
+ 'blame.tcl',
+ 'branch_checkout.tcl',
+ 'branch_create.tcl',
+ 'branch_delete.tcl',
+ 'branch_rename.tcl',
+ 'branch.tcl',
+ 'browser.tcl',
+ 'checkout_op.tcl',
+ 'choose_font.tcl',
+ 'choose_repository.tcl',
+ 'choose_rev.tcl',
+ 'chord.tcl',
+ 'class.tcl',
+ 'commit.tcl',
+ 'console.tcl',
+ 'database.tcl',
+ 'date.tcl',
+ 'diff.tcl',
+ 'encoding.tcl',
+ 'error.tcl',
+ 'index.tcl',
+ 'line.tcl',
+ 'logo.tcl',
+ 'merge.tcl',
+ 'mergetool.tcl',
+ 'option.tcl',
+ 'remote_add.tcl',
+ 'remote_branch_delete.tcl',
+ 'remote.tcl',
+ 'search.tcl',
+ 'shortcut.tcl',
+ 'spellcheck.tcl',
+ 'sshkey.tcl',
+ 'status_bar.tcl',
+ 'themed.tcl',
+ 'tools_dlg.tcl',
+ 'tools.tcl',
+ 'transport.tcl',
+ 'win32.tcl',
+]
+
+nontcl_libfiles = [
+ 'git-gui.ico',
+ 'win32_shortcut.js',
+]
+
+foreach file : libfiles + nontcl_libfiles
+ configure_file(
+ input: file,
+ output: file,
+ copy: true,
+ install: true,
+ install_dir: get_option('datadir') / 'git-gui/lib',
+ )
+endforeach
+
+custom_target(
+ output: 'tclIndex',
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-tclindex.sh',
+ meson.project_build_root(),
+ meson.project_build_root() / 'GIT-GUI-BUILD-OPTIONS',
+ libfiles,
+ ],
+ depend_files: [
+ libfiles,
+ build_options,
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'git-gui/lib',
+)
diff --git a/git-gui/meson.build b/git-gui/meson.build
new file mode 100644
index 0000000000..cdae85e4b9
--- /dev/null
+++ b/git-gui/meson.build
@@ -0,0 +1,148 @@
+project('git-gui',
+ meson_version: '>=0.61.0',
+)
+
+fs = import('fs')
+
+shell = find_program('sh')
+tclsh = find_program('tclsh')
+wish = find_program('wish')
+
+build_options_config = configuration_data()
+if target_machine.system() == 'windows'
+ build_options_config.set('GITGUI_RELATIVE', '1')
+else
+ build_options_config.set('GITGUI_RELATIVE', '')
+endif
+build_options_config.set_quoted('GITGUI_GITEXECDIR', get_option('prefix') / get_option('libexecdir') / 'git-core')
+build_options_config.set_quoted('GITGUI_LIBDIR', get_option('prefix') / get_option('datadir') / 'git-gui/lib')
+build_options_config.set_quoted('SHELL_PATH', fs.as_posix(shell.full_path()))
+build_options_config.set_quoted('TCLTK_PATH', fs.as_posix(wish.full_path()))
+build_options_config.set_quoted('TCL_PATH', fs.as_posix(tclsh.full_path()))
+if target_machine.system() == 'darwin'
+ tkexecutables = [
+ '/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish',
+ '/System/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish',
+ '/System/Library/Frameworks/Tk.framework/Resources/Wish Shell.app/Contents/MacOS/Wish Shell',
+ ]
+ tkexecutable = find_program(tkexecutables)
+ build_options_config.set_quoted('TKEXECUTABLE', tkexecutable.full_path())
+else
+ build_options_config.set('TKEXECUTABLE', '')
+endif
+
+build_options = configure_file(
+ input: 'GIT-GUI-BUILD-OPTIONS.in',
+ output: 'GIT-GUI-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+version_file = custom_target(
+ input: 'GIT-VERSION-GEN',
+ output: 'GIT-VERSION-FILE',
+ command: [
+ shell,
+ '@INPUT@',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ build_always_stale: true,
+)
+
+configure_file(
+ input: 'git-gui--askpass',
+ output: 'git-gui--askpass',
+ copy: true,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+gitgui_main = 'git-gui'
+gitgui_main_install_dir = get_option('libexecdir') / 'git-core'
+
+if target_machine.system() == 'windows'
+ gitgui_main = 'git-gui.tcl'
+
+ configure_file(
+ input: 'windows/git-gui.sh',
+ output: 'git-gui',
+ copy: true,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+elif target_machine.system() == 'darwin'
+ gitgui_main = 'git-gui.tcl'
+ gitgui_main_install_dir = get_option('datadir') / 'git-gui/lib'
+
+ custom_target(
+ output: 'git-gui',
+ command: [
+ shell,
+ meson.current_source_dir() / 'generate-macos-wrapper.sh',
+ '@OUTPUT@',
+ meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
+ meson.current_build_dir() / 'GIT-VERSION-FILE',
+ ],
+ depends: [
+ version_file,
+ ],
+ depend_files: [
+ build_options,
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ custom_target(
+ output: 'Git Gui.app',
+ command: [
+ shell,
+ meson.current_source_dir() / 'generate-macos-app.sh',
+ meson.current_source_dir(),
+ meson.current_build_dir() / 'Git Gui.app',
+ meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
+ meson.current_build_dir() / 'GIT-VERSION-FILE',
+ ],
+ depends: [
+ version_file,
+ ],
+ depend_files: [
+ build_options,
+ 'macosx/AppMain.tcl',
+ 'macosx/Info.plist',
+ 'macosx/git-gui.icns',
+ ],
+ build_by_default: true,
+ install: true,
+ install_dir: get_option('datadir') / 'git-gui/lib',
+ )
+endif
+
+custom_target(
+ input: 'git-gui.sh',
+ output: gitgui_main,
+ command: [
+ shell,
+ meson.current_source_dir() / 'generate-git-gui.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
+ meson.current_build_dir() / 'GIT-VERSION-FILE',
+ ],
+ depends: [
+ version_file,
+ ],
+ depend_files: [
+ build_options,
+ ],
+ install: true,
+ install_dir: gitgui_main_install_dir,
+)
+
+install_symlink('git-citool',
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-gui',
+)
+
+subdir('lib')
+subdir('po')
diff --git a/git-gui/po/meson.build b/git-gui/po/meson.build
new file mode 100644
index 0000000000..00cae74338
--- /dev/null
+++ b/git-gui/po/meson.build
@@ -0,0 +1,38 @@
+languages = [
+ 'bg',
+ 'de',
+ 'el',
+ 'fr',
+ 'hu',
+ 'it',
+ 'ja',
+ 'nb',
+ 'pt_br',
+ 'pt_pt',
+ 'ru',
+ 'sv',
+ 'vi',
+ 'zh_cn',
+]
+
+msgfmt = find_program('msgfmt', required: false)
+if not msgfmt.found()
+ subdir_done()
+endif
+
+foreach language : languages
+ custom_target(
+ input: language + '.po',
+ output: language + '.msg',
+ command: [
+ msgfmt,
+ '--statistics',
+ '--tcl',
+ '--locale=' + language,
+ '-d', meson.current_build_dir(),
+ '@INPUT@',
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'git-gui/lib/msgs',
+ )
+endforeach
diff --git a/gitk-git/Makefile b/gitk-git/Makefile
index 3a3c56c318..cc32dcab4b 100644
--- a/gitk-git/Makefile
+++ b/gitk-git/Makefile
@@ -73,7 +73,7 @@ update-po:: $(PO_TEMPLATE)
$(foreach p, $(ALL_POFILES), echo Updating $p ; msgmerge -U $p $(PO_TEMPLATE) ; )
$(ALL_MSGFILES): %.msg : %.po
@echo Generating catalog $@
- $(MSGFMT) --statistics --tcl $< -l $(basename $(notdir $<)) -d $(dir $@)
+ $(MSGFMT) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $<
.PHONY: all install uninstall clean update-po
.PHONY: FORCE
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 11ad639d06..19689765cd 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -7108,7 +7108,7 @@ proc findselectline {l} {
# mark the bits of a headline or author that match a find string
proc markmatches {canv l str tag matches font row} {
- global selectedline
+ global selectedline foundbgcolor
set bbox [$canv bbox $tag]
set x0 [lindex $bbox 0]
@@ -7122,7 +7122,7 @@ proc markmatches {canv l str tag matches font row} {
set xlen [font measure $font [string range $str 0 [expr {$end}]]]
set t [$canv create rect [expr {$x0+$xoff}] $y0 \
[expr {$x0+$xlen+2}] $y1 \
- -outline {} -tags [list match$l matches] -fill yellow]
+ -outline {} -tags [list match$l matches] -fill $foundbgcolor]
$canv lower $t
if {$row == $selectedline} {
$canv raise $t secsel
@@ -11736,13 +11736,11 @@ proc prefspage_general {notebook} {
grid x $page.tabstopl $page.tabstop -sticky w
${NS}::label $page.wrapcommentl -text [mc "Wrap comment text"]
- ${NS}::combobox $page.wrapcomment -values {none char word} -state readonly \
- -textvariable wrapcomment
+ makedroplist $page.wrapcomment wrapcomment none char word
grid x $page.wrapcommentl $page.wrapcomment -sticky w
${NS}::label $page.wrapdefaultl -text [mc "Wrap other text"]
- ${NS}::combobox $page.wrapdefault -values {none char word} -state readonly \
- -textvariable wrapdefault
+ makedroplist $page.wrapdefault wrapdefault none char word
grid x $page.wrapdefaultl $page.wrapdefault -sticky w
${NS}::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \
diff --git a/http-push.c b/http-push.c
index f9e67cabd4..f5a92529a8 100644
--- a/http-push.c
+++ b/http-push.c
@@ -195,7 +195,7 @@ static char *xml_entities(const char *s)
static void curl_setup_http_get(CURL *curl, const char *url,
const char *custom_req)
{
- curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
+ curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_null);
@@ -205,7 +205,7 @@ static void curl_setup_http(CURL *curl, const char *url,
const char *custom_req, struct buffer *buffer,
curl_write_callback write_fn)
{
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_INFILE, buffer);
curl_easy_setopt(curl, CURLOPT_INFILESIZE, buffer->buf.len);
@@ -213,9 +213,9 @@ static void curl_setup_http(CURL *curl, const char *url,
curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_buffer);
curl_easy_setopt(curl, CURLOPT_SEEKDATA, buffer);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_fn);
- curl_easy_setopt(curl, CURLOPT_NOBODY, 0);
+ curl_easy_setopt(curl, CURLOPT_NOBODY, 0L);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
}
static struct curl_slist *get_dav_token_headers(struct remote_lock *lock, enum dav_header_flag options)
diff --git a/http.c b/http.c
index 3c029cf894..d88e79fbde 100644
--- a/http.c
+++ b/http.c
@@ -1019,13 +1019,13 @@ static CURL *get_curl_handle(void)
die("curl_easy_init failed");
if (!curl_ssl_verify) {
- curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
- curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0L);
+ curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0L);
} else {
/* Verify authenticity of the peer's certificate */
- curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1);
+ curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1L);
/* The name in the cert must match whom we tried to connect */
- curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
+ curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2L);
}
if (curl_http_version) {
@@ -1057,7 +1057,7 @@ static CURL *get_curl_handle(void)
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
!http_schannel_check_revoke) {
- curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
+ curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_NO_REVOKE);
}
if (http_proactive_auth != PROACTIVE_AUTH_NONE)
@@ -1117,8 +1117,8 @@ static CURL *get_curl_handle(void)
curl_low_speed_time);
}
- curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20);
- curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
+ curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20L);
+ curl_easy_setopt(result, CURLOPT_POSTREDIR, (long)CURL_REDIR_POST_ALL);
#ifdef GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR
{
@@ -1151,7 +1151,7 @@ static CURL *get_curl_handle(void)
user_agent ? user_agent : git_user_agent());
if (curl_ftp_no_epsv)
- curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
+ curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0L);
if (curl_ssl_try)
curl_easy_setopt(result, CURLOPT_USE_SSL, CURLUSESSL_TRY);
@@ -1193,18 +1193,18 @@ static CURL *get_curl_handle(void)
if (starts_with(curl_http_proxy, "socks5h"))
curl_easy_setopt(result,
- CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
+ CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5_HOSTNAME);
else if (starts_with(curl_http_proxy, "socks5"))
curl_easy_setopt(result,
- CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
+ CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5);
else if (starts_with(curl_http_proxy, "socks4a"))
curl_easy_setopt(result,
- CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
+ CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4A);
else if (starts_with(curl_http_proxy, "socks"))
curl_easy_setopt(result,
- CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
+ CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4);
else if (starts_with(curl_http_proxy, "https")) {
- curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
+ curl_easy_setopt(result, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTPS);
if (http_proxy_ssl_cert)
curl_easy_setopt(result, CURLOPT_PROXY_SSLCERT, http_proxy_ssl_cert);
@@ -1254,7 +1254,7 @@ static CURL *get_curl_handle(void)
}
init_curl_proxy_auth(result);
- curl_easy_setopt(result, CURLOPT_TCP_KEEPALIVE, 1);
+ curl_easy_setopt(result, CURLOPT_TCP_KEEPALIVE, 1L);
if (curl_tcp_keepidle > -1)
curl_easy_setopt(result, CURLOPT_TCP_KEEPIDLE,
@@ -1540,9 +1540,9 @@ struct active_request_slot *get_active_slot(void)
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, -1L);
- curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
- curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
- curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
+ curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0L);
+ curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1L);
+ curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1L);
curl_easy_setopt(slot->curl, CURLOPT_RANGE, NULL);
/*
@@ -1551,9 +1551,9 @@ struct active_request_slot *get_active_slot(void)
* HTTP_FOLLOW_* cases themselves.
*/
if (http_follow_config == HTTP_FOLLOW_ALWAYS)
- curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1L);
else
- curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0);
+ curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0L);
curl_easy_setopt(slot->curl, CURLOPT_IPRESOLVE, git_curl_ipresolve);
curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
@@ -2120,12 +2120,12 @@ static int http_request(const char *url,
int ret;
slot = get_active_slot();
- curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
+ curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1L);
if (!result) {
- curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1);
+ curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1L);
} else {
- curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
+ curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, result);
if (target == HTTP_REQUEST_FILE) {
@@ -2151,7 +2151,7 @@ static int http_request(const char *url,
strbuf_addstr(&buf, " no-cache");
if (options && options->initial_request &&
http_follow_config == HTTP_FOLLOW_INITIAL)
- curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1L);
headers = curl_slist_append(headers, buf.buf);
@@ -2170,7 +2170,7 @@ static int http_request(const char *url,
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
- curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
+ curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0L);
ret = run_one_slot(slot, &results);
@@ -2750,7 +2750,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
freq->headers = object_request_headers();
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEDATA, freq);
- curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0);
+ curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0L);
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
curl_easy_setopt(freq->slot->curl, CURLOPT_ERRORBUFFER, freq->errorstr);
curl_easy_setopt(freq->slot->curl, CURLOPT_URL, freq->url);
diff --git a/imap-send.c b/imap-send.c
index 27dc033c7f..2e812f5a6e 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1420,7 +1420,7 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
curl_easy_setopt(curl, CURLOPT_URL, path.buf);
strbuf_release(&path);
- curl_easy_setopt(curl, CURLOPT_PORT, srvc->port);
+ curl_easy_setopt(curl, CURLOPT_PORT, (long)srvc->port);
if (srvc->auth_method) {
struct strbuf auth = STRBUF_INIT;
@@ -1433,8 +1433,8 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
if (!srvc->use_ssl)
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_TRY);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, srvc->ssl_verify);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, srvc->ssl_verify);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)srvc->ssl_verify);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, (long)srvc->ssl_verify);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
diff --git a/midx-write.c b/midx-write.c
index dd3b3070e5..ba4a94950a 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -1566,7 +1566,7 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
_("Counting referenced objects"),
m->num_objects);
for (i = 0; i < m->num_objects; i++) {
- int pack_int_id = nth_midxed_pack_int_id(m, i);
+ uint32_t pack_int_id = nth_midxed_pack_int_id(m, i);
count[pack_int_id]++;
display_progress(progress, i + 1);
}
@@ -1697,21 +1697,31 @@ static void fill_included_packs_batch(struct repository *r,
total_size = 0;
for (i = 0; total_size < batch_size && i < m->num_packs; i++) {
- int pack_int_id = pack_info[i].pack_int_id;
+ uint32_t pack_int_id = pack_info[i].pack_int_id;
struct packed_git *p = m->packs[pack_int_id];
- size_t expected_size;
+ uint64_t expected_size;
if (!want_included_pack(r, m, pack_kept_objects, pack_int_id))
continue;
- expected_size = st_mult(p->pack_size,
- pack_info[i].referenced_objects);
+ /*
+ * Use shifted integer arithmetic to calculate the
+ * expected pack size to ~4 significant digits without
+ * overflow for packsizes less that 1PB.
+ */
+ expected_size = (uint64_t)pack_info[i].referenced_objects << 14;
expected_size /= p->num_objects;
+ expected_size = u64_mult(expected_size, p->pack_size);
+ expected_size = u64_add(expected_size, 1u << 13) >> 14;
if (expected_size >= batch_size)
continue;
- total_size += expected_size;
+ if (unsigned_add_overflows(total_size, (size_t)expected_size))
+ total_size = SIZE_MAX;
+ else
+ total_size += expected_size;
+
include_pack[pack_int_id] = 1;
}
diff --git a/midx.c b/midx.c
index 3d0015f782..cd6e766ce2 100644
--- a/midx.c
+++ b/midx.c
@@ -13,6 +13,8 @@
#include "pack-bitmap.h"
#include "pack-revindex.h"
+#define MIDX_PACK_ERROR ((void *)(intptr_t)-1)
+
int midx_checksum_valid(struct multi_pack_index *m);
void clear_midx_files_ext(const char *object_dir, const char *ext,
const char *keep_hash);
@@ -405,7 +407,7 @@ void close_midx(struct multi_pack_index *m)
munmap((unsigned char *)m->data, m->data_len);
for (i = 0; i < m->num_packs; i++) {
- if (m->packs[i])
+ if (m->packs[i] && m->packs[i] != MIDX_PACK_ERROR)
m->packs[i]->multi_pack_index = 0;
}
FREE_AND_NULL(m->packs);
@@ -458,6 +460,8 @@ int prepare_midx_pack(struct repository *r, struct multi_pack_index *m,
pack_int_id = midx_for_pack(&m, pack_int_id);
+ if (m->packs[pack_int_id] == MIDX_PACK_ERROR)
+ return 1;
if (m->packs[pack_int_id])
return 0;
@@ -482,8 +486,10 @@ int prepare_midx_pack(struct repository *r, struct multi_pack_index *m,
strbuf_release(&pack_name);
strbuf_release(&key);
- if (!p)
+ if (!p) {
+ m->packs[pack_int_id] = MIDX_PACK_ERROR;
return 1;
+ }
p->multi_pack_index = 1;
m->packs[pack_int_id] = p;
@@ -495,6 +501,8 @@ struct packed_git *nth_midxed_pack(struct multi_pack_index *m,
uint32_t pack_int_id)
{
uint32_t local_pack_int_id = midx_for_pack(&m, pack_int_id);
+ if (m->packs[local_pack_int_id] == MIDX_PACK_ERROR)
+ return NULL;
return m->packs[local_pack_int_id];
}
diff --git a/name-hash.c b/name-hash.c
index d66de1cdfd..b91e276267 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -492,8 +492,10 @@ static void *lazy_name_thread_proc(void *_data)
for (k = 0; k < d->istate->cache_nr; k++) {
struct cache_entry *ce_k = d->istate->cache[k];
ce_k->ce_flags |= CE_HASHED;
- hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
- hashmap_add(&d->istate->name_hash, &ce_k->ent);
+ if (!S_ISSPARSEDIR(ce_k->ce_mode)) {
+ hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
+ hashmap_add(&d->istate->name_hash, &ce_k->ent);
+ }
}
return NULL;
diff --git a/packfile.c b/packfile.c
index 80e35f1032..70c7208f02 100644
--- a/packfile.c
+++ b/packfile.c
@@ -737,6 +737,17 @@ struct packed_git *add_packed_git(struct repository *r, const char *path,
p = alloc_packed_git(r, alloc);
memcpy(p->pack_name, path, path_len);
+ /*
+ * Note that we have to check auxiliary data structures before we check
+ * for the ".pack" file to exist to avoid races with a packfile that is
+ * in the process of being deleted. The ".pack" file is unlinked before
+ * its auxiliary data structures, so we know that we either get a
+ * consistent snapshot of all data structures or that we'll fail to
+ * stat(3p) the packfile itself and thus return `NULL`.
+ *
+ * As such, we cannot bail out before the access(3p) calls in case the
+ * packfile doesn't exist without doing two stat(3p) calls for it.
+ */
xsnprintf(p->pack_name + path_len, alloc - path_len, ".keep");
if (!access(p->pack_name, F_OK))
p->pack_keep = 1;
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 4d1f65a57a..bf6f89b1d1 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -3762,6 +3762,9 @@ static int files_fsck_refs_dir(struct ref_store *ref_store,
iter = dir_iterator_begin(sb.buf, 0);
if (!iter) {
+ if (errno == ENOENT && !is_main_worktree(wt))
+ goto out;
+
ret = error_errno(_("cannot open directory %s"), sb.buf);
goto out;
}
diff --git a/reftable/basics.h b/reftable/basics.h
index d8888c1262..7d22f96261 100644
--- a/reftable/basics.h
+++ b/reftable/basics.h
@@ -16,7 +16,11 @@
#include "system.h"
#include "reftable-basics.h"
+#ifdef __GNUC__
#define REFTABLE_UNUSED __attribute__((__unused__))
+#else
+#define REFTABLE_UNUSED
+#endif
/*
* Initialize the buffer such that it is ready for use. This is equivalent to
diff --git a/remote-curl.c b/remote-curl.c
index 590b228f67..b8bc3a80cf 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -877,12 +877,12 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
headers = curl_slist_append(headers, rpc->hdr_content_type);
headers = curl_slist_append(headers, rpc->hdr_accept);
- curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
- curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
+ curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
+ curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, NULL);
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, "0000");
- curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
+ curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4L);
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &buf);
@@ -970,8 +970,8 @@ retry:
slot = get_active_slot();
- curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
- curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
+ curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
+ curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
@@ -1058,7 +1058,7 @@ retry:
rpc_in_data.check_pktline = stateless_connect;
memset(&rpc_in_data.pktline_state, 0, sizeof(rpc_in_data.pktline_state));
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &rpc_in_data);
- curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
+ curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0L);
rpc->any_written = 0;
diff --git a/t/t0602-reffiles-fsck.sh b/t/t0602-reffiles-fsck.sh
index f671ac4d3a..0ef483659d 100755
--- a/t/t0602-reffiles-fsck.sh
+++ b/t/t0602-reffiles-fsck.sh
@@ -110,6 +110,25 @@ test_expect_success 'ref name check should be adapted into fsck messages' '
)
'
+test_expect_success 'no refs directory of worktree should not cause problems' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit initial &&
+ git worktree add --detach ./worktree &&
+
+ (
+ cd worktree &&
+ worktree_refdir="$(git rev-parse --git-dir)/refs" &&
+ # Simulate old directory layout
+ rmdir "$worktree_refdir" &&
+ git refs verify 2>err &&
+ test_must_be_empty err
+ )
+ )
+'
+
test_expect_success 'ref name check should work for multiple worktrees' '
test_when_finished "rm -rf repo" &&
git init repo &&
diff --git a/t/t4129-apply-samemode.sh b/t/t4129-apply-samemode.sh
index 2149ad5da4..1d6317bd71 100755
--- a/t/t4129-apply-samemode.sh
+++ b/t/t4129-apply-samemode.sh
@@ -102,15 +102,32 @@ test_expect_success POSIXPERM 'do not use core.sharedRepository for working tree
)
'
+test_file_mode_common () {
+ if test "$1" = "000000"
+ then
+ test_must_be_empty "$2"
+ else
+ test_grep "^$1 " "$2"
+ fi
+}
+
+test_file_mode_staged () {
+ git ls-files --stage -- "$2" >ls-files-output &&
+ test_file_mode_common "$1" ls-files-output
+}
+
+test_file_mode_HEAD () {
+ git ls-tree HEAD -- "$2" >ls-tree-output &&
+ test_file_mode_common "$1" ls-tree-output
+}
+
test_expect_success 'git apply respects core.fileMode' '
test_config core.fileMode false &&
echo true >script.sh &&
git add --chmod=+x script.sh &&
- git ls-files -s script.sh >ls-files-output &&
- test_grep "^100755" ls-files-output &&
+ test_file_mode_staged 100755 script.sh &&
test_tick && git commit -m "Add script" &&
- git ls-tree -r HEAD script.sh >ls-tree-output &&
- test_grep "^100755" ls-tree-output &&
+ test_file_mode_HEAD 100755 script.sh &&
echo true >>script.sh &&
test_tick && git commit -m "Modify script" script.sh &&
@@ -126,7 +143,211 @@ test_expect_success 'git apply respects core.fileMode' '
test_grep ! "has type 100644, expected 100755" err &&
git apply --cached patch 2>err &&
- test_grep ! "has type 100644, expected 100755" err
+ test_grep ! "has type 100644, expected 100755" err &&
+ git reset --hard
+'
+
+test_expect_success 'setup: git apply [--reverse] warns about incorrect file modes' '
+ test_config core.fileMode false &&
+
+ >mode_test &&
+ git add --chmod=-x mode_test &&
+ test_file_mode_staged 100644 mode_test &&
+ test_tick && git commit -m "add mode_test" &&
+ test_file_mode_HEAD 100644 mode_test &&
+ git tag mode_test_forward_initial &&
+
+ echo content >>mode_test &&
+ test_tick && git commit -m "append to mode_test" mode_test &&
+ test_file_mode_HEAD 100644 mode_test &&
+ git tag mode_test_reverse_initial &&
+
+ git format-patch -1 --stdout >patch &&
+ test_grep "^index .* 100644$" patch
+'
+
+test_expect_success 'git apply warns about incorrect file modes' '
+ test_config core.fileMode false &&
+ git reset --hard mode_test_forward_initial &&
+
+ git add --chmod=+x mode_test &&
+ test_file_mode_staged 100755 mode_test &&
+ test_tick && git commit -m "make mode_test executable" &&
+ test_file_mode_HEAD 100755 mode_test &&
+
+ git apply --index patch 2>err &&
+ test_grep "has type 100755, expected 100644" err &&
+ test_file_mode_staged 100755 mode_test &&
+ test_tick && git commit -m "redo: append to mode_test" &&
+ test_file_mode_HEAD 100755 mode_test
+'
+
+test_expect_success 'git apply --reverse warns about incorrect file modes' '
+ test_config core.fileMode false &&
+ git reset --hard mode_test_reverse_initial &&
+
+ git add --chmod=+x mode_test &&
+ test_file_mode_staged 100755 mode_test &&
+ test_tick && git commit -m "make mode_test executable" &&
+ test_file_mode_HEAD 100755 mode_test &&
+
+ git apply --index --reverse patch 2>err &&
+ test_grep "has type 100755, expected 100644" err &&
+ test_file_mode_staged 100755 mode_test &&
+ test_tick && git commit -m "undo: append to mode_test" &&
+ test_file_mode_HEAD 100755 mode_test
+'
+
+test_expect_success 'setup: git apply [--reverse] restores file modes (change_x_to_notx)' '
+ test_config core.fileMode false &&
+
+ touch change_x_to_notx &&
+ git add --chmod=+x change_x_to_notx &&
+ test_file_mode_staged 100755 change_x_to_notx &&
+ test_tick && git commit -m "add change_x_to_notx as executable" &&
+ test_file_mode_HEAD 100755 change_x_to_notx &&
+
+ git add --chmod=-x change_x_to_notx &&
+ test_file_mode_staged 100644 change_x_to_notx &&
+ test_tick && git commit -m "make change_x_to_notx not executable" &&
+ test_file_mode_HEAD 100644 change_x_to_notx &&
+
+ git rm change_x_to_notx &&
+ test_file_mode_staged 000000 change_x_to_notx &&
+ test_tick && git commit -m "remove change_x_to_notx" &&
+ test_file_mode_HEAD 000000 change_x_to_notx &&
+
+ git format-patch -o patches -3 &&
+ mv patches/0001-* change_x_to_notx-0001-create-0755.patch &&
+ mv patches/0002-* change_x_to_notx-0002-chmod-0644.patch &&
+ mv patches/0003-* change_x_to_notx-0003-delete.patch &&
+
+ test_grep "^new file mode 100755$" change_x_to_notx-0001-create-0755.patch &&
+ test_grep "^old mode 100755$" change_x_to_notx-0002-chmod-0644.patch &&
+ test_grep "^new mode 100644$" change_x_to_notx-0002-chmod-0644.patch &&
+ test_grep "^deleted file mode 100644$" change_x_to_notx-0003-delete.patch &&
+
+ git tag change_x_to_notx_initial
+'
+
+test_expect_success 'git apply restores file modes (change_x_to_notx)' '
+ test_config core.fileMode false &&
+ git reset --hard change_x_to_notx_initial &&
+
+ git apply --index change_x_to_notx-0001-create-0755.patch &&
+ test_file_mode_staged 100755 change_x_to_notx &&
+ test_tick && git commit -m "redo: add change_x_to_notx as executable" &&
+ test_file_mode_HEAD 100755 change_x_to_notx &&
+
+ git apply --index change_x_to_notx-0002-chmod-0644.patch 2>err &&
+ test_grep ! "has type 100.*, expected 100.*" err &&
+ test_file_mode_staged 100644 change_x_to_notx &&
+ test_tick && git commit -m "redo: make change_x_to_notx not executable" &&
+ test_file_mode_HEAD 100644 change_x_to_notx &&
+
+ git apply --index change_x_to_notx-0003-delete.patch 2>err &&
+ test_grep ! "has type 100.*, expected 100.*" err &&
+ test_file_mode_staged 000000 change_x_to_notx &&
+ test_tick && git commit -m "redo: remove change_notx_to_x" &&
+ test_file_mode_HEAD 000000 change_x_to_notx
+'
+
+test_expect_success 'git apply --reverse restores file modes (change_x_to_notx)' '
+ test_config core.fileMode false &&
+ git reset --hard change_x_to_notx_initial &&
+
+ git apply --index --reverse change_x_to_notx-0003-delete.patch &&
+ test_file_mode_staged 100644 change_x_to_notx &&
+ test_tick && git commit -m "undo: remove change_x_to_notx" &&
+ test_file_mode_HEAD 100644 change_x_to_notx &&
+
+ git apply --index --reverse change_x_to_notx-0002-chmod-0644.patch 2>err &&
+ test_grep ! "has type 100.*, expected 100.*" err &&
+ test_file_mode_staged 100755 change_x_to_notx &&
+ test_tick && git commit -m "undo: make change_x_to_notx not executable" &&
+ test_file_mode_HEAD 100755 change_x_to_notx &&
+
+ git apply --index --reverse change_x_to_notx-0001-create-0755.patch 2>err &&
+ test_grep ! "has type 100.*, expected 100.*" err &&
+ test_file_mode_staged 000000 change_x_to_notx &&
+ test_tick && git commit -m "undo: add change_x_to_notx as executable" &&
+ test_file_mode_HEAD 000000 change_x_to_notx
+'
+
+test_expect_success 'setup: git apply [--reverse] restores file modes (change_notx_to_x)' '
+ test_config core.fileMode false &&
+
+ touch change_notx_to_x &&
+ git add --chmod=-x change_notx_to_x &&
+ test_file_mode_staged 100644 change_notx_to_x &&
+ test_tick && git commit -m "add change_notx_to_x as not executable" &&
+ test_file_mode_HEAD 100644 change_notx_to_x &&
+
+ git add --chmod=+x change_notx_to_x &&
+ test_file_mode_staged 100755 change_notx_to_x &&
+ test_tick && git commit -m "make change_notx_to_x executable" &&
+ test_file_mode_HEAD 100755 change_notx_to_x &&
+
+ git rm change_notx_to_x &&
+ test_file_mode_staged 000000 change_notx_to_x &&
+ test_tick && git commit -m "remove change_notx_to_x" &&
+ test_file_mode_HEAD 000000 change_notx_to_x &&
+
+ git format-patch -o patches -3 &&
+ mv patches/0001-* change_notx_to_x-0001-create-0644.patch &&
+ mv patches/0002-* change_notx_to_x-0002-chmod-0755.patch &&
+ mv patches/0003-* change_notx_to_x-0003-delete.patch &&
+
+ test_grep "^new file mode 100644$" change_notx_to_x-0001-create-0644.patch &&
+ test_grep "^old mode 100644$" change_notx_to_x-0002-chmod-0755.patch &&
+ test_grep "^new mode 100755$" change_notx_to_x-0002-chmod-0755.patch &&
+ test_grep "^deleted file mode 100755$" change_notx_to_x-0003-delete.patch &&
+
+ git tag change_notx_to_x_initial
+'
+
+test_expect_success 'git apply restores file modes (change_notx_to_x)' '
+ test_config core.fileMode false &&
+ git reset --hard change_notx_to_x_initial &&
+
+ git apply --index change_notx_to_x-0001-create-0644.patch &&
+ test_file_mode_staged 100644 change_notx_to_x &&
+ test_tick && git commit -m "redo: add change_notx_to_x as not executable" &&
+ test_file_mode_HEAD 100644 change_notx_to_x &&
+
+ git apply --index change_notx_to_x-0002-chmod-0755.patch 2>err &&
+ test_grep ! "has type 100.*, expected 100.*" err &&
+ test_file_mode_staged 100755 change_notx_to_x &&
+ test_tick && git commit -m "redo: make change_notx_to_x executable" &&
+ test_file_mode_HEAD 100755 change_notx_to_x &&
+
+ git apply --index change_notx_to_x-0003-delete.patch &&
+ test_grep ! "has type 100.*, expected 100.*" err &&
+ test_file_mode_staged 000000 change_notx_to_x &&
+ test_tick && git commit -m "undo: remove change_notx_to_x" &&
+ test_file_mode_HEAD 000000 change_notx_to_x
+'
+
+test_expect_success 'git apply --reverse restores file modes (change_notx_to_x)' '
+ test_config core.fileMode false &&
+ git reset --hard change_notx_to_x_initial &&
+
+ git apply --index --reverse change_notx_to_x-0003-delete.patch &&
+ test_file_mode_staged 100755 change_notx_to_x &&
+ test_tick && git commit -m "undo: remove change_notx_to_x" &&
+ test_file_mode_HEAD 100755 change_notx_to_x &&
+
+ git apply --index --reverse change_notx_to_x-0002-chmod-0755.patch 2>err &&
+ test_grep ! "has type 100.*, expected 100.*" err &&
+ test_file_mode_staged 100644 change_notx_to_x &&
+ test_tick && git commit -m "undo: make change_notx_to_x executable" &&
+ test_file_mode_HEAD 100644 change_notx_to_x &&
+
+ git apply --index --reverse change_notx_to_x-0001-create-0644.patch 2>err &&
+ test_grep ! "has type 100.*, expected 100.*" err &&
+ test_file_mode_staged 000000 change_notx_to_x &&
+ test_tick && git commit -m "undo: add change_notx_to_x as not executable" &&
+ test_file_mode_HEAD 000000 change_notx_to_x
'
test_expect_success POSIXPERM 'patch mode for new file is canonicalized' '
diff --git a/t/t5410-receive-pack.sh b/t/t5410-receive-pack.sh
index f76a22943e..09d6bfd2a1 100755
--- a/t/t5410-receive-pack.sh
+++ b/t/t5410-receive-pack.sh
@@ -41,7 +41,19 @@ test_expect_success 'with core.alternateRefsPrefixes' '
test_cmp expect actual.haves
'
-test_expect_success 'receive-pack missing objects fails connectivity check' '
+# The `tee.exe` shipped in Git for Windows v2.49.0 is known to hang frequently
+# when spawned from `git.exe` and piping its output to `git.exe`. This seems
+# related to MSYS2 runtime bug fixes regarding the signal handling; Let's just
+# skip the tests that need to exercise this when the faulty MSYS2 runtime is
+# detected; The test cases are exercised enough in other matrix jobs of the CI
+# runs.
+test_lazy_prereq TEE_DOES_NOT_HANG '
+ test_have_prereq !MINGW &&
+ case "$(uname -a)" in *3.5.7-463ebcdc.x86_64*) false;; esac
+'
+
+test_expect_success TEE_DOES_NOT_HANG \
+ 'receive-pack missing objects fails connectivity check' '
test_when_finished rm -rf repo remote.git setup.git &&
git init repo &&
@@ -62,7 +74,8 @@ test_expect_success 'receive-pack missing objects fails connectivity check' '
test_must_fail git -C remote.git cat-file -e $(git -C repo rev-parse HEAD)
'
-test_expect_success 'receive-pack missing objects bypasses connectivity check' '
+test_expect_success TEE_DOES_NOT_HANG \
+ 'receive-pack missing objects bypasses connectivity check' '
test_when_finished rm -rf repo remote.git setup.git &&
git init repo &&
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index dda9e7c3e7..76619765fc 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -299,22 +299,10 @@ test_expect_success GPG 'set up signed commit' '
'
-test_expect_success GPG 'signed-commits default' '
-
- sane_unset FAST_EXPORT_SIGNED_COMMITS_NOABORT &&
- test_must_fail git fast-export --reencode=no commit-signing &&
-
- FAST_EXPORT_SIGNED_COMMITS_NOABORT=1 git fast-export --reencode=no commit-signing >output 2>err &&
- ! grep ^gpgsig output &&
- grep "^encoding ISO-8859-1" output &&
- test -s err &&
- sed "s/commit-signing/commit-strip-signing/" output | (
- cd new &&
- git fast-import &&
- STRIPPED=$(git rev-parse --verify refs/heads/commit-strip-signing) &&
- test $COMMIT_SIGNING != $STRIPPED
- )
-
+test_expect_success GPG 'signed-commits default is same as strip' '
+ git fast-export --reencode=no commit-signing >out1 2>err &&
+ git fast-export --reencode=no --signed-commits=strip commit-signing >out2 &&
+ test_cmp out1 out2
'
test_expect_success GPG 'signed-commits=abort' '
diff --git a/t/test-lib.sh b/t/test-lib.sh
index af722d383d..92d0db13d7 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1577,6 +1577,8 @@ fi
# Use -P to resolve symlinks in our working directory so that the cwd
# in subprocesses like git equals our $PWD (for pathname comparisons).
cd -P "$TRASH_DIRECTORY" || BAIL_OUT "cannot cd -P to \"$TRASH_DIRECTORY\""
+TRASH_DIRECTORY=$(pwd)
+HOME="$TRASH_DIRECTORY"
start_test_output "$0"
diff --git a/thread-utils.c b/thread-utils.c
index 1f89ffab4c..374890e6b0 100644
--- a/thread-utils.c
+++ b/thread-utils.c
@@ -46,11 +46,11 @@ int online_cpus(void)
mib[0] = CTL_HW;
# ifdef HW_AVAILCPU
mib[1] = HW_AVAILCPU;
- len = sizeof(cpucount);
- if (!sysctl(mib, 2, &cpucount, &len, NULL, 0))
- return cpucount;
-# endif /* HW_AVAILCPU */
+# elif defined(HW_NCPUONLINE)
+ mib[1] = HW_NCPUONLINE;
+# else
mib[1] = HW_NCPU;
+# endif /* HW_AVAILCPU */
len = sizeof(cpucount);
if (!sysctl(mib, 2, &cpucount, &len, NULL, 0))
return cpucount;