summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/Makefile1
-rw-r--r--Documentation/RelNotes/2.37.2.txt47
-rw-r--r--Documentation/config.txt2
-rw-r--r--Documentation/config/includeif.txt6
-rw-r--r--Documentation/diff-format.txt6
-rw-r--r--Documentation/git-cvsserver.txt19
-rw-r--r--Documentation/git-daemon.txt21
-rw-r--r--Documentation/git-diff-index.txt6
-rw-r--r--Documentation/git-rebase.txt242
-rw-r--r--Documentation/git.txt4
-rw-r--r--Documentation/revisions.txt17
-rw-r--r--Documentation/technical/bitmap-format.txt203
l---------RelNotes2
-rw-r--r--builtin/clone.c81
-rw-r--r--builtin/diff-files.c2
-rw-r--r--builtin/mktree.c11
-rw-r--r--builtin/shortlog.c2
-rw-r--r--combine-diff.c7
-rw-r--r--compat/mingw.c5
-rw-r--r--contrib/credential/osxkeychain/git-credential-osxkeychain.c2
-rwxr-xr-xcontrib/vscode/init.sh8
-rw-r--r--daemon.c8
-rw-r--r--dir.c35
-rwxr-xr-xgit-cvsserver.perl2
-rw-r--r--merge-ort.c74
-rw-r--r--mergetools/vimdiff75
-rw-r--r--pack-objects.h10
-rw-r--r--setup.c2
-rw-r--r--t/README55
-rw-r--r--t/lib-proto-disable.sh6
-rwxr-xr-xt/t1300-config.sh5
-rwxr-xr-xt/t2205-add-worktree-config.sh265
-rwxr-xr-xt/t3001-ls-files-others-exclude.sh42
-rwxr-xr-xt/t3002-ls-files-dashpath.sh86
-rwxr-xr-xt/t3020-ls-files-error-unmatch.sh12
-rwxr-xr-xt/t3060-ls-files-with-tree.sh8
-rwxr-xr-xt/t3700-add.sh2
-rwxr-xr-xt/t3903-stash.sh2
-rwxr-xr-xt/t5510-fetch.sh6
-rwxr-xr-xt/t5605-clone-local.sh16
-rwxr-xr-xt/t5702-protocol-v2.sh59
-rwxr-xr-xt/t5812-proto-disable-http.sh2
-rwxr-xr-xt/t5815-submodule-protos.sh4
-rwxr-xr-xt/t6423-merge-rename-directories.sh105
-rwxr-xr-xt/t6429-merge-sequence-rename-caching.sh2
-rwxr-xr-xt/t7609-mergetool--lib.sh2
-rwxr-xr-xt/t9400-git-cvsserver-server.sh2
-rwxr-xr-xt/t9902-completion.sh13
-rw-r--r--t/test-lib-functions.sh3
-rw-r--r--t/test-lib-junit.sh10
-rw-r--r--t/test-lib.sh4
-rw-r--r--transport.c8
-rw-r--r--usage.c8
53 files changed, 1149 insertions, 478 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile
index f2e7fc1..4f801f4 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -94,6 +94,7 @@ TECH_DOCS += MyFirstContribution
TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
+TECH_DOCS += technical/bitmap-format
TECH_DOCS += technical/bundle-format
TECH_DOCS += technical/cruft-packs
TECH_DOCS += technical/hash-function-transition
diff --git a/Documentation/RelNotes/2.37.2.txt b/Documentation/RelNotes/2.37.2.txt
new file mode 100644
index 0000000..d4acf9e
--- /dev/null
+++ b/Documentation/RelNotes/2.37.2.txt
@@ -0,0 +1,47 @@
+Git 2.37.2 Release Notes
+========================
+
+This primarily is to backport various fixes accumulated on the 'master'
+front since 2.37.1.
+
+Fixes since v2.37.1
+-------------------
+
+ * "git shortlog -n" relied on the underlying qsort() to be stable,
+ which shouldn't have. Fixed.
+
+ * Variable quoting fix in the vimdiff driver of "git mergetool".
+
+ * An earlier attempt to plug leaks placed a clean-up label to jump to
+ at a bogus place, which as been corrected.
+
+ * Fixes a long-standing corner case bug around directory renames in
+ the merge-ort strategy.
+
+ * Recent update to vimdiff layout code has been made more robust
+ against different end-user vim settings.
+
+ * In a non-bare repository, the behavior of Git when the
+ core.worktree configuration variable points at a directory that has
+ a repository as its subdirectory, regressed in Git 2.27 days.
+
+ * References to commands-to-be-typed-literally in "git rebase"
+ documentation mark-up have been corrected.
+
+ * Give _() markings to fatal/warning/usage: labels that are shown in
+ front of these messages.
+
+ * "git mktree --missing" lazily fetched objects that are missing from
+ the local object store, which was totally unnecessary for the purpose
+ of creating the tree object(s) from its input.
+
+ * Fixes for tests when the source directory has unusual characters in
+ its path, e.g. whitespaces, double-quotes, etc.
+
+ * Adjust technical/bitmap-format to be formatted by AsciiDoc, and
+ add some missing information to the documentation.
+
+ * Certain diff options are currently ignored when combined-diff is
+ shown; mark them as incompatible with the feature.
+
+Also contains minor documentation updates and code clean-ups.
diff --git a/Documentation/config.txt b/Documentation/config.txt
index e376d54..5b5b976 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -445,6 +445,8 @@ include::config/i18n.txt[]
include::config/imap.txt[]
+include::config/includeif.txt[]
+
include::config/index.txt[]
include::config/init.txt[]
diff --git a/Documentation/config/includeif.txt b/Documentation/config/includeif.txt
new file mode 100644
index 0000000..82fe431
--- /dev/null
+++ b/Documentation/config/includeif.txt
@@ -0,0 +1,6 @@
+include.path::
+includeIf.<condition>.path::
+ Special variables to include other configuration files. See
+ the "CONFIGURATION FILE" section in the main
+ linkgit:git-config[1] documentation,
+ specifically the "Includes" and "Conditional Includes" subsections.
diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
index 7a9c3b6..a3ae874 100644
--- a/Documentation/diff-format.txt
+++ b/Documentation/diff-format.txt
@@ -43,7 +43,7 @@ That is, from the left to the right:
. a space.
. sha1 for "src"; 0\{40\} if creation or unmerged.
. a space.
-. sha1 for "dst"; 0\{40\} if creation, unmerged or "look at work tree".
+. sha1 for "dst"; 0\{40\} if deletion, unmerged or "work tree out of sync with the index".
. a space.
. status, followed by optional "score" number.
. a tab or a NUL when `-z` option is used.
@@ -69,8 +69,8 @@ percentage of similarity between the source and target of the move or
copy). Status letter M may be followed by a score (denoting the
percentage of dissimilarity) for file rewrites.
-<sha1> is shown as all 0's if a file is new on the filesystem
-and it is out of sync with the index.
+The sha1 for "dst" is shown as all 0's if a file on the filesystem
+is out of sync with the index.
Example:
diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt
index 4dc57ed..53f111b 100644
--- a/Documentation/git-cvsserver.txt
+++ b/Documentation/git-cvsserver.txt
@@ -63,11 +63,10 @@ Print version information and exit
Print usage information and exit
<directory>::
-You can specify a list of allowed directories. If no directories
-are given, all are allowed. This is an additional restriction, gitcvs
-access still needs to be enabled by the `gitcvs.enabled` config option
-unless `--export-all` was given, too.
-
+The remaining arguments provide a list of directories. If no directories
+are given, then all are allowed. Repositories within these directories
+still require the `gitcvs.enabled` config option, unless `--export-all`
+is specified.
LIMITATIONS
-----------
@@ -311,11 +310,13 @@ ENVIRONMENT
These variables obviate the need for command-line options in some
circumstances, allowing easier restricted usage through git-shell.
-GIT_CVSSERVER_BASE_PATH takes the place of the argument to --base-path.
+GIT_CVSSERVER_BASE_PATH::
+ This variable replaces the argument to --base-path.
-GIT_CVSSERVER_ROOT specifies a single-directory whitelist. The
-repository must still be configured to allow access through
-git-cvsserver, as described above.
+GIT_CVSSERVER_ROOT::
+ This variable specifies a single directory, replacing the
+ `<directory>...` argument list. The repository still requires the
+ `gitcvs.enabled` config option, unless `--export-all` is specified.
When these environment variables are set, the corresponding
command-line arguments may not be used.
diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index fdc28c0..236df51 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -32,8 +32,8 @@ that service if it is enabled.
It verifies that the directory has the magic file "git-daemon-export-ok", and
it will refuse to export any Git directory that hasn't explicitly been marked
for export this way (unless the `--export-all` parameter is specified). If you
-pass some directory paths as 'git daemon' arguments, you can further restrict
-the offers to a whitelist comprising of those.
+pass some directory paths as 'git daemon' arguments, the offers are limited to
+repositories within those directories.
By default, only `upload-pack` service is enabled, which serves
'git fetch-pack' and 'git ls-remote' clients, which are invoked
@@ -50,7 +50,7 @@ OPTIONS
Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
"/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
'git daemon' will refuse to start when this option is enabled and no
- whitelist is specified.
+ directory arguments are provided.
--base-path=<path>::
Remap all the path requests as relative to the given path.
@@ -73,7 +73,7 @@ OPTIONS
%IP for the server's IP address, %P for the port number,
and %D for the absolute path of the named repository.
After interpolation, the path is validated against the directory
- whitelist.
+ list.
--export-all::
Allow pulling from all directories that look like Git repositories
@@ -218,9 +218,11 @@ standard output to be sent to the requestor as an error message when
it declines the service.
<directory>::
- A directory to add to the whitelist of allowed directories. Unless
- --strict-paths is specified this will also include subdirectories
- of each named directory.
+ The remaining arguments provide a list of directories. If any
+ directories are specified, then the `git-daemon` process will
+ serve a requested directory only if it is contained in one of
+ these directories. If `--strict-paths` is specified, then the
+ requested directory must match one of these directories exactly.
SERVICES
--------
@@ -264,9 +266,8 @@ git 9418/tcp # Git Version Control System
'git daemon' as inetd server::
To set up 'git daemon' as an inetd service that handles any
- repository under the whitelisted set of directories, /pub/foo
- and /pub/bar, place an entry like the following into
- /etc/inetd all on one line:
+ repository within `/pub/foo` or `/pub/bar`, place an entry like
+ the following into `/etc/inetd` all on one line:
+
------------------------------------------------
git stream tcp nowait nobody /usr/bin/git
diff --git a/Documentation/git-diff-index.txt b/Documentation/git-diff-index.txt
index 679cae2..c30d8f0 100644
--- a/Documentation/git-diff-index.txt
+++ b/Documentation/git-diff-index.txt
@@ -69,8 +69,8 @@ done an `update-index` to make that effective in the index file.
matches my working directory. But doing a 'git diff-index' does:
torvalds@ppc970:~/git> git diff-index --cached HEAD
- -100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 commit.c
- +100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 git-commit.c
+ :100644 000000 4161aecc6700a2eb579e842af0b7f22b98443f74 0000000000000000000000000000000000000000 D commit.c
+ :000000 100644 0000000000000000000000000000000000000000 4161aecc6700a2eb579e842af0b7f22b98443f74 A git-commit.c
You can see easily that the above is a rename.
@@ -103,7 +103,7 @@ have not actually done a 'git update-index' on it yet - there is no
"object" associated with the new state, and you get:
torvalds@ppc970:~/v2.6/linux> git diff-index --abbrev HEAD
- :100644 100664 7476bb... 000000... kernel/sched.c
+ :100644 100644 7476bb5ba 000000000 M kernel/sched.c
i.e., it shows that the tree has changed, and that `kernel/sched.c` is
not up to date and may contain new stuff. The all-zero sha1 means that to
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 262fb01..a872ab0 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -16,40 +16,40 @@ SYNOPSIS
DESCRIPTION
-----------
-If <branch> is specified, 'git rebase' will perform an automatic
+If `<branch>` is specified, `git rebase` will perform an automatic
`git switch <branch>` before doing anything else. Otherwise
it remains on the current branch.
-If <upstream> is not specified, the upstream configured in
-branch.<name>.remote and branch.<name>.merge options will be used (see
+If `<upstream>` is not specified, the upstream configured in
+`branch.<name>.remote` and `branch.<name>.merge` options will be used (see
linkgit:git-config[1] for details) and the `--fork-point` option is
assumed. If you are currently not on any branch or if the current
branch does not have a configured upstream, the rebase will abort.
All changes made by commits in the current branch but that are not
-in <upstream> are saved to a temporary area. This is the same set
+in `<upstream>` are saved to a temporary area. This is the same set
of commits that would be shown by `git log <upstream>..HEAD`; or by
`git log 'fork_point'..HEAD`, if `--fork-point` is active (see the
description on `--fork-point` below); or by `git log HEAD`, if the
`--root` option is specified.
-The current branch is reset to <upstream>, or <newbase> if the
---onto option was supplied. This has the exact same effect as
-`git reset --hard <upstream>` (or <newbase>). ORIG_HEAD is set
+The current branch is reset to `<upstream>` or `<newbase>` if the
+`--onto` option was supplied. This has the exact same effect as
+`git reset --hard <upstream>` (or `<newbase>`). `ORIG_HEAD` is set
to point at the tip of the branch before the reset.
The commits that were previously saved into the temporary area are
then reapplied to the current branch, one by one, in order. Note that
-any commits in HEAD which introduce the same textual changes as a commit
-in HEAD..<upstream> are omitted (i.e., a patch already accepted upstream
+any commits in `HEAD` which introduce the same textual changes as a commit
+in `HEAD..<upstream>` are omitted (i.e., a patch already accepted upstream
with a different commit message or timestamp will be skipped).
It is possible that a merge failure will prevent this process from being
completely automatic. You will have to resolve any such merge failure
and run `git rebase --continue`. Another option is to bypass the commit
that caused the merge failure with `git rebase --skip`. To check out the
-original <branch> and remove the .git/rebase-apply working files, use the
-command `git rebase --abort` instead.
+original `<branch>` and remove the `.git/rebase-apply` working files, use
+the command `git rebase --abort` instead.
Assume the following history exists and the current branch is "topic":
@@ -79,7 +79,7 @@ remain the checked-out branch.
If the upstream branch already contains a change you have made (e.g.,
because you mailed a patch which was applied upstream), then that commit
-will be skipped and warnings will be issued (if the `merge` backend is
+will be skipped and warnings will be issued (if the 'merge' backend is
used). For example, running `git rebase master` on the following
history (in which `A'` and `A` introduce the same set of changes, but
have different committer information):
@@ -176,11 +176,11 @@ would result in the removal of commits F and G:
------------
This is useful if F and G were flawed in some way, or should not be
-part of topicA. Note that the argument to --onto and the <upstream>
+part of topicA. Note that the argument to `--onto` and the `<upstream>`
parameter can be any valid commit-ish.
-In case of conflict, 'git rebase' will stop at the first problematic commit
-and leave conflict markers in the tree. You can use 'git diff' to locate
+In case of conflict, `git rebase` will stop at the first problematic commit
+and leave conflict markers in the tree. You can use `git diff` to locate
the markers (<<<<<<) and make edits to resolve the conflict. For each
file you edit, you need to tell Git that the conflict has been resolved,
typically this would be done with
@@ -205,8 +205,8 @@ OPTIONS
-------
--onto <newbase>::
Starting point at which to create the new commits. If the
- --onto option is not specified, the starting point is
- <upstream>. May be any valid commit, and not just an
+ `--onto` option is not specified, the starting point is
+ `<upstream>`. May be any valid commit, and not just an
existing branch name.
+
As a special case, you may use "A\...B" as a shortcut for the
@@ -215,19 +215,19 @@ leave out at most one of A and B, in which case it defaults to HEAD.
--keep-base::
Set the starting point at which to create the new commits to the
- merge base of <upstream> and <branch>. Running
- 'git rebase --keep-base <upstream> <branch>' is equivalent to
+ merge base of `<upstream>` and `<branch>`. Running
+ `git rebase --keep-base <upstream> <branch>` is equivalent to
running
- 'git rebase --onto <upstream>...<branch> <upstream> <branch>'.
+ `git rebase --onto <upstream>...<branch> <upstream> <branch>`.
+
This option is useful in the case where one is developing a feature on
top of an upstream branch. While the feature is being worked on, the
upstream branch may advance and it may not be the best idea to keep
rebasing on top of the upstream but to keep the base commit as-is.
+
-Although both this option and --fork-point find the merge base between
-<upstream> and <branch>, this option uses the merge base as the _starting
-point_ on which new commits will be created, whereas --fork-point uses
+Although both this option and `--fork-point` find the merge base between
+`<upstream>` and `<branch>`, this option uses the merge base as the _starting
+point_ on which new commits will be created, whereas `--fork-point` uses
the merge base to determine the _set of commits_ which will be rebased.
+
See also INCOMPATIBLE OPTIONS below.
@@ -238,23 +238,23 @@ See also INCOMPATIBLE OPTIONS below.
upstream for the current branch.
<branch>::
- Working branch; defaults to HEAD.
+ Working branch; defaults to `HEAD`.
--continue::
Restart the rebasing process after having resolved a merge conflict.
--abort::
Abort the rebase operation and reset HEAD to the original
- branch. If <branch> was provided when the rebase operation was
- started, then HEAD will be reset to <branch>. Otherwise HEAD
+ branch. If `<branch>` was provided when the rebase operation was
+ started, then `HEAD` will be reset to `<branch>`. Otherwise `HEAD`
will be reset to where it was when the rebase operation was
started.
--quit::
- Abort the rebase operation but HEAD is not reset back to the
+ Abort the rebase operation but `HEAD` is not reset back to the
original branch. The index and working tree are also left
unchanged as a result. If a temporary stash entry was created
- using --autostash, it will be saved to the stash list.
+ using `--autostash`, it will be saved to the stash list.
--apply::
Use applying strategies to rebase (calling `git-am`
@@ -269,16 +269,16 @@ See also INCOMPATIBLE OPTIONS below.
empty after rebasing (because they contain a subset of already
upstream changes). With drop (the default), commits that
become empty are dropped. With keep, such commits are kept.
- With ask (implied by --interactive), the rebase will halt when
+ With ask (implied by `--interactive`), the rebase will halt when
an empty commit is applied allowing you to choose whether to
drop it, edit files more, or just commit the empty changes.
- Other options, like --exec, will use the default of drop unless
- -i/--interactive is explicitly specified.
+ Other options, like `--exec`, will use the default of drop unless
+ `-i`/`--interactive` is explicitly specified.
+
-Note that commits which start empty are kept (unless --no-keep-empty
+Note that commits which start empty are kept (unless `--no-keep-empty`
is specified), and commits which are clean cherry-picks (as determined
by `git log --cherry-mark ...`) are detected and dropped as a
-preliminary step (unless --reapply-cherry-picks is passed).
+preliminary step (unless `--reapply-cherry-picks` is passed).
+
See also INCOMPATIBLE OPTIONS below.
@@ -287,7 +287,7 @@ See also INCOMPATIBLE OPTIONS below.
Do not keep commits that start empty before the rebase
(i.e. that do not change anything from its parent) in the
result. The default is to keep commits which start empty,
- since creating such commits requires passing the --allow-empty
+ since creating such commits requires passing the `--allow-empty`
override flag to `git commit`, signifying that a user is very
intentionally creating such a commit and thus wants to keep
it.
@@ -299,7 +299,7 @@ flag exists as a convenient shortcut, such as for cases where external
tools generate many empty commits and you want them all removed.
+
For commits which do not start empty but become empty after rebasing,
-see the --empty flag.
+see the `--empty` flag.
+
See also INCOMPATIBLE OPTIONS below.
@@ -314,7 +314,7 @@ See also INCOMPATIBLE OPTIONS below.
By default (or if `--no-reapply-cherry-picks` is given), these commits
will be automatically dropped. Because this necessitates reading all
upstream commits, this can be expensive in repos with a large number
-of upstream commits that need to be read. When using the `merge`
+of upstream commits that need to be read. When using the 'merge'
backend, warnings will be issued for each dropped commit (unless
`--quiet` is given). Advice will also be issued unless
`advice.skippedCherryPicks` is set to false (see linkgit:git-config[1]).
@@ -348,10 +348,10 @@ See also INCOMPATIBLE OPTIONS below.
Using merging strategies to rebase (default).
+
Note that a rebase merge works by replaying each commit from the working
-branch on top of the <upstream> branch. Because of this, when a merge
+branch on top of the `<upstream>` branch. Because of this, when a merge
conflict happens, the side reported as 'ours' is the so-far rebased
-series, starting with <upstream>, and 'theirs' is the working branch. In
-other words, the sides are swapped.
+series, starting with `<upstream>`, and 'theirs' is the working branch.
+In other words, the sides are swapped.
+
See also INCOMPATIBLE OPTIONS below.
@@ -360,9 +360,9 @@ See also INCOMPATIBLE OPTIONS below.
Use the given merge strategy, instead of the default `ort`.
This implies `--merge`.
+
-Because 'git rebase' replays each commit from the working branch
-on top of the <upstream> branch using the given strategy, using
-the 'ours' strategy simply empties all patches from the <branch>,
+Because `git rebase` replays each commit from the working branch
+on top of the `<upstream>` branch using the given strategy, using
+the `ours` strategy simply empties all patches from the `<branch>`,
which makes little sense.
+
See also INCOMPATIBLE OPTIONS below.
@@ -392,11 +392,11 @@ See also INCOMPATIBLE OPTIONS below.
-q::
--quiet::
- Be quiet. Implies --no-stat.
+ Be quiet. Implies `--no-stat`.
-v::
--verbose::
- Be verbose. Implies --stat.
+ Be verbose. Implies `--stat`.
--stat::
Show a diffstat of what changed upstream since the last rebase. The
@@ -411,13 +411,13 @@ See also INCOMPATIBLE OPTIONS below.
--verify::
Allows the pre-rebase hook to run, which is the default. This option can
- be used to override --no-verify. See also linkgit:githooks[5].
+ be used to override `--no-verify`. See also linkgit:githooks[5].
-C<n>::
- Ensure at least <n> lines of surrounding context match before
+ Ensure at least `<n>` lines of surrounding context match before
and after each change. When fewer lines of surrounding
context exist they all must match. By default no context is
- ever ignored. Implies --apply.
+ ever ignored. Implies `--apply`.
+
See also INCOMPATIBLE OPTIONS below.
@@ -436,21 +436,21 @@ details).
--fork-point::
--no-fork-point::
- Use reflog to find a better common ancestor between <upstream>
- and <branch> when calculating which commits have been
- introduced by <branch>.
+ Use reflog to find a better common ancestor between `<upstream>`
+ and `<branch>` when calculating which commits have been
+ introduced by `<branch>`.
+
-When --fork-point is active, 'fork_point' will be used instead of
-<upstream> to calculate the set of commits to rebase, where
+When `--fork-point` is active, 'fork_point' will be used instead of
+`<upstream>` to calculate the set of commits to rebase, where
'fork_point' is the result of `git merge-base --fork-point <upstream>
<branch>` command (see linkgit:git-merge-base[1]). If 'fork_point'
-ends up being empty, the <upstream> will be used as a fallback.
+ends up being empty, the `<upstream>` will be used as a fallback.
+
-If <upstream> is given on the command line, then the default is
+If `<upstream>` is given on the command line, then the default is
`--no-fork-point`, otherwise the default is `--fork-point`. See also
`rebase.forkpoint` in linkgit:git-config[1].
+
-If your branch was based on <upstream> but <upstream> was rewound and
+If your branch was based on `<upstream>` but `<upstream>` was rewound and
your branch contains commits which were dropped, this option can be used
with `--keep-base` in order to drop those commits from your branch.
+
@@ -458,24 +458,26 @@ See also INCOMPATIBLE OPTIONS below.
--ignore-whitespace::
Ignore whitespace differences when trying to reconcile
-differences. Currently, each backend implements an approximation of
-this behavior:
+ differences. Currently, each backend implements an approximation of
+ this behavior:
+
-apply backend: When applying a patch, ignore changes in whitespace in
-context lines. Unfortunately, this means that if the "old" lines being
-replaced by the patch differ only in whitespace from the existing
-file, you will get a merge conflict instead of a successful patch
-application.
+apply backend;;
+ When applying a patch, ignore changes in whitespace in context
+ lines. Unfortunately, this means that if the "old" lines being
+ replaced by the patch differ only in whitespace from the existing
+ file, you will get a merge conflict instead of a successful patch
+ application.
+
-merge backend: Treat lines with only whitespace changes as unchanged
-when merging. Unfortunately, this means that any patch hunks that were
-intended to modify whitespace and nothing else will be dropped, even
-if the other side had no changes that conflicted.
+merge backend;;
+ Treat lines with only whitespace changes as unchanged when merging.
+ Unfortunately, this means that any patch hunks that were intended
+ to modify whitespace and nothing else will be dropped, even if the
+ other side had no changes that conflicted.
--whitespace=<option>::
- This flag is passed to the 'git apply' program
+ This flag is passed to the `git apply` program
(see linkgit:git-apply[1]) that applies the patch.
- Implies --apply.
+ Implies `--apply`.
+
See also INCOMPATIBLE OPTIONS below.
@@ -537,7 +539,7 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
-x <cmd>::
--exec <cmd>::
Append "exec <cmd>" after each line creating a commit in the
- final history. <cmd> will be interpreted as one or more shell
+ final history. `<cmd>` will be interpreted as one or more shell
commands. Any command that fails will interrupt the rebase,
with exit code 1.
+
@@ -550,7 +552,7 @@ or by giving more than one `--exec`:
+
git rebase -i --exec "cmd1" --exec "cmd2" --exec ...
+
-If `--autosquash` is used, "exec" lines will not be appended for
+If `--autosquash` is used, `exec` lines will not be appended for
the intermediate commits, and will only appear at the end of each
squash/fixup series.
+
@@ -560,11 +562,12 @@ without an explicit `--interactive`.
See also INCOMPATIBLE OPTIONS below.
--root::
- Rebase all commits reachable from <branch>, instead of
- limiting them with an <upstream>. This allows you to rebase
- the root commit(s) on a branch. When used with --onto, it
- will skip changes already contained in <newbase> (instead of
- <upstream>) whereas without --onto it will operate on every change.
+ Rebase all commits reachable from `<branch>`, instead of
+ limiting them with an `<upstream>`. This allows you to rebase
+ the root commit(s) on a branch. When used with `--onto`, it
+ will skip changes already contained in `<newbase>` (instead of
+ `<upstream>`) whereas without `--onto` it will operate on every
+ change.
+
See also INCOMPATIBLE OPTIONS below.
@@ -643,9 +646,9 @@ In addition, the following pairs of options are incompatible:
BEHAVIORAL DIFFERENCES
-----------------------
-git rebase has two primary backends: apply and merge. (The apply
+`git rebase` has two primary backends: 'apply' and 'merge'. (The 'apply'
backend used to be known as the 'am' backend, but the name led to
-confusion as it looks like a verb instead of a noun. Also, the merge
+confusion as it looks like a verb instead of a noun. Also, the 'merge'
backend used to be known as the interactive backend, but it is now
used for non-interactive cases as well. Both were renamed based on
lower-level functionality that underpinned each.) There are some
@@ -654,19 +657,19 @@ subtle differences in how these two backends behave:
Empty commits
~~~~~~~~~~~~~
-The apply backend unfortunately drops intentionally empty commits, i.e.
+The 'apply' backend unfortunately drops intentionally empty commits, i.e.
commits that started empty, though these are rare in practice. It
also drops commits that become empty and has no option for controlling
this behavior.
-The merge backend keeps intentionally empty commits by default (though
-with -i they are marked as empty in the todo list editor, or they can
-be dropped automatically with --no-keep-empty).
+The 'merge' backend keeps intentionally empty commits by default (though
+with `-i` they are marked as empty in the todo list editor, or they can
+be dropped automatically with `--no-keep-empty`).
Similar to the apply backend, by default the merge backend drops
-commits that become empty unless -i/--interactive is specified (in
+commits that become empty unless `-i`/`--interactive` is specified (in
which case it stops and asks the user what to do). The merge backend
-also has an --empty={drop,keep,ask} option for changing the behavior
+also has an `--empty={drop,keep,ask}` option for changing the behavior
of handling commits that become empty.
Directory rename detection
@@ -674,20 +677,20 @@ Directory rename detection
Due to the lack of accurate tree information (arising from
constructing fake ancestors with the limited information available in
-patches), directory rename detection is disabled in the apply backend.
+patches), directory rename detection is disabled in the 'apply' backend.
Disabled directory rename detection means that if one side of history
renames a directory and the other adds new files to the old directory,
then the new files will be left behind in the old directory without
any warning at the time of rebasing that you may want to move these
files into the new directory.
-Directory rename detection works with the merge backend to provide you
+Directory rename detection works with the 'merge' backend to provide you
warnings in such cases.
Context
~~~~~~~
-The apply backend works by creating a sequence of patches (by calling
+The 'apply' backend works by creating a sequence of patches (by calling
`format-patch` internally), and then applying the patches in sequence
(calling `am` internally). Patches are composed of multiple hunks,
each with line numbers, a context region, and the actual changes. The
@@ -698,11 +701,11 @@ order to apply the changes to the right lines. However, if multiple
areas of the code have the same surrounding lines of context, the
wrong one can be picked. There are real-world cases where this has
caused commits to be reapplied incorrectly with no conflicts reported.
-Setting diff.context to a larger value may prevent such types of
+Setting `diff.context` to a larger value may prevent such types of
problems, but increases the chance of spurious conflicts (since it
will require more lines of matching context to apply).
-The merge backend works with a full copy of each relevant file,
+The 'merge' backend works with a full copy of each relevant file,
insulating it from these types of problems.
Labelling of conflicts markers
@@ -710,30 +713,30 @@ Labelling of conflicts markers
When there are content conflicts, the merge machinery tries to
annotate each side's conflict markers with the commits where the
-content came from. Since the apply backend drops the original
+content came from. Since the 'apply' backend drops the original
information about the rebased commits and their parents (and instead
generates new fake commits based off limited information in the
generated patches), those commits cannot be identified; instead it has
-to fall back to a commit summary. Also, when merge.conflictStyle is
-set to diff3 or zdiff3, the apply backend will use "constructed merge
+to fall back to a commit summary. Also, when `merge.conflictStyle` is
+set to `diff3` or `zdiff3`, the 'apply' backend will use "constructed merge
base" to label the content from the merge base, and thus provide no
information about the merge base commit whatsoever.
-The merge backend works with the full commits on both sides of history
+The 'merge' backend works with the full commits on both sides of history
and thus has no such limitations.
Hooks
~~~~~
-The apply backend has not traditionally called the post-commit hook,
-while the merge backend has. Both have called the post-checkout hook,
-though the merge backend has squelched its output. Further, both
+The 'apply' backend has not traditionally called the post-commit hook,
+while the 'merge' backend has. Both have called the post-checkout hook,
+though the 'merge' backend has squelched its output. Further, both
backends only call the post-checkout hook with the starting point
commit of the rebase, not the intermediate commits nor the final
commit. In each case, the calling of these hooks was by accident of
implementation rather than by design (both backends were originally
implemented as shell scripts and happened to invoke other commands
-like 'git checkout' or 'git commit' that would call the hooks). Both
+like `git checkout` or `git commit` that would call the hooks). Both
backends should have the same behavior, though it is not entirely
clear which, if any, is correct. We will likely make rebase stop
calling either of these hooks in the future.
@@ -741,10 +744,10 @@ calling either of these hooks in the future.
Interruptability
~~~~~~~~~~~~~~~~
-The apply backend has safety problems with an ill-timed interrupt; if
+The 'apply' backend has safety problems with an ill-timed interrupt; if
the user presses Ctrl-C at the wrong time to try to abort the rebase,
the rebase can enter a state where it cannot be aborted with a
-subsequent `git rebase --abort`. The merge backend does not appear to
+subsequent `git rebase --abort`. The 'merge' backend does not appear to
suffer from the same shortcoming. (See
https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/ for
details.)
@@ -756,8 +759,8 @@ When a conflict occurs while rebasing, rebase stops and asks the user
to resolve. Since the user may need to make notable changes while
resolving conflicts, after conflicts are resolved and the user has run
`git rebase --continue`, the rebase should open an editor and ask the
-user to update the commit message. The merge backend does this, while
-the apply backend blindly applies the original commit message.
+user to update the commit message. The 'merge' backend does this, while
+the 'apply' backend blindly applies the original commit message.
Miscellaneous differences
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -777,23 +780,23 @@ completeness:
them to stderr.
* State directories: The two backends keep their state in different
- directories under .git/
+ directories under `.git/`
include::merge-strategies.txt[]
NOTES
-----
-You should understand the implications of using 'git rebase' on a
+You should understand the implications of using `git rebase` on a
repository that you share. See also RECOVERING FROM UPSTREAM REBASE
below.
-When the git-rebase command is run, it will first execute a "pre-rebase"
-hook if one exists. You can use this hook to do sanity checks and
-reject the rebase if it isn't appropriate. Please see the template
-pre-rebase hook script for an example.
+When the rebase is run, it will first execute a `pre-rebase` hook if one
+exists. You can use this hook to do sanity checks and reject the rebase
+if it isn't appropriate. Please see the template `pre-rebase` hook script
+for an example.
-Upon completion, <branch> will be the current branch.
+Upon completion, `<branch>` will be the current branch.
INTERACTIVE MODE
----------------
@@ -848,7 +851,7 @@ not look at them but at the commit names ("deadbee" and "fa1afe1" in this
example), so do not delete or edit the names.
By replacing the command "pick" with the command "edit", you can tell
-'git rebase' to stop after applying that commit, so that you can edit
+`git rebase` to stop after applying that commit, so that you can edit
the files and/or the commit message, amend the commit, and continue
rebasing.
@@ -876,14 +879,13 @@ commit, the message from the final one is used. You can also use
"fixup -C" to get the same behavior as "fixup -c" except without opening
an editor.
-
-'git rebase' will stop when "pick" has been replaced with "edit" or
+`git rebase` will stop when "pick" has been replaced with "edit" or
when a command fails due to merge errors. When you are done editing
and/or resolving conflicts you can continue with `git rebase --continue`.
For example, if you want to reorder the last 5 commits, such that what
-was HEAD~4 becomes the new HEAD. To achieve that, you would call
-'git rebase' like this:
+was `HEAD~4` becomes the new `HEAD`. To achieve that, you would call
+`git rebase` like this:
----------------------
$ git rebase -i HEAD~5
@@ -903,7 +905,7 @@ like this:
------------------
Suppose you want to rebase the side branch starting at "A" to "Q". Make
-sure that the current HEAD is "B", and call
+sure that the current `HEAD` is "B", and call
-----------------------------
$ git rebase -i -r --onto Q O
@@ -956,23 +958,23 @@ SPLITTING COMMITS
-----------------
In interactive mode, you can mark commits with the action "edit". However,
-this does not necessarily mean that 'git rebase' expects the result of this
+this does not necessarily mean that `git rebase` expects the result of this
edit to be exactly one commit. Indeed, you can undo the commit, or you can
add other commits. This can be used to split a commit into two:
- Start an interactive rebase with `git rebase -i <commit>^`, where
- <commit> is the commit you want to split. In fact, any commit range
+ `<commit>` is the commit you want to split. In fact, any commit range
will do, as long as it contains that commit.
- Mark the commit you want to split with the action "edit".
- When it comes to editing that commit, execute `git reset HEAD^`. The
- effect is that the HEAD is rewound by one, and the index follows suit.
+ effect is that the `HEAD` is rewound by one, and the index follows suit.
However, the working tree stays the same.
- Now add the changes to the index that you want to have in the first
commit. You can use `git add` (possibly interactively) or
- 'git gui' (or both) to do that.
+ `git gui` (or both) to do that.
- Commit the now-current index with whatever commit message is appropriate
now.
@@ -983,7 +985,7 @@ add other commits. This can be used to split a commit into two:
If you are not absolutely sure that the intermediate revisions are
consistent (they compile, pass the testsuite, etc.) you should use
-'git stash' to stash away the not-yet-committed changes
+`git stash` to stash away the not-yet-committed changes
after each commit, test, and amend the commit if fixes are necessary.
@@ -1087,12 +1089,12 @@ NOTE: While an "easy case recovery" sometimes appears to be successful
example, a commit that was removed via `git rebase
--interactive` will be **resurrected**!
-The idea is to manually tell 'git rebase' "where the old 'subsystem'
+The idea is to manually tell `git rebase` "where the old 'subsystem'
ended and your 'topic' began", that is, what the old merge base
between them was. You will have to find a way to name the last commit
of the old 'subsystem', for example:
-* With the 'subsystem' reflog: after 'git fetch', the old tip of
+* With the 'subsystem' reflog: after `git fetch`, the old tip of
'subsystem' is at `subsystem@{1}`. Subsequent fetches will
increase the number. (See linkgit:git-reflog[1].)
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 302607a..47a6095 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -885,9 +885,7 @@ for full details.
If set to a colon-separated list of protocols, behave as if
`protocol.allow` is set to `never`, and each of the listed
protocols has `protocol.<name>.allow` set to `always`
- (overriding any existing configuration). In other words, any
- protocol not mentioned will be disallowed (i.e., this is a
- whitelist, not a blacklist). See the description of
+ (overriding any existing configuration). See the description of
`protocol.allow` in linkgit:git-config[1] for more details.
`GIT_PROTOCOL_FROM_USER`::
diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
index f5f17b6..e3e3501 100644
--- a/Documentation/revisions.txt
+++ b/Documentation/revisions.txt
@@ -96,19 +96,16 @@ some output processing may assume ref names in UTF-8.
before the current one.
'[<branchname>]@\{upstream\}', e.g. 'master@\{upstream\}', '@\{u\}'::
- The suffix '@\{upstream\}' to a branchname (short form '<branchname>@\{u\}')
- refers to the branch that the branch specified by branchname is set to build on
- top of (configured with `branch.<name>.remote` and
- `branch.<name>.merge`). A missing branchname defaults to the
- current one. These suffixes are also accepted when spelled in uppercase, and
- they mean the same thing no matter the case.
+ A branch B may be set up to build on top of a branch X (configured with
+ `branch.<name>.merge`) at a remote R (configured with
+ `branch.<name>.remote`). B@{u} refers to the remote-tracking branch for
+ the branch X taken from remote R, typically found at `refs/remotes/R/X`.
'[<branchname>]@\{push\}', e.g. 'master@\{push\}', '@\{push\}'::
The suffix '@\{push}' reports the branch "where we would push to" if
`git push` were run while `branchname` was checked out (or the current
- `HEAD` if no branchname is specified). Since our push destination is
- in a remote repository, of course, we report the local tracking branch
- that corresponds to that branch (i.e., something in `refs/remotes/`).
+ `HEAD` if no branchname is specified). Like for '@\{upstream\}', we report
+ the remote-tracking branch that corresponds to that branch at the remote.
+
Here's an example to make it more clear:
+
@@ -283,7 +280,7 @@ The '..' (two-dot) Range Notation::
for commits that are reachable from r2 excluding those that are reachable
from r1 by '{caret}r1 r2' and it can be written as 'r1..r2'.
-The '...' (three-dot) Symmetric Difference Notation::
+The '\...' (three-dot) Symmetric Difference Notation::
A similar notation 'r1\...r2' is called symmetric difference
of 'r1' and 'r2' and is defined as
'r1 r2 --not $(git merge-base --all r1 r2)'.
diff --git a/Documentation/technical/bitmap-format.txt b/Documentation/technical/bitmap-format.txt
index 04b3ec2..a85f58f 100644
--- a/Documentation/technical/bitmap-format.txt
+++ b/Documentation/technical/bitmap-format.txt
@@ -25,9 +25,9 @@ An object is uniquely described by its bit position within a bitmap:
is defined as follows:
o1 <= o2 <==> pack(o1) <= pack(o2) /\ offset(o1) <= offset(o2)
-
- The ordering between packs is done according to the MIDX's .rev file.
- Notably, the preferred pack sorts ahead of all other packs.
++
+The ordering between packs is done according to the MIDX's .rev file.
+Notably, the preferred pack sorts ahead of all other packs.
The on-disk representation (described below) of a bitmap is the same regardless
of whether or not that bitmap belongs to a packfile or a MIDX. The only
@@ -39,97 +39,108 @@ MIDXs, both the bit-cache and rev-cache extensions are required.
== On-disk format
- - A header appears at the beginning:
-
- 4-byte signature: {'B', 'I', 'T', 'M'}
-
- 2-byte version number (network byte order)
- The current implementation only supports version 1
- of the bitmap index (the same one as JGit).
-
- 2-byte flags (network byte order)
-
- The following flags are supported:
-
- - BITMAP_OPT_FULL_DAG (0x1) REQUIRED
- This flag must always be present. It implies that the
- bitmap index has been generated for a packfile or
- multi-pack index (MIDX) with full closure (i.e. where
- every single object in the packfile/MIDX can find its
- parent links inside the same packfile/MIDX). This is a
- requirement for the bitmap index format, also present in
- JGit, that greatly reduces the complexity of the
- implementation.
-
- - BITMAP_OPT_HASH_CACHE (0x4)
- If present, the end of the bitmap file contains
- `N` 32-bit name-hash values, one per object in the
- pack/MIDX. The format and meaning of the name-hash is
- described below.
-
- 4-byte entry count (network byte order)
-
- The total count of entries (bitmapped commits) in this bitmap index.
-
- 20-byte checksum
-
- The SHA1 checksum of the pack/MIDX this bitmap index
- belongs to.
-
- - 4 EWAH bitmaps that act as type indexes
-
- Type indexes are serialized after the hash cache in the shape
- of four EWAH bitmaps stored consecutively (see Appendix A for
- the serialization format of an EWAH bitmap).
-
- There is a bitmap for each Git object type, stored in the following
- order:
-
- - Commits
- - Trees
- - Blobs
- - Tags
-
- In each bitmap, the `n`th bit is set to true if the `n`th object
- in the packfile or multi-pack index is of that type.
-
- The obvious consequence is that the OR of all 4 bitmaps will result
- in a full set (all bits set), and the AND of all 4 bitmaps will
- result in an empty bitmap (no bits set).
-
- - N entries with compressed bitmaps, one for each indexed commit
-
- Where `N` is the total amount of entries in this bitmap index.
- Each entry contains the following:
-
- - 4-byte object position (network byte order)
- The position **in the index for the packfile or
- multi-pack index** where the bitmap for this commit is
- found.
-
- - 1-byte XOR-offset
- The xor offset used to compress this bitmap. For an entry
- in position `x`, a XOR offset of `y` means that the actual
- bitmap representing this commit is composed by XORing the
- bitmap for this entry with the bitmap in entry `x-y` (i.e.
- the bitmap `y` entries before this one).
-
- Note that this compression can be recursive. In order to
- XOR this entry with a previous one, the previous entry needs
- to be decompressed first, and so on.
-
- The hard-limit for this offset is 160 (an entry can only be
- xor'ed against one of the 160 entries preceding it). This
- number is always positive, and hence entries are always xor'ed
- with **previous** bitmaps, not bitmaps that will come afterwards
- in the index.
-
- - 1-byte flags for this bitmap
- At the moment the only available flag is `0x1`, which hints
- that this bitmap can be re-used when rebuilding bitmap indexes
- for the repository.
-
- - The compressed bitmap itself, see Appendix A.
+ * A header appears at the beginning:
+
+ 4-byte signature: :: {'B', 'I', 'T', 'M'}
+
+ 2-byte version number (network byte order): ::
+
+ The current implementation only supports version 1
+ of the bitmap index (the same one as JGit).
+
+ 2-byte flags (network byte order): ::
+
+ The following flags are supported:
+
+ ** {empty}
+ BITMAP_OPT_FULL_DAG (0x1) REQUIRED: :::
+
+ This flag must always be present. It implies that the
+ bitmap index has been generated for a packfile or
+ multi-pack index (MIDX) with full closure (i.e. where
+ every single object in the packfile/MIDX can find its
+ parent links inside the same packfile/MIDX). This is a
+ requirement for the bitmap index format, also present in
+ JGit, that greatly reduces the complexity of the
+ implementation.
+
+ ** {empty}
+ BITMAP_OPT_HASH_CACHE (0x4): :::
+
+ If present, the end of the bitmap file contains
+ `N` 32-bit name-hash values, one per object in the
+ pack/MIDX. The format and meaning of the name-hash is
+ described below.
+
+ 4-byte entry count (network byte order): ::
+ The total count of entries (bitmapped commits) in this bitmap index.
+
+ 20-byte checksum: ::
+ The SHA1 checksum of the pack/MIDX this bitmap index
+ belongs to.
+
+ * 4 EWAH bitmaps that act as type indexes
++
+Type indexes are serialized after the hash cache in the shape
+of four EWAH bitmaps stored consecutively (see Appendix A for
+the serialization format of an EWAH bitmap).
++
+There is a bitmap for each Git object type, stored in the following
+order:
++
+ - Commits
+ - Trees
+ - Blobs
+ - Tags
+
++
+In each bitmap, the `n`th bit is set to true if the `n`th object
+in the packfile or multi-pack index is of that type.
++
+The obvious consequence is that the OR of all 4 bitmaps will result
+in a full set (all bits set), and the AND of all 4 bitmaps will
+result in an empty bitmap (no bits set).
+
+ * N entries with compressed bitmaps, one for each indexed commit
++
+Where `N` is the total amount of entries in this bitmap index.
+Each entry contains the following:
+
+ ** {empty}
+ 4-byte object position (network byte order): ::
+ The position **in the index for the packfile or
+ multi-pack index** where the bitmap for this commit is
+ found.
+
+ ** {empty}
+ 1-byte XOR-offset: ::
+ The xor offset used to compress this bitmap. For an entry
+ in position `x`, a XOR offset of `y` means that the actual
+ bitmap representing this commit is composed by XORing the
+ bitmap for this entry with the bitmap in entry `x-y` (i.e.
+ the bitmap `y` entries before this one).
++
+NOTE: This compression can be recursive. In order to
+XOR this entry with a previous one, the previous entry needs
+to be decompressed first, and so on.
++
+The hard-limit for this offset is 160 (an entry can only be
+xor'ed against one of the 160 entries preceding it). This
+number is always positive, and hence entries are always xor'ed
+with **previous** bitmaps, not bitmaps that will come afterwards
+in the index.
+
+ ** {empty}
+ 1-byte flags for this bitmap: ::
+ At the moment the only available flag is `0x1`, which hints
+ that this bitmap can be re-used when rebuilding bitmap indexes
+ for the repository.
+
+ ** The compressed bitmap itself, see Appendix A.
+
+ * {empty}
+ TRAILER: ::
+ Trailing checksum of the preceding contents.
== Appendix A: Serialization format for an EWAH bitmap
@@ -142,8 +153,8 @@ implementation:
- 4-byte number of words of the COMPRESSED bitmap, when stored
- N x 8-byte words, as specified by the previous field
-
- This is the actual content of the compressed bitmap.
++
+This is the actual content of the compressed bitmap.
- 4-byte position of the current RLW for the compressed
bitmap
diff --git a/RelNotes b/RelNotes
index a55e1d4..952f80e 120000
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.37.1.txt \ No newline at end of file
+Documentation/RelNotes/2.37.2.txt \ No newline at end of file
diff --git a/builtin/clone.c b/builtin/clone.c
index 89a91b0..9e0b2b4 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -606,7 +606,7 @@ static void update_remote_refs(const struct ref *refs,
}
static void update_head(const struct ref *our, const struct ref *remote,
- const char *msg)
+ const char *unborn, const char *msg)
{
const char *head;
if (our && skip_prefix(our->name, "refs/heads/", &head)) {
@@ -632,6 +632,15 @@ static void update_head(const struct ref *our, const struct ref *remote,
*/
update_ref(msg, "HEAD", &remote->old_oid, NULL, REF_NO_DEREF,
UPDATE_REFS_DIE_ON_ERR);
+ } else if (unborn && skip_prefix(unborn, "refs/heads/", &head)) {
+ /*
+ * Unborn head from remote; same as "our" case above except
+ * that we have no ref to update.
+ */
+ if (create_symref("HEAD", unborn, NULL) < 0)
+ die(_("unable to update HEAD"));
+ if (!option_bare)
+ install_branch_config(0, head, remote_name, unborn);
}
}
@@ -672,7 +681,7 @@ static int checkout(int submodule_progress, int filter_submodules)
head = resolve_refdup("HEAD", RESOLVE_REF_READING, &oid, NULL);
if (!head) {
warning(_("remote HEAD refers to nonexistent ref, "
- "unable to checkout.\n"));
+ "unable to checkout"));
return 0;
}
if (!strcmp(head, "HEAD")) {
@@ -876,6 +885,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
const struct ref *refs, *remote_head;
struct ref *remote_head_points_at = NULL;
const struct ref *our_head_points_at;
+ char *unborn_head = NULL;
struct ref *mapped_refs = NULL;
const struct ref *ref;
struct strbuf key = STRBUF_INIT;
@@ -1266,51 +1276,49 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (transport_fetch_refs(transport, mapped_refs))
die(_("remote transport reported error"));
}
-
- remote_head = find_ref_by_name(refs, "HEAD");
- remote_head_points_at =
- guess_remote_head(remote_head, mapped_refs, 0);
-
- if (option_branch) {
- our_head_points_at =
- find_remote_branch(mapped_refs, option_branch);
-
- if (!our_head_points_at)
- die(_("Remote branch %s not found in upstream %s"),
- option_branch, remote_name);
- }
- else
- our_head_points_at = remote_head_points_at;
}
- else {
- const char *branch;
- const char *ref;
- char *ref_free = NULL;
- if (option_branch)
- die(_("Remote branch %s not found in upstream %s"),
- option_branch, remote_name);
+ remote_head = find_ref_by_name(refs, "HEAD");
+ remote_head_points_at = guess_remote_head(remote_head, mapped_refs, 0);
- warning(_("You appear to have cloned an empty repository."));
+ if (option_branch) {
+ our_head_points_at = find_remote_branch(mapped_refs, option_branch);
+ if (!our_head_points_at)
+ die(_("Remote branch %s not found in upstream %s"),
+ option_branch, remote_name);
+ } else if (remote_head_points_at) {
+ our_head_points_at = remote_head_points_at;
+ } else if (remote_head) {
our_head_points_at = NULL;
- remote_head_points_at = NULL;
- remote_head = NULL;
- option_no_checkout = 1;
+ } else {
+ const char *branch;
+
+ if (!mapped_refs) {
+ warning(_("You appear to have cloned an empty repository."));
+ option_no_checkout = 1;
+ }
if (transport_ls_refs_options.unborn_head_target &&
skip_prefix(transport_ls_refs_options.unborn_head_target,
"refs/heads/", &branch)) {
- ref = transport_ls_refs_options.unborn_head_target;
- create_symref("HEAD", ref, reflog_msg.buf);
+ unborn_head = xstrdup(transport_ls_refs_options.unborn_head_target);
} else {
branch = git_default_branch_name(0);
- ref_free = xstrfmt("refs/heads/%s", branch);
- ref = ref_free;
+ unborn_head = xstrfmt("refs/heads/%s", branch);
}
- if (!option_bare)
- install_branch_config(0, branch, remote_name, ref);
- free(ref_free);
+ /*
+ * We may have selected a local default branch name "foo",
+ * and even though the remote's HEAD does not point there,
+ * it may still have a "foo" branch. If so, set it up so
+ * that we can follow the usual checkout code later.
+ *
+ * Note that for an empty repo we'll already have set
+ * option_no_checkout above, which would work against us here.
+ * But for an empty repo, find_remote_branch() can never find
+ * a match.
+ */
+ our_head_points_at = find_remote_branch(mapped_refs, branch);
}
write_refspec_config(src_ref_prefix, our_head_points_at,
@@ -1330,7 +1338,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
branch_top.buf, reflog_msg.buf, transport,
!is_local);
- update_head(our_head_points_at, remote_head, reflog_msg.buf);
+ update_head(our_head_points_at, remote_head, unborn_head, reflog_msg.buf);
/*
* We want to show progress for recursive submodule clones iff
@@ -1357,6 +1365,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
strbuf_release(&key);
free_refs(mapped_refs);
free_refs(remote_head_points_at);
+ free(unborn_head);
free(dir);
free(path);
UNLEAK(repo);
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index 2bfaf9b..92cf6e1 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -80,9 +80,9 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
result = -1;
goto cleanup;
}
-cleanup:
result = run_diff_files(&rev, options);
result = diff_result_code(&rev.diffopt, result);
+cleanup:
release_revisions(&rev);
return result;
}
diff --git a/builtin/mktree.c b/builtin/mktree.c
index 902edba..06d8140 100644
--- a/builtin/mktree.c
+++ b/builtin/mktree.c
@@ -74,6 +74,7 @@ static void mktree_line(char *buf, int nul_term_line, int allow_missing)
unsigned mode;
enum object_type mode_type; /* object type derived from mode */
enum object_type obj_type; /* object type derived from sha */
+ struct object_info oi = OBJECT_INFO_INIT;
char *path, *to_free = NULL;
struct object_id oid;
@@ -116,8 +117,14 @@ static void mktree_line(char *buf, int nul_term_line, int allow_missing)
path, ptr, type_name(mode_type));
}
- /* Check the type of object identified by sha1 */
- obj_type = oid_object_info(the_repository, &oid, NULL);
+ /* Check the type of object identified by oid without fetching objects */
+ oi.typep = &obj_type;
+ if (oid_object_info_extended(the_repository, &oid, &oi,
+ OBJECT_INFO_LOOKUP_REPLACE |
+ OBJECT_INFO_QUICK |
+ OBJECT_INFO_SKIP_FETCH_OBJECT) < 0)
+ obj_type = -1;
+
if (obj_type < 0) {
if (allow_missing) {
; /* no problem - missing objects are presumed to be of the right type */
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 35825f0..086dfee 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -443,7 +443,7 @@ void shortlog_output(struct shortlog *log)
struct strbuf sb = STRBUF_INIT;
if (log->sort_by_number)
- QSORT(log->list.items, log->list.nr,
+ STABLE_QSORT(log->list.items, log->list.nr,
log->summary ? compare_by_counter : compare_by_list);
for (i = 0; i < log->list.nr; i++) {
const struct string_list_item *item = &log->list.items[i];
diff --git a/combine-diff.c b/combine-diff.c
index b724f02..b0ece95 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1498,6 +1498,13 @@ void diff_tree_combined(const struct object_id *oid,
int i, num_paths, needsep, show_log_first, num_parent = parents->nr;
int need_generic_pathscan;
+ if (opt->ignore_regex_nr)
+ die("combined diff and '%s' cannot be used together",
+ "--ignore-matching-lines");
+ if (opt->close_file)
+ die("combined diff and '%s' cannot be used together",
+ "--output");
+
/* nothing to do, if no parents */
if (!num_parent)
return;
diff --git a/compat/mingw.c b/compat/mingw.c
index 2607de9..b550299 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1059,10 +1059,7 @@ char *mingw_mktemp(char *template)
int mkstemp(char *template)
{
- char *filename = mktemp(template);
- if (!filename)
- return -1;
- return open(filename, O_RDWR | O_CREAT, 0600);
+ return git_mkstemp_mode(template, 0600);
}
int gettimeofday(struct timeval *tv, void *tz)
diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index 0b44a9b..bf77748 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -168,7 +168,7 @@ int main(int argc, const char **argv)
"usage: git credential-osxkeychain <get|store|erase>";
if (!argv[1])
- die(usage);
+ die("%s", usage);
read_credential();
diff --git a/contrib/vscode/init.sh b/contrib/vscode/init.sh
index f139fd8..521d303 100755
--- a/contrib/vscode/init.sh
+++ b/contrib/vscode/init.sh
@@ -25,8 +25,12 @@ cat >.vscode/settings.json.new <<\EOF ||
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.tabSize": 8,
- "editor.wordWrap": "wordWrapColumn",
- "editor.wordWrapColumn": 80,
+ "files.trimTrailingWhitespace": true
+ },
+ "[txt]": {
+ "editor.detectIndentation": false,
+ "editor.insertSpaces": false,
+ "editor.tabSize": 8,
"files.trimTrailingWhitespace": true
},
"files.associations": {
diff --git a/daemon.c b/daemon.c
index 58f1077..0ae7d12 100644
--- a/daemon.c
+++ b/daemon.c
@@ -279,7 +279,7 @@ static const char *path_ok(const char *directory, struct hostinfo *hi)
/* The validation is done on the paths after enter_repo
* appends optional {.git,.git/.git} and friends, but
* it does not use getcwd(). So if your /pub is
- * a symlink to /mnt/pub, you can whitelist /pub and
+ * a symlink to /mnt/pub, you can include /pub and
* do not have to say /mnt/pub.
* Do not say /pub/.
*/
@@ -298,7 +298,7 @@ static const char *path_ok(const char *directory, struct hostinfo *hi)
return path;
}
- logerror("'%s': not in whitelist", path);
+ logerror("'%s': not in directory list", path);
return NULL; /* Fallthrough. Deny by default */
}
@@ -403,7 +403,7 @@ static int run_service(const char *dir, struct daemon_service *service,
* a "git-daemon-export-ok" flag that says that the other side
* is ok with us doing this.
*
- * path_ok() uses enter_repo() and does whitelist checking.
+ * path_ok() uses enter_repo() and checks for included directories.
* We only need to make sure the repository is exported.
*/
@@ -1444,7 +1444,7 @@ int cmd_main(int argc, const char **argv)
cred = prepare_credentials(user_name, group_name);
if (strict_paths && (!ok_paths || !*ok_paths))
- die("option --strict-paths requires a whitelist");
+ die("option --strict-paths requires '<directory>' arguments");
if (base_path && !is_directory(base_path))
die("base-path '%s' does not exist or is not a directory",
diff --git a/dir.c b/dir.c
index 6ca2ef5..d7cfb08 100644
--- a/dir.c
+++ b/dir.c
@@ -1861,7 +1861,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
*/
enum path_treatment state;
int matches_how = 0;
- int nested_repo = 0, check_only, stop_early;
+ int check_only, stop_early;
int old_ignored_nr, old_untracked_nr;
/* The "len-1" is to strip the final '/' */
enum exist_status status = directory_exists_in_index(istate, dirname, len-1);
@@ -1893,16 +1893,37 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
if ((dir->flags & DIR_SKIP_NESTED_GIT) ||
!(dir->flags & DIR_NO_GITLINKS)) {
+ /*
+ * Determine if `dirname` is a nested repo by confirming that:
+ * 1) we are in a nonbare repository, and
+ * 2) `dirname` is not an immediate parent of `the_repository->gitdir`,
+ * which could occur if the git_dir or worktree location was
+ * manually configured by the user; see t2205 testcases 1-3 for
+ * examples where this matters
+ */
+ int nested_repo;
struct strbuf sb = STRBUF_INIT;
strbuf_addstr(&sb, dirname);
nested_repo = is_nonbare_repository_dir(&sb);
+
+ if (nested_repo) {
+ char *real_dirname, *real_gitdir;
+ strbuf_addstr(&sb, ".git");
+ real_dirname = real_pathdup(sb.buf, 1);
+ real_gitdir = real_pathdup(the_repository->gitdir, 1);
+
+ nested_repo = !!strcmp(real_dirname, real_gitdir);
+ free(real_gitdir);
+ free(real_dirname);
+ }
strbuf_release(&sb);
- }
- if (nested_repo) {
- if ((dir->flags & DIR_SKIP_NESTED_GIT) ||
- (matches_how == MATCHED_RECURSIVELY_LEADING_PATHSPEC))
- return path_none;
- return excluded ? path_excluded : path_untracked;
+
+ if (nested_repo) {
+ if ((dir->flags & DIR_SKIP_NESTED_GIT) ||
+ (matches_how == MATCHED_RECURSIVELY_LEADING_PATHSPEC))
+ return path_none;
+ return excluded ? path_excluded : path_untracked;
+ }
}
if (!(dir->flags & DIR_SHOW_OTHER_DIRECTORIES)) {
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 4c81180..7b75736 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -152,7 +152,7 @@ $state->{allowed_roots} = [ @ARGV ];
# don't export the whole system unless the users requests it
if ($state->{'export-all'} && !@{$state->{allowed_roots}}) {
- die "--export-all can only be used together with an explicit whitelist\n";
+ die "--export-all can only be used together with an explicit '<directory>...' list\n";
}
# Environment handling for running under git-shell
diff --git a/merge-ort.c b/merge-ort.c
index b5015b9..8c4927f 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -2260,6 +2260,27 @@ static void compute_collisions(struct strmap *collisions,
}
}
+static void free_collisions(struct strmap *collisions)
+{
+ struct hashmap_iter iter;
+ struct strmap_entry *entry;
+
+ /* Free each value in the collisions map */
+ strmap_for_each_entry(collisions, &iter, entry) {
+ struct collision_info *info = entry->value;
+ string_list_clear(&info->source_files, 0);
+ }
+ /*
+ * In compute_collisions(), we set collisions.strdup_strings to 0
+ * so that we wouldn't have to make another copy of the new_path
+ * allocated by apply_dir_rename(). But now that we've used them
+ * and have no other references to these strings, it is time to
+ * deallocate them.
+ */
+ free_strmap_strings(collisions);
+ strmap_clear(collisions, 1);
+}
+
static char *check_for_directory_rename(struct merge_options *opt,
const char *path,
unsigned side_index,
@@ -2268,18 +2289,23 @@ static char *check_for_directory_rename(struct merge_options *opt,
struct strmap *collisions,
int *clean_merge)
{
- char *new_path = NULL;
+ char *new_path;
struct strmap_entry *rename_info;
- struct strmap_entry *otherinfo = NULL;
+ struct strmap_entry *otherinfo;
const char *new_dir;
+ int other_side = 3 - side_index;
+ /*
+ * Cases where we don't have or don't want a directory rename for
+ * this path.
+ */
if (strmap_empty(dir_renames))
- return new_path;
+ return NULL;
+ if (strmap_get(&collisions[other_side], path))
+ return NULL;
rename_info = check_dir_renamed(path, dir_renames);
if (!rename_info)
- return new_path;
- /* old_dir = rename_info->key; */
- new_dir = rename_info->value;
+ return NULL;
/*
* This next part is a little weird. We do not want to do an
@@ -2305,6 +2331,7 @@ static char *check_for_directory_rename(struct merge_options *opt,
* As it turns out, this also prevents N-way transient rename
* confusion; See testcases 9c and 9d of t6043.
*/
+ new_dir = rename_info->value; /* old_dir = rename_info->key; */
otherinfo = strmap_get_entry(dir_rename_exclusions, new_dir);
if (otherinfo) {
path_msg(opt, rename_info->key, 1,
@@ -2315,7 +2342,8 @@ static char *check_for_directory_rename(struct merge_options *opt,
}
new_path = handle_path_level_conflicts(opt, path, side_index,
- rename_info, collisions);
+ rename_info,
+ &collisions[side_index]);
*clean_merge &= (new_path != NULL);
return new_path;
@@ -3024,18 +3052,15 @@ static int detect_regular_renames(struct merge_options *opt,
static int collect_renames(struct merge_options *opt,
struct diff_queue_struct *result,
unsigned side_index,
+ struct strmap *collisions,
struct strmap *dir_renames_for_side,
struct strmap *rename_exclusions)
{
int i, clean = 1;
- struct strmap collisions;
struct diff_queue_struct *side_pairs;
- struct hashmap_iter iter;
- struct strmap_entry *entry;
struct rename_info *renames = &opt->priv->renames;
side_pairs = &renames->pairs[side_index];
- compute_collisions(&collisions, dir_renames_for_side, side_pairs);
for (i = 0; i < side_pairs->nr; ++i) {
struct diff_filepair *p = side_pairs->queue[i];
@@ -3051,7 +3076,7 @@ static int collect_renames(struct merge_options *opt,
side_index,
dir_renames_for_side,
rename_exclusions,
- &collisions,
+ collisions,
&clean);
possibly_cache_new_pair(renames, p, side_index, new_path);
@@ -3077,20 +3102,6 @@ static int collect_renames(struct merge_options *opt,
result->queue[result->nr++] = p;
}
- /* Free each value in the collisions map */
- strmap_for_each_entry(&collisions, &iter, entry) {
- struct collision_info *info = entry->value;
- string_list_clear(&info->source_files, 0);
- }
- /*
- * In compute_collisions(), we set collisions.strdup_strings to 0
- * so that we wouldn't have to make another copy of the new_path
- * allocated by apply_dir_rename(). But now that we've used them
- * and have no other references to these strings, it is time to
- * deallocate them.
- */
- free_strmap_strings(&collisions);
- strmap_clear(&collisions, 1);
return clean;
}
@@ -3101,6 +3112,7 @@ static int detect_and_process_renames(struct merge_options *opt,
{
struct diff_queue_struct combined = { 0 };
struct rename_info *renames = &opt->priv->renames;
+ struct strmap collisions[3];
int need_dir_renames, s, i, clean = 1;
unsigned detection_run = 0;
@@ -3150,12 +3162,22 @@ static int detect_and_process_renames(struct merge_options *opt,
ALLOC_GROW(combined.queue,
renames->pairs[1].nr + renames->pairs[2].nr,
combined.alloc);
+ for (i = MERGE_SIDE1; i <= MERGE_SIDE2; i++) {
+ int other_side = 3 - i;
+ compute_collisions(&collisions[i],
+ &renames->dir_renames[other_side],
+ &renames->pairs[i]);
+ }
clean &= collect_renames(opt, &combined, MERGE_SIDE1,
+ collisions,
&renames->dir_renames[2],
&renames->dir_renames[1]);
clean &= collect_renames(opt, &combined, MERGE_SIDE2,
+ collisions,
&renames->dir_renames[1],
&renames->dir_renames[2]);
+ for (i = MERGE_SIDE1; i <= MERGE_SIDE2; i++)
+ free_collisions(&collisions[i]);
STABLE_QSORT(combined.queue, combined.nr, compare_pairs);
trace2_region_leave("merge", "directory renames", opt->repo);
diff --git a/mergetools/vimdiff b/mergetools/vimdiff
index 461a89b..f770b8f 100644
--- a/mergetools/vimdiff
+++ b/mergetools/vimdiff
@@ -228,14 +228,14 @@ gen_cmd_aux () {
elif ! test -z "$index_horizontal_split"
then
- before="split"
+ before="leftabove split"
after="wincmd j"
index=$index_horizontal_split
terminate="true"
elif ! test -z "$index_vertical_split"
then
- before="vertical split"
+ before="leftabove vertical split"
after="wincmd l"
index=$index_vertical_split
terminate="true"
@@ -310,7 +310,7 @@ gen_cmd () {
#
# gen_cmd "@LOCAL , REMOTE"
# |
- # `-> FINAL_CMD == "-c \"echo | vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
+ # `-> FINAL_CMD == "-c \"echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
# FINAL_TARGET == "LOCAL"
LAYOUT=$1
@@ -414,8 +414,8 @@ merge_cmd () {
if $base_present
then
- eval "$merge_tool_path" \
- -f "$FINAL_CMD" "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
+ eval '"$merge_tool_path"' \
+ -f "$FINAL_CMD" '"$LOCAL"' '"$BASE"' '"$REMOTE"' '"$MERGED"'
else
# If there is no BASE (example: a merge conflict in a new file
# with the same name created in both braches which didn't exist
@@ -424,8 +424,8 @@ merge_cmd () {
FINAL_CMD=$(echo "$FINAL_CMD" | \
sed -e 's:2b:quit:g' -e 's:3b:2b:g' -e 's:4b:3b:g')
- eval "$merge_tool_path" \
- -f "$FINAL_CMD" "$LOCAL" "$REMOTE" "$MERGED"
+ eval '"$merge_tool_path"' \
+ -f "$FINAL_CMD" '"$LOCAL"' '"$REMOTE"' '"$MERGED"'
fi
ret="$?"
@@ -555,22 +555,22 @@ run_unit_tests () {
TEST_CASE_15=" (( (LOCAL , BASE , REMOTE) / MERGED)) +(BASE) , LOCAL+ BASE , REMOTE+ (((LOCAL / BASE / REMOTE)) , MERGED ) "
TEST_CASE_16="LOCAL,BASE,REMOTE / MERGED + BASE,LOCAL + BASE,REMOTE + (LOCAL / BASE / REMOTE),MERGED"
- EXPECTED_CMD_01="-c \"echo | split | vertical split | 1b | wincmd l | vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_02="-c \"echo | vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_03="-c \"echo | vertical split | 1b | wincmd l | vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_01="-c \"echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_02="-c \"echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_03="-c \"echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
EXPECTED_CMD_04="-c \"echo | 4b | bufdo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_05="-c \"echo | split | 1b | wincmd j | split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_06="-c \"echo | vertical split | split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_07="-c \"echo | vertical split | 4b | wincmd l | split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_08="-c \"echo | split | vertical split | 1b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_09="-c \"echo | split | 4b | wincmd j | vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_10="-c \"echo | vertical split | split | 1b | wincmd j | split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_11="-c \"echo | -tabnew | split | vertical split | 1b | wincmd l | vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | vertical split | 2b | wincmd l | 3b | tabnext | vertical split | split | 1b | wincmd j | split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_12="-c \"echo | vertical split | split | vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_13="-c \"echo | vertical split | split | vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | vertical split | split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_14="-c \"echo | -tabnew | vertical split | 2b | wincmd l | 3b | tabnext | vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_15="-c \"echo | -tabnew | split | vertical split | 1b | wincmd l | vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | vertical split | 2b | wincmd l | 3b | tabnext | vertical split | split | 1b | wincmd j | split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
- EXPECTED_CMD_16="-c \"echo | -tabnew | split | vertical split | 1b | wincmd l | vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | vertical split | 2b | wincmd l | 3b | tabnext | vertical split | split | 1b | wincmd j | split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_05="-c \"echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_06="-c \"echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_07="-c \"echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_08="-c \"echo | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_09="-c \"echo | leftabove split | 4b | wincmd j | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_10="-c \"echo | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_11="-c \"echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_12="-c \"echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_13="-c \"echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_14="-c \"echo | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_15="-c \"echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
+ EXPECTED_CMD_16="-c \"echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
EXPECTED_TARGET_01="MERGED"
EXPECTED_TARGET_02="LOCAL"
@@ -614,6 +614,37 @@ run_unit_tests () {
fi
done
+ # verify that `merge_cmd` handles paths with spaces
+ record_parameters () {
+ >actual
+ for arg
+ do
+ echo "$arg" >>actual
+ done
+ }
+
+ base_present=false
+ LOCAL='lo cal'
+ BASE='ba se'
+ REMOTE="' '"
+ MERGED='mer ged'
+ merge_tool_path=record_parameters
+
+ merge_cmd vimdiff || at_least_one_ko=true
+
+ cat >expect <<-\EOF
+ -f
+ -c
+ echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | quit | wincmd l | 2b | wincmd j | 3b | tabdo windo diffthis
+ -c
+ tabfirst
+ lo cal
+ ' '
+ mer ged
+ EOF
+
+ diff -u expect actual || at_least_one_ko=true
+
if test "$at_least_one_ko" = "true"
then
return 255
diff --git a/pack-objects.h b/pack-objects.h
index 393b9db..5794766 100644
--- a/pack-objects.h
+++ b/pack-objects.h
@@ -116,16 +116,6 @@ struct object_entry {
unsigned dfs_state:OE_DFS_STATE_BITS;
unsigned depth:OE_DEPTH_BITS;
unsigned ext_base:1; /* delta_idx points outside packlist */
-
- /*
- * pahole results on 64-bit linux (gcc and clang)
- *
- * size: 80, bit_padding: 9 bits
- *
- * and on 32-bit (gcc)
- *
- * size: 76, bit_padding: 9 bits
- */
};
struct packing_data {
diff --git a/setup.c b/setup.c
index 7f64f34..09b6549 100644
--- a/setup.c
+++ b/setup.c
@@ -1451,7 +1451,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
* find a repository.
*/
default:
- BUG("unhandled setup_git_directory_1() result");
+ BUG("unhandled setup_git_directory_gently_1() result");
}
/*
diff --git a/t/README b/t/README
index 309a311..4f9981c 100644
--- a/t/README
+++ b/t/README
@@ -547,6 +547,61 @@ This test harness library does the following things:
consistently when command line arguments --verbose (or -v),
--debug (or -d), and --immediate (or -i) is given.
+Recommended style
+-----------------
+Here are some recommented styles when writing test case.
+
+ - Keep test title the same line with test helper function itself.
+
+ Take test_expect_success helper for example, write it like:
+
+ test_expect_success 'test title' '
+ ... test body ...
+ '
+
+ Instead of:
+
+ test_expect_success \
+ 'test title' \
+ '... test body ...'
+
+
+ - End the line with a single quote.
+
+ - Indent the body of here-document, and use "<<-" instead of "<<"
+ to strip leading TABs used for indentation:
+
+ test_expect_success 'test something' '
+ cat >expect <<-\EOF &&
+ one
+ two
+ three
+ EOF
+ test_something > actual &&
+ test_cmp expect actual
+ '
+
+ Instead of:
+
+ test_expect_success 'test something' '
+ cat >expect <<\EOF &&
+ one
+ two
+ three
+ EOF
+ test_something > actual &&
+ test_cmp expect actual
+ '
+
+ - Quote or escape the EOF delimiter that begins a here-document if
+ there is no parameter and other expansion in it, to signal readers
+ that they can skim it more casually:
+
+ cmd <<-\EOF
+ literal here-document text without any expansion
+ EOF
+
+
Do's & don'ts
-------------
diff --git a/t/lib-proto-disable.sh b/t/lib-proto-disable.sh
index 83babe5..890622b 100644
--- a/t/lib-proto-disable.sh
+++ b/t/lib-proto-disable.sh
@@ -1,7 +1,7 @@
# Test routines for checking protocol disabling.
-# Test clone/fetch/push with GIT_ALLOW_PROTOCOL whitelist
-test_whitelist () {
+# Test clone/fetch/push with GIT_ALLOW_PROTOCOL environment variable
+test_allow_var () {
desc=$1
proto=$2
url=$3
@@ -183,7 +183,7 @@ test_config () {
# $2 - machine-readable name of the protocol
# $3 - the URL to try cloning
test_proto () {
- test_whitelist "$@"
+ test_allow_var "$@"
test_config "$@"
}
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index d3d9adb..c6661e6 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -2083,12 +2083,13 @@ test_expect_success '--show-scope with --show-origin' '
'
test_expect_success 'override global and system config' '
- test_when_finished rm -f "$HOME"/.config/git &&
-
+ test_when_finished rm -f \"\$HOME\"/.gitconfig &&
cat >"$HOME"/.gitconfig <<-EOF &&
[home]
config = true
EOF
+
+ test_when_finished rm -rf \"\$HOME\"/.config/git &&
mkdir -p "$HOME"/.config/git &&
cat >"$HOME"/.config/git/config <<-EOF &&
[xdg]
diff --git a/t/t2205-add-worktree-config.sh b/t/t2205-add-worktree-config.sh
new file mode 100755
index 0000000..43d950d
--- /dev/null
+++ b/t/t2205-add-worktree-config.sh
@@ -0,0 +1,265 @@
+#!/bin/sh
+
+test_description='directory traversal respects user config
+
+This test verifies the traversal of the directory tree when the traversal begins
+outside the repository. Two instances for which this can occur are tested:
+
+ 1) The user manually sets the worktree. For this instance, the test sets
+ the worktree two levels above the `.git` directory and checks whether we
+ are able to add to the index those files that are in either (1) the
+ manually configured worktree directory or (2) the standard worktree
+ location with respect to the `.git` directory (i.e. ensuring that the
+ encountered `.git` directory is not treated as belonging to a foreign
+ nested repository).
+ 2) The user manually sets the `git_dir` while the working directory is
+ outside the repository. The test checks that files inside the
+ repository can be added to the index.
+ '
+
+. ./test-lib.sh
+
+test_expect_success '1a: setup--config worktree' '
+ mkdir test1 &&
+ (
+ cd test1 &&
+ test_create_repo repo &&
+ git --git-dir="repo/.git" config core.worktree "$(pwd)" &&
+
+ mkdir -p outside-tracked outside-untracked &&
+ mkdir -p repo/inside-tracked repo/inside-untracked &&
+ >file-tracked &&
+ >file-untracked &&
+ >outside-tracked/file &&
+ >outside-untracked/file &&
+ >repo/file-tracked &&
+ >repo/file-untracked &&
+ >repo/inside-tracked/file &&
+ >repo/inside-untracked/file &&
+
+ cat >expect-tracked-unsorted <<-EOF &&
+ ../file-tracked
+ ../outside-tracked/file
+ file-tracked
+ inside-tracked/file
+ EOF
+
+ cat >expect-untracked-unsorted <<-EOF &&
+ ../file-untracked
+ ../outside-untracked/file
+ file-untracked
+ inside-untracked/file
+ EOF
+
+ cat >expect-all-dir-unsorted <<-EOF &&
+ ../file-untracked
+ ../file-tracked
+ ../outside-untracked/
+ ../outside-tracked/
+ ./
+ EOF
+
+ cat expect-tracked-unsorted expect-untracked-unsorted >expect-all-unsorted &&
+
+ cat >.gitignore <<-EOF
+ .gitignore
+ actual-*
+ expect-*
+ EOF
+ )
+'
+
+test_expect_success '1b: pre-add all' '
+ (
+ cd test1 &&
+ local parent_dir="$(pwd)" &&
+ git -C repo ls-files -o --exclude-standard "$parent_dir" >actual-all-unsorted &&
+ sort actual-all-unsorted >actual-all &&
+ sort expect-all-unsorted >expect-all &&
+ test_cmp expect-all actual-all
+ )
+'
+
+test_expect_success '1c: pre-add dir all' '
+ (
+ cd test1 &&
+ local parent_dir="$(pwd)" &&
+ git -C repo ls-files -o --directory --exclude-standard "$parent_dir" >actual-all-dir-unsorted &&
+ sort actual-all-dir-unsorted >actual-all &&
+ sort expect-all-dir-unsorted >expect-all &&
+ test_cmp expect-all actual-all
+ )
+'
+
+test_expect_success '1d: post-add tracked' '
+ (
+ cd test1 &&
+ local parent_dir="$(pwd)" &&
+ (
+ cd repo &&
+ git add file-tracked &&
+ git add inside-tracked &&
+ git add ../outside-tracked &&
+ git add "$parent_dir/file-tracked" &&
+ git ls-files "$parent_dir" >../actual-tracked-unsorted
+ ) &&
+ sort actual-tracked-unsorted >actual-tracked &&
+ sort expect-tracked-unsorted >expect-tracked &&
+ test_cmp expect-tracked actual-tracked
+ )
+'
+
+test_expect_success '1e: post-add untracked' '
+ (
+ cd test1 &&
+ local parent_dir="$(pwd)" &&
+ git -C repo ls-files -o --exclude-standard "$parent_dir" >actual-untracked-unsorted &&
+ sort actual-untracked-unsorted >actual-untracked &&
+ sort expect-untracked-unsorted >expect-untracked &&
+ test_cmp expect-untracked actual-untracked
+ )
+'
+
+test_expect_success '2a: setup--set git-dir' '
+ mkdir test2 &&
+ (
+ cd test2 &&
+ test_create_repo repo &&
+ # create two foreign repositories that should remain untracked
+ test_create_repo repo-outside &&
+ test_create_repo repo/repo-inside &&
+
+ mkdir -p repo/inside-tracked repo/inside-untracked &&
+ >repo/file-tracked &&
+ >repo/file-untracked &&
+ >repo/inside-tracked/file &&
+ >repo/inside-untracked/file &&
+ >repo-outside/file &&
+ >repo/repo-inside/file &&
+
+ cat >expect-tracked-unsorted <<-EOF &&
+ repo/file-tracked
+ repo/inside-tracked/file
+ EOF
+
+ cat >expect-untracked-unsorted <<-EOF &&
+ repo/file-untracked
+ repo/inside-untracked/file
+ repo/repo-inside/
+ repo-outside/
+ EOF
+
+ cat >expect-all-dir-unsorted <<-EOF &&
+ repo/
+ repo-outside/
+ EOF
+
+ cat expect-tracked-unsorted expect-untracked-unsorted >expect-all-unsorted &&
+
+ cat >.gitignore <<-EOF
+ .gitignore
+ actual-*
+ expect-*
+ EOF
+ )
+'
+
+test_expect_success '2b: pre-add all' '
+ (
+ cd test2 &&
+ git --git-dir=repo/.git ls-files -o --exclude-standard >actual-all-unsorted &&
+ sort actual-all-unsorted >actual-all &&
+ sort expect-all-unsorted >expect-all &&
+ test_cmp expect-all actual-all
+ )
+'
+
+test_expect_success '2c: pre-add dir all' '
+ (
+ cd test2 &&
+ git --git-dir=repo/.git ls-files -o --directory --exclude-standard >actual-all-dir-unsorted &&
+ sort actual-all-dir-unsorted >actual-all &&
+ sort expect-all-dir-unsorted >expect-all &&
+ test_cmp expect-all actual-all
+ )
+'
+
+test_expect_success '2d: post-add tracked' '
+ (
+ cd test2 &&
+ git --git-dir=repo/.git add repo/file-tracked &&
+ git --git-dir=repo/.git add repo/inside-tracked &&
+ git --git-dir=repo/.git ls-files >actual-tracked-unsorted &&
+ sort actual-tracked-unsorted >actual-tracked &&
+ sort expect-tracked-unsorted >expect-tracked &&
+ test_cmp expect-tracked actual-tracked
+ )
+'
+
+test_expect_success '2e: post-add untracked' '
+ (
+ cd test2 &&
+ git --git-dir=repo/.git ls-files -o --exclude-standard >actual-untracked-unsorted &&
+ sort actual-untracked-unsorted >actual-untracked &&
+ sort expect-untracked-unsorted >expect-untracked &&
+ test_cmp expect-untracked actual-untracked
+ )
+'
+
+test_expect_success '3a: setup--add repo dir' '
+ mkdir test3 &&
+ (
+ cd test3 &&
+ test_create_repo repo &&
+
+ mkdir -p repo/inside-tracked repo/inside-ignored &&
+ >repo/file-tracked &&
+ >repo/file-ignored &&
+ >repo/inside-tracked/file &&
+ >repo/inside-ignored/file &&
+
+ cat >.gitignore <<-EOF &&
+ .gitignore
+ actual-*
+ expect-*
+ *ignored
+ EOF
+
+ cat >expect-tracked-unsorted <<-EOF &&
+ repo/file-tracked
+ repo/inside-tracked/file
+ EOF
+
+ cat >expect-ignored-unsorted <<-EOF
+ repo/file-ignored
+ repo/inside-ignored/
+ .gitignore
+ actual-ignored-unsorted
+ expect-ignored-unsorted
+ expect-tracked-unsorted
+ EOF
+ )
+'
+
+test_expect_success '3b: ignored' '
+ (
+ cd test3 &&
+ git --git-dir=repo/.git ls-files -io --directory --exclude-standard >actual-ignored-unsorted &&
+ sort actual-ignored-unsorted >actual-ignored &&
+ sort expect-ignored-unsorted >expect-ignored &&
+ test_cmp expect-ignored actual-ignored
+ )
+'
+
+test_expect_success '3c: add repo' '
+ (
+ cd test3 &&
+ git --git-dir=repo/.git add repo &&
+ git --git-dir=repo/.git ls-files >actual-tracked-unsorted &&
+ sort actual-tracked-unsorted >actual-tracked &&
+ sort expect-tracked-unsorted >expect-tracked &&
+ test_cmp expect-tracked actual-tracked
+ )
+'
+
+test_done
diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
index 48cec4e..e07ac6c 100755
--- a/t/t3001-ls-files-others-exclude.sh
+++ b/t/t3001-ls-files-others-exclude.sh
@@ -67,26 +67,26 @@ echo '!*.2
allignores='.gitignore one/.gitignore one/two/.gitignore'
-test_expect_success \
- 'git ls-files --others with various exclude options.' \
- 'git ls-files --others \
+test_expect_success 'git ls-files --others with various exclude options.' '
+ git ls-files --others \
--exclude=\*.6 \
--exclude-per-directory=.gitignore \
--exclude-from=.git/ignore \
- >output &&
- test_cmp expect output'
+ >output &&
+ test_cmp expect output
+'
# Test \r\n (MSDOS-like systems)
printf '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore
-test_expect_success \
- 'git ls-files --others with \r\n line endings.' \
- 'git ls-files --others \
+test_expect_success 'git ls-files --others with \r\n line endings.' '
+ git ls-files --others \
--exclude=\*.6 \
--exclude-per-directory=.gitignore \
--exclude-from=.git/ignore \
- >output &&
- test_cmp expect output'
+ >output &&
+ test_cmp expect output
+'
test_expect_success 'setup skip-worktree gitignore' '
git add $allignores &&
@@ -94,14 +94,14 @@ test_expect_success 'setup skip-worktree gitignore' '
rm $allignores
'
-test_expect_success \
- 'git ls-files --others with various exclude options.' \
- 'git ls-files --others \
+test_expect_success 'git ls-files --others with various exclude options.' '
+ git ls-files --others \
--exclude=\*.6 \
--exclude-per-directory=.gitignore \
--exclude-from=.git/ignore \
- >output &&
- test_cmp expect output'
+ >output &&
+ test_cmp expect output
+'
test_expect_success !SANITIZE_LEAK 'restore gitignore' '
git checkout --ignore-skip-worktree-bits $allignores &&
@@ -283,12 +283,12 @@ test_expect_success 'pattern matches prefix completely' '
'
test_expect_success 'ls-files with "**" patterns' '
- cat <<\EOF >expect &&
-a.1
-one/a.1
-one/two/a.1
-three/a.1
-EOF
+ cat <<-\EOF >expect &&
+ a.1
+ one/a.1
+ one/two/a.1
+ three/a.1
+ EOF
git ls-files -o -i --exclude "**/a.1" >actual &&
test_cmp expect actual
'
diff --git a/t/t3002-ls-files-dashpath.sh b/t/t3002-ls-files-dashpath.sh
index 54d22a4..4dd2455 100755
--- a/t/t3002-ls-files-dashpath.sh
+++ b/t/t3002-ls-files-dashpath.sh
@@ -16,56 +16,62 @@ filesystem.
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
-test_expect_success \
- setup \
- 'echo frotz >path0 &&
+test_expect_success 'setup' '
+ echo frotz >path0 &&
echo frotz >./-foo &&
- echo frotz >./--'
+ echo frotz >./--
+'
-test_expect_success \
- 'git ls-files without path restriction.' \
- 'git ls-files --others >output &&
- test_cmp output - <<EOF
---
--foo
-output
-path0
-EOF
+test_expect_success 'git ls-files without path restriction.' '
+ test_when_finished "rm -f expect" &&
+ git ls-files --others >output &&
+ cat >expect <<-\EOF &&
+ --
+ -foo
+ output
+ path0
+ EOF
+ test_cmp output expect
'
-test_expect_success \
- 'git ls-files with path restriction.' \
- 'git ls-files --others path0 >output &&
- test_cmp output - <<EOF
-path0
-EOF
+test_expect_success 'git ls-files with path restriction.' '
+ test_when_finished "rm -f expect" &&
+ git ls-files --others path0 >output &&
+ cat >expect <<-\EOF &&
+ path0
+ EOF
+ test_cmp output expect
'
-test_expect_success \
- 'git ls-files with path restriction with --.' \
- 'git ls-files --others -- path0 >output &&
- test_cmp output - <<EOF
-path0
-EOF
+test_expect_success 'git ls-files with path restriction with --.' '
+ test_when_finished "rm -f expect" &&
+ git ls-files --others -- path0 >output &&
+ cat >expect <<-\EOF &&
+ path0
+ EOF
+ test_cmp output expect
'
-test_expect_success \
- 'git ls-files with path restriction with -- --.' \
- 'git ls-files --others -- -- >output &&
- test_cmp output - <<EOF
---
-EOF
+test_expect_success 'git ls-files with path restriction with -- --.' '
+ test_when_finished "rm -f expect" &&
+ git ls-files --others -- -- >output &&
+ cat >expect <<-\EOF &&
+ --
+ EOF
+ test_cmp output expect
'
-test_expect_success \
- 'git ls-files with no path restriction.' \
- 'git ls-files --others -- >output &&
- test_cmp output - <<EOF
---
--foo
-output
-path0
-EOF
+test_expect_success 'git ls-files with no path restriction.' '
+ test_when_finished "rm -f expect" &&
+ git ls-files --others -- >output &&
+ cat >expect <<-\EOF &&
+ --
+ -foo
+ output
+ path0
+ EOF
+ test_cmp output expect
+
'
test_done
diff --git a/t/t3020-ls-files-error-unmatch.sh b/t/t3020-ls-files-error-unmatch.sh
index 2cbcbc0..133593d 100755
--- a/t/t3020-ls-files-error-unmatch.sh
+++ b/t/t3020-ls-files-error-unmatch.sh
@@ -19,12 +19,12 @@ test_expect_success 'setup' '
git commit -m "add foo bar"
'
-test_expect_success \
- 'git ls-files --error-unmatch should fail with unmatched path.' \
- 'test_must_fail git ls-files --error-unmatch foo bar-does-not-match'
+test_expect_success 'git ls-files --error-unmatch should fail with unmatched path.' '
+ test_must_fail git ls-files --error-unmatch foo bar-does-not-match
+'
-test_expect_success \
- 'git ls-files --error-unmatch should succeed with matched paths.' \
- 'git ls-files --error-unmatch foo bar'
+test_expect_success 'git ls-files --error-unmatch should succeed with matched paths.' '
+ git ls-files --error-unmatch foo bar
+'
test_done
diff --git a/t/t3060-ls-files-with-tree.sh b/t/t3060-ls-files-with-tree.sh
index b257c79..52f76f7 100755
--- a/t/t3060-ls-files-with-tree.sh
+++ b/t/t3060-ls-files-with-tree.sh
@@ -10,7 +10,7 @@ a scenario known to trigger a crash with some versions of git.
'
. ./test-lib.sh
-test_expect_success setup '
+test_expect_success 'setup' '
# The bug we are exercising requires a fair number of entries
# in a sub-directory so that add_index_entry will trigger a
@@ -62,9 +62,9 @@ test_expect_success 'git ls-files --with-tree should succeed from subdir' '
)
'
-test_expect_success \
- 'git ls-files --with-tree should add entries from named tree.' \
- 'test_cmp expected output'
+test_expect_success 'git ls-files --with-tree should add entries from named tree.' '
+ test_cmp expected output
+'
test_expect_success 'no duplicates in --with-tree output' '
git ls-files --with-tree=HEAD >actual &&
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 8979c8a..8689b48 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -8,7 +8,7 @@ test_description='Test of git add, including the -- option.'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
-. $TEST_DIRECTORY/lib-unique-files.sh
+. "$TEST_DIRECTORY"/lib-unique-files.sh
# Test the file mode "$1" of the file "$2" in the index.
test_mode_in_index () {
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 20e9488..2a4c3fd 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. $TEST_DIRECTORY/lib-unique-files.sh
+. "$TEST_DIRECTORY"/lib-unique-files.sh
test_expect_success 'usage on cmd and subcommand invalid option' '
test_expect_code 129 git stash --invalid-option 2>usage &&
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 4620f0c..b45879a 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -853,7 +853,11 @@ test_configured_prune_type () {
then
new_cmdline=$cmdline_setup
else
- new_cmdline=$(printf "%s" "$cmdline" | perl -pe 's[origin(?!/)]["'"$remote_url"'"]g')
+ new_cmdline=$(perl -e '
+ my ($cmdline, $url) = @ARGV;
+ $cmdline =~ s[origin(?!/)][quotemeta($url)]ge;
+ print $cmdline;
+ ' -- "$cmdline" "$remote_url")
fi
if test "$fetch_prune_tags" = 'true' ||
diff --git a/t/t5605-clone-local.sh b/t/t5605-clone-local.sh
index 21ab619..38b850c 100755
--- a/t/t5605-clone-local.sh
+++ b/t/t5605-clone-local.sh
@@ -21,7 +21,9 @@ test_expect_success 'preparing origin repository' '
git bundle create b2.bundle main &&
mkdir dir &&
cp b1.bundle dir/b3 &&
- cp b1.bundle b4
+ cp b1.bundle b4 &&
+ git branch not-main main &&
+ git bundle create b5.bundle not-main
'
test_expect_success 'local clone without .git suffix' '
@@ -83,11 +85,19 @@ test_expect_success 'bundle clone from b4.bundle that does not exist' '
test_must_fail git clone b4.bundle bb
'
-test_expect_success 'bundle clone with nonexistent HEAD' '
+test_expect_success 'bundle clone with nonexistent HEAD (match default)' '
git clone b2.bundle b2 &&
(cd b2 &&
git fetch &&
- test_must_fail git rev-parse --verify refs/heads/main)
+ git rev-parse --verify refs/heads/main)
+'
+
+test_expect_success 'bundle clone with nonexistent HEAD (no match default)' '
+ git clone b5.bundle b5 &&
+ (cd b5 &&
+ git fetch &&
+ test_must_fail git rev-parse --verify refs/heads/main &&
+ test_must_fail git rev-parse --verify refs/heads/not-main)
'
test_expect_success 'clone empty repository' '
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 00ce9ae..5d42a35 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -250,6 +250,65 @@ test_expect_success 'bare clone propagates empty default branch' '
grep "refs/heads/mydefaultbranch" file_empty_child.git/HEAD
'
+test_expect_success 'clone propagates unborn HEAD from non-empty repo' '
+ test_when_finished "rm -rf file_unborn_parent file_unborn_child" &&
+
+ git init file_unborn_parent &&
+ (
+ cd file_unborn_parent &&
+ git checkout -b branchwithstuff &&
+ test_commit --no-tag stuff &&
+ git symbolic-ref HEAD refs/heads/mydefaultbranch
+ ) &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=main -c protocol.version=2 \
+ clone "file://$(pwd)/file_unborn_parent" \
+ file_unborn_child 2>stderr &&
+ grep "refs/heads/mydefaultbranch" file_unborn_child/.git/HEAD &&
+ grep "warning: remote HEAD refers to nonexistent ref" stderr
+'
+
+test_expect_success 'bare clone propagates unborn HEAD from non-empty repo' '
+ test_when_finished "rm -rf file_unborn_parent file_unborn_child.git" &&
+
+ git init file_unborn_parent &&
+ (
+ cd file_unborn_parent &&
+ git checkout -b branchwithstuff &&
+ test_commit --no-tag stuff &&
+ git symbolic-ref HEAD refs/heads/mydefaultbranch
+ ) &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=main -c protocol.version=2 \
+ clone --bare "file://$(pwd)/file_unborn_parent" \
+ file_unborn_child.git 2>stderr &&
+ grep "refs/heads/mydefaultbranch" file_unborn_child.git/HEAD &&
+ ! grep "warning:" stderr
+'
+
+test_expect_success 'defaulted HEAD uses remote branch if available' '
+ test_when_finished "rm -rf file_unborn_parent file_unborn_child" &&
+
+ git init file_unborn_parent &&
+ (
+ cd file_unborn_parent &&
+ git config lsrefs.unborn ignore &&
+ git checkout -b branchwithstuff &&
+ test_commit --no-tag stuff &&
+ git symbolic-ref HEAD refs/heads/mydefaultbranch
+ ) &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=branchwithstuff -c protocol.version=2 \
+ clone "file://$(pwd)/file_unborn_parent" \
+ file_unborn_child 2>stderr &&
+ grep "refs/heads/branchwithstuff" file_unborn_child/.git/HEAD &&
+ test_path_is_file file_unborn_child/stuff.t &&
+ ! grep "warning:" stderr
+'
+
test_expect_success 'fetch with file:// using protocol v2' '
test_when_finished "rm -f log" &&
diff --git a/t/t5812-proto-disable-http.sh b/t/t5812-proto-disable-http.sh
index af8772f..d8da5f5 100755
--- a/t/t5812-proto-disable-http.sh
+++ b/t/t5812-proto-disable-http.sh
@@ -16,7 +16,7 @@ test_expect_success 'create git-accessible repo' '
test_proto "smart http" http "$HTTPD_URL/smart/repo.git"
-test_expect_success 'curl redirects respect whitelist' '
+test_expect_success 'http(s) transport respects GIT_ALLOW_PROTOCOL' '
test_must_fail env GIT_ALLOW_PROTOCOL=http:https \
GIT_SMART_HTTP=0 \
git clone "$HTTPD_URL/ftp-redir/repo.git" 2>stderr &&
diff --git a/t/t5815-submodule-protos.sh b/t/t5815-submodule-protos.sh
index 06f55a1..4d5956c 100755
--- a/t/t5815-submodule-protos.sh
+++ b/t/t5815-submodule-protos.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='test protocol whitelisting with submodules'
+test_description='test protocol filtering with submodules'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-proto-disable.sh
@@ -36,7 +36,7 @@ test_expect_success 'update of ext not allowed' '
test_must_fail git -C dst submodule update ext-module
'
-test_expect_success 'user can override whitelist' '
+test_expect_success 'user can filter protocols with GIT_ALLOW_PROTOCOL' '
GIT_ALLOW_PROTOCOL=ext git -C dst submodule update ext-module
'
diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh
index 479db32..99baf77 100755
--- a/t/t6423-merge-rename-directories.sh
+++ b/t/t6423-merge-rename-directories.sh
@@ -5199,6 +5199,111 @@ test_expect_success '12k: Directory rename with sibling causes rename-to-self' '
)
'
+# Testcase 12l, Both sides rename a directory into the other side, both add
+# a file which after directory renames are the same filename
+# Commit O: sub1/file, sub2/other
+# Commit A: sub3/file, sub2/{other, new_add_add_file_1}
+# Commit B: sub1/{file, newfile}, sub1/sub2/{other, new_add_add_file_2}
+#
+# In words:
+# A: sub1/ -> sub3/, add sub2/new_add_add_file_1
+# B: sub2/ -> sub1/sub2, add sub1/newfile, add sub1/sub2/new_add_add_file_2
+#
+# Expected: sub3/{file, newfile, sub2/other}
+# CONFLICT (add/add): sub1/sub2/new_add_add_file
+#
+# Note that sub1/newfile is not extraneous. Directory renames are only
+# detected if they are needed, and they are only needed if the old directory
+# had a new file added on the opposite side of history. So sub1/newfile
+# is needed for there to be a sub1/ -> sub3/ rename.
+
+test_setup_12l () {
+ test_create_repo 12l_$1 &&
+ (
+ cd 12l_$1 &&
+
+ mkdir sub1 sub2
+ echo file >sub1/file &&
+ echo other >sub2/other &&
+ git add sub1 sub2 &&
+ git commit -m "O" &&
+
+ git branch O &&
+ git branch A &&
+ git branch B &&
+
+ git checkout A &&
+ git mv sub1 sub3 &&
+ echo conflicting >sub2/new_add_add_file &&
+ git add sub2 &&
+ test_tick &&
+ git add -u &&
+ git commit -m "A" &&
+
+ git checkout B &&
+ echo dissimilar >sub2/new_add_add_file &&
+ echo brand >sub1/newfile &&
+ git add sub1 sub2 &&
+ git mv sub2 sub1 &&
+ test_tick &&
+ git commit -m "B"
+ )
+}
+
+test_expect_merge_algorithm failure success '12l (B into A): Rename into each other + add/add conflict' '
+ test_setup_12l BintoA &&
+ (
+ cd 12l_BintoA &&
+
+ git checkout -q A^0 &&
+
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 &&
+
+ test_stdout_line_count = 5 git ls-files -s &&
+
+ git rev-parse >actual \
+ :0:sub3/file :0:sub3/newfile :0:sub3/sub2/other \
+ :2:sub1/sub2/new_add_add_file \
+ :3:sub1/sub2/new_add_add_file &&
+ git rev-parse >expect \
+ O:sub1/file B:sub1/newfile O:sub2/other \
+ A:sub2/new_add_add_file \
+ B:sub1/sub2/new_add_add_file &&
+ test_cmp expect actual &&
+
+ git ls-files -o >actual &&
+ test_write_lines actual expect >expect &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_merge_algorithm failure success '12l (A into B): Rename into each other + add/add conflict' '
+ test_setup_12l AintoB &&
+ (
+ cd 12l_AintoB &&
+
+ git checkout -q B^0 &&
+
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive A^0 &&
+
+ test_stdout_line_count = 5 git ls-files -s &&
+
+ git rev-parse >actual \
+ :0:sub3/file :0:sub3/newfile :0:sub3/sub2/other \
+ :2:sub1/sub2/new_add_add_file \
+ :3:sub1/sub2/new_add_add_file &&
+ git rev-parse >expect \
+ O:sub1/file B:sub1/newfile O:sub2/other \
+ B:sub1/sub2/new_add_add_file \
+ A:sub2/new_add_add_file &&
+ test_cmp expect actual &&
+
+ git ls-files -o >actual &&
+ test_write_lines actual expect >expect &&
+ test_cmp expect actual
+ )
+'
+
###########################################################################
# SECTION 13: Checking informational and conflict messages
#
diff --git a/t/t6429-merge-sequence-rename-caching.sh b/t/t6429-merge-sequence-rename-caching.sh
index f2bc8a7..e1ce919 100755
--- a/t/t6429-merge-sequence-rename-caching.sh
+++ b/t/t6429-merge-sequence-rename-caching.sh
@@ -760,7 +760,7 @@ test_expect_success 'avoid assuming we detected renames' '
test_must_fail git -c merge.renameLimit=1 rebase upstream &&
git ls-files -u >actual &&
- ! test_file_is_empty actual
+ test_line_count = 2 actual
)
'
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index d848fe6..330d6d6 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -7,7 +7,7 @@ Testing basic merge tools options'
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . $GIT_BUILD_DIR/mergetools/vimdiff &&
+ . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
run_unit_tests
'
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 210ddf0..379b19f 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -221,7 +221,7 @@ test_expect_success 'req_Root (export-all)' \
'cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
-test_expect_success 'req_Root failure (export-all w/o whitelist)' \
+test_expect_success 'req_Root failure (export-all w/o directory list)' \
'! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
test_expect_success 'req_Root (everything together)' \
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 31526e6..43de868 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -2485,6 +2485,13 @@ test_expect_success 'git config - section' '
EOF
'
+test_expect_success 'git config - section include, includeIf' '
+ test_completion "git config inclu" <<-\EOF
+ include.Z
+ includeIf.Z
+ EOF
+'
+
test_expect_success 'git config - variable name' '
test_completion "git config log.d" <<-\EOF
log.date Z
@@ -2493,6 +2500,12 @@ test_expect_success 'git config - variable name' '
EOF
'
+test_expect_success 'git config - variable name include' '
+ test_completion "git config include.p" <<-\EOF
+ include.path Z
+ EOF
+'
+
test_expect_success 'git config - value' '
test_completion "git config color.pager " <<-\EOF
false Z
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 6da7273..8c44856 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -651,8 +651,7 @@ test_set_prereq () {
# test_unset_prereq()
!*)
;;
- # (Temporary?) whitelist of things we can't easily
- # pretend not to support
+ # List of things we can't easily pretend to not support
SYMLINKS)
;;
# Inspecting whether GIT_TEST_FAIL_PREREQS is on
diff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh
index c959183..79c31c7 100644
--- a/t/test-lib-junit.sh
+++ b/t/test-lib-junit.sh
@@ -46,7 +46,7 @@ finalize_test_case_output () {
shift
case "$test_case_result" in
ok)
- set "$*"
+ set -- "$*"
;;
failure)
junit_insert="<failure message=\"not ok $test_count -"
@@ -65,17 +65,17 @@ finalize_test_case_output () {
junit_insert="$junit_insert<system-err>$(xml_attr_encode \
"$(cat "$GIT_TEST_TEE_OUTPUT_FILE")")</system-err>"
fi
- set "$1" " $junit_insert"
+ set -- "$1" " $junit_insert"
;;
fixed)
- set "$* (breakage fixed)"
+ set -- "$* (breakage fixed)"
;;
broken)
- set "$* (known breakage)"
+ set -- "$* (known breakage)"
;;
skip)
message="$(xml_attr_encode --no-lf "$skipped_reason")"
- set "$1" " <skipped message=\"$message\" />"
+ set -- "$1" " <skipped message=\"$message\" />"
;;
esac
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 55857af..8cabb4d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -57,14 +57,14 @@ fi
#
# prepend_var VAR : VALUE
prepend_var () {
- eval "$1=$3\${$1:+${3:+$2}\$$1}"
+ eval "$1=\"$3\${$1:+${3:+$2}\$$1}\""
}
# If [AL]SAN is in effect we want to abort so that we notice
# problems. The GIT_SAN_OPTIONS variable can be used to set common
# defaults shared between [AL]SAN_OPTIONS.
prepend_var GIT_SAN_OPTIONS : abort_on_error=1
-prepend_var GIT_SAN_OPTIONS : strip_path_prefix=\"$GIT_BUILD_DIR/\"
+prepend_var GIT_SAN_OPTIONS : strip_path_prefix="$GIT_BUILD_DIR/"
# If we were built with ASAN, it may complain about leaks
# of program-lifetime variables. Disable it by default to lower
diff --git a/transport.c b/transport.c
index 52db7a3..b51e991 100644
--- a/transport.c
+++ b/transport.c
@@ -940,7 +940,7 @@ static int external_specification_len(const char *url)
return strchr(url, ':') - url;
}
-static const struct string_list *protocol_whitelist(void)
+static const struct string_list *protocol_allow_list(void)
{
static int enabled = -1;
static struct string_list allowed = STRING_LIST_INIT_DUP;
@@ -1020,9 +1020,9 @@ static enum protocol_allow_config get_protocol_config(const char *type)
int is_transport_allowed(const char *type, int from_user)
{
- const struct string_list *whitelist = protocol_whitelist();
- if (whitelist)
- return string_list_has_string(whitelist, type);
+ const struct string_list *allow_list = protocol_allow_list();
+ if (allow_list)
+ return string_list_has_string(allow_list, type);
switch (get_protocol_config(type)) {
case PROTOCOL_ALLOW_ALWAYS:
diff --git a/usage.c b/usage.c
index 56e29d6..5a7c6c3 100644
--- a/usage.c
+++ b/usage.c
@@ -33,7 +33,7 @@ static void vreportf(const char *prefix, const char *err, va_list params)
static NORETURN void usage_builtin(const char *err, va_list params)
{
- vreportf("usage: ", err, params);
+ vreportf(_("usage: "), err, params);
/*
* When we detect a usage error *before* the command dispatch in
@@ -58,7 +58,7 @@ static NORETURN void usage_builtin(const char *err, va_list params)
static void die_message_builtin(const char *err, va_list params)
{
trace2_cmd_error_va(err, params);
- vreportf("fatal: ", err, params);
+ vreportf(_("fatal: "), err, params);
}
/*
@@ -78,14 +78,14 @@ static void error_builtin(const char *err, va_list params)
{
trace2_cmd_error_va(err, params);
- vreportf("error: ", err, params);
+ vreportf(_("error: "), err, params);
}
static void warn_builtin(const char *warn, va_list params)
{
trace2_cmd_error_va(warn, params);
- vreportf("warning: ", warn, params);
+ vreportf(_("warning: "), warn, params);
}
static int die_is_recursing_builtin(void)