From 3b801f7afa688c8baa11c5f117af6e020fefbfed Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 3 Mar 2021 15:16:57 +0900 Subject: [PATCH] Imported Upstream version 2.22.1 --- .clang-format | 17 +- .mailmap | 1 + Documentation/CodingGuidelines | 32 +- Documentation/RelNotes/2.22.1.txt | 150 ++++++++ Documentation/config/alias.txt | 22 +- Documentation/config/gpg.txt | 2 +- Documentation/git-branch.txt | 33 +- Documentation/git-clone.txt | 34 +- Documentation/git-fsck.txt | 5 + Documentation/git-hash-object.txt | 4 +- Documentation/git-send-email.txt | 8 +- Documentation/git.txt | 3 +- Documentation/gitignore.txt | 66 ++-- Documentation/gitweb.txt | 3 +- Documentation/merge-options.txt | 2 + Documentation/technical/api-trace2.txt | 2 +- Documentation/technical/commit-graph.txt | 17 - GIT-VERSION-GEN | 2 +- README.md | 2 +- RelNotes | 2 +- apply.c | 2 +- builtin/am.c | 25 +- builtin/bisect--helper.c | 5 +- builtin/branch.c | 3 +- builtin/clean.c | 3 +- builtin/clone.c | 4 +- builtin/commit-graph.c | 22 +- builtin/commit.c | 5 +- builtin/fetch.c | 30 +- builtin/gc.c | 11 +- builtin/index-pack.c | 26 +- builtin/init-db.c | 3 + builtin/interpret-trailers.c | 3 + builtin/ls-files.c | 2 +- builtin/merge.c | 14 +- builtin/pack-objects.c | 2 +- builtin/rebase.c | 51 ++- builtin/receive-pack.c | 2 +- builtin/repack.c | 2 +- builtin/rm.c | 2 +- builtin/stash.c | 9 +- builtin/submodule--helper.c | 1 + builtin/update-index.c | 2 +- builtin/verify-commit.c | 1 - builtin/verify-tag.c | 1 - bundle.c | 3 + cache.h | 3 +- ci/install-dependencies.sh | 2 +- ci/lib.sh | 6 +- commit-graph.c | 613 +++++++++++++++++-------------- commit-graph.h | 22 +- commit.c | 2 +- compat/mingw.c | 8 +- compat/poll/poll.c | 2 +- compat/winansi.c | 14 +- config.c | 41 +-- contrib/coccinelle/array.cocci | 61 ++- contrib/completion/git-completion.bash | 3 +- delta-islands.c | 5 +- delta-islands.h | 2 +- diff-lib.c | 2 +- diff.c | 2 + diffcore-rename.c | 4 +- dir.c | 2 +- editor.c | 6 +- entry.c | 2 +- fast-import.c | 2 +- fsmonitor.c | 8 +- fsmonitor.h | 5 +- git-add--interactive.perl | 6 +- git-p4.py | 4 +- git-request-pull.sh | 46 ++- gpg-interface.c | 3 + grep.c | 4 + kwset.c | 10 +- list-objects-filter.c | 16 +- ls-refs.c | 3 +- name-hash.c | 3 +- object-store.h | 10 +- object.c | 2 +- packfile.c | 13 +- packfile.h | 2 +- pager.c | 20 + preload-index.c | 2 +- pretty.c | 4 +- progress.c | 28 +- read-cache.c | 14 +- sequencer.c | 28 +- server-info.c | 18 +- sh-i18n--envsubst.c | 2 +- sha1-file.c | 2 +- t/t0001-init.sh | 24 +- t/t0061-run-command.sh | 6 + t/t1301-shared-repo.sh | 6 +- t/t2400-worktree-add.sh | 12 + t/t3404-rebase-interactive.sh | 122 +++--- t/t3418-rebase-continue.sh | 8 + t/t3420-rebase-autostash.sh | 4 +- t/t3430-rebase-merges.sh | 18 +- t/t3600-rm.sh | 13 + t/t3701-add-interactive.sh | 8 + t/t3903-stash.sh | 18 + t/t4015-diff-whitespace.sh | 22 ++ t/t4257-am-interactive.sh | 52 +++ t/t5150-request-pull.sh | 53 +++ t/t5318-commit-graph.sh | 8 + t/t5509-fetch-push-namespaces.sh | 28 ++ t/t5541-http-push-smart.sh | 55 ++- t/t5551-http-fetch-smart.sh | 9 +- t/t5601-clone.sh | 16 +- t/t5607-clone-bundle.sh | 6 + t/t5616-partial-clone.sh | 112 +++++- t/t5801-remote-helpers.sh | 18 +- t/t5801/git-remote-testgit | 22 +- t/t6500-gc.sh | 2 + t/t7300-clean.sh | 12 + t/t7407-submodule-foreach.sh | 7 + t/t7513-interpret-trailers.sh | 71 ++-- t/t7600-merge.sh | 6 + t/t9832-unshelve.sh | 8 +- t/test-lib-functions.sh | 15 + transport-helper.c | 8 +- transport.c | 14 + unicode-width.h | 3 +- upload-pack.c | 6 +- url.c | 4 +- worktree.c | 7 +- wrapper.c | 2 +- wt-status.h | 1 - xdiff/xemit.c | 4 +- xdiff/xhistogram.c | 2 - xdiff/xpatience.c | 2 - xdiff/xutils.c | 4 - 133 files changed, 1731 insertions(+), 785 deletions(-) create mode 100644 Documentation/RelNotes/2.22.1.txt create mode 100755 t/t4257-am-interactive.sh diff --git a/.clang-format b/.clang-format index 41d4cd2..c592dda 100644 --- a/.clang-format +++ b/.clang-format @@ -148,8 +148,21 @@ SpacesInSquareBrackets: false Cpp11BracedListStyle: false # A list of macros that should be interpreted as foreach loops instead of as -# function calls. -ForEachMacros: ['for_each_string_list_item', 'for_each_wanted_builtin', 'for_each_builtin', 'for_each_ut'] +# function calls. Taken from: +# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' \ +# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \ +# | sort | uniq +ForEachMacros: + - 'for_each_abbrev' + - 'for_each_builtin' + - 'for_each_string_list_item' + - 'for_each_ut' + - 'for_each_wanted_builtin' + - 'list_for_each' + - 'list_for_each_dir' + - 'list_for_each_prev' + - 'list_for_each_prev_safe' + - 'list_for_each_safe' # The maximum number of consecutive empty lines to keep. MaxEmptyLinesToKeep: 1 diff --git a/.mailmap b/.mailmap index 82cd056..9a5ff04 100644 --- a/.mailmap +++ b/.mailmap @@ -210,6 +210,7 @@ Petr Baudis Petr Baudis Phil Hord Philip Jägenstedt +Philip Oakley # secondary Philipp A. Hartmann Philippe Bruhat Ralf Thielow diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 32210a4..f45db5b 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -195,10 +195,30 @@ For C programs: by e.g. "echo DEVELOPER=1 >>config.mak". - We try to support a wide range of C compilers to compile Git with, - including old ones. That means that you should not use C99 - initializers, even if a lot of compilers grok it. + including old ones. You should not use features from newer C + standard, even if your compiler groks them. - - Variables have to be declared at the beginning of the block. + There are a few exceptions to this guideline: + + . since early 2012 with e1327023ea, we have been using an enum + definition whose last element is followed by a comma. This, like + an array initializer that ends with a trailing comma, can be used + to reduce the patch noise when adding a new identifer at the end. + + . since mid 2017 with cbc0f81d, we have been using designated + initializers for struct (e.g. "struct t v = { .val = 'a' };"). + + . since mid 2017 with 512f41cf, we have been using designated + initializers for array (e.g. "int array[10] = { [5] = 2 }"). + + These used to be forbidden, but we have not heard any breakage + report, and they are assumed to be safe. + + - Variables have to be declared at the beginning of the block, before + the first statement (i.e. -Wdeclaration-after-statement). + + - Declaring a variable in the for loop "for (int i = 0; i < 10; i++)" + is still not allowed in this codebase. - NULL pointers shall be written as NULL, not as 0. @@ -412,6 +432,12 @@ For C programs: must be declared with "extern" in header files. However, function declarations should not use "extern", as that is already the default. + - You can launch gdb around your program using the shorthand GIT_DEBUGGER. + Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or + run `GIT_DEBUGGER=" " ./bin-wrappers/git foo` to + use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb" + ./bin-wrappers/git log` (See `wrap-for-bin.sh`.) + For Perl programs: - Most of the C guidelines above apply. diff --git a/Documentation/RelNotes/2.22.1.txt b/Documentation/RelNotes/2.22.1.txt new file mode 100644 index 0000000..432762f --- /dev/null +++ b/Documentation/RelNotes/2.22.1.txt @@ -0,0 +1,150 @@ +Git 2.22.1 Release Notes +======================== + +Fixes since v2.22 +----------------- + + * A relative pathname given to "git init --template= " + ought to be relative to the directory "git init" gets invoked in, + but it instead was made relative to the repository, which has been + corrected. + + * "git worktree add" used to fail when another worktree connected to + the same repository was corrupt, which has been corrected. + + * The ownership rule for the file descriptor to fast-import remote + backend was mixed up, leading to unrelated file descriptor getting + closed, which has been fixed. + + * "git update-server-info" used to leave stale packfiles in its + output, which has been corrected. + + * The server side support for "git fetch" used to show incorrect + value for the HEAD symbolic ref when the namespace feature is in + use, which has been corrected. + + * "git am -i --resolved" segfaulted after trying to see a commit as + if it were a tree, which has been corrected. + + * "git bundle verify" needs to see if prerequisite objects exist in + the receiving repository, but the command did not check if we are + in a repository upfront, which has been corrected. + + * "git merge --squash" is designed to update the working tree and the + index without creating the commit, and this cannot be countermanded + by adding the "--commit" option; the command now refuses to work + when both options are given. + + * The data collected by fsmonitor was not properly written back to + the on-disk index file, breaking t7519 tests occasionally, which + has been corrected. + + * Update to Unicode 12.1 width table. + + * The command line to invoke a "git cat-file" command from inside + "git p4" was not properly quoted to protect a caret and running a + broken command on Windows, which has been corrected. + + * "git request-pull" learned to warn when the ref we ask them to pull + from in the local repository and in the published repository are + different. + + * When creating a partial clone, the object filtering criteria is + recorded for the origin of the clone, but this incorrectly used a + hardcoded name "origin" to name that remote; it has been corrected + to honor the "--origin " option. + + * "git fetch" into a lazy clone forgot to fetch base objects that are + necessary to complete delta in a thin packfile, which has been + corrected. + + * The filter_data used in the list-objects-filter (which manages a + lazily sparse clone repository) did not use the dynamic array API + correctly---'nr' is supposed to point at one past the last element + of the array in use. This has been corrected. + + * The description about slashes in gitignore patterns (used to + indicate things like "anchored to this level only" and "only + matches directories") has been revamped. + + * The URL decoding code has been updated to avoid going past the end + of the string while parsing %-- sequence. + + * The list of for-each like macros used by clang-format has been + updated. + + * "git push --atomic" that goes over the transport-helper (namely, + the smart http transport) failed to prevent refs to be pushed when + it can locally tell that one of the ref update will fail without + having to consult the other end, which has been corrected. + + * "git clean" silently skipped a path when it cannot lstat() it; now + it gives a warning. + + * A codepath that reads from GPG for signed object verification read + past the end of allocated buffer, which has been fixed. + + * "git rm" to resolve a conflicted path leaked an internal message + "needs merge" before actually removing the path, which was + confusing. This has been corrected. + + * The "git clone" documentation refers to command line options in its + description in the short form; they have been replaced with long + forms to make them more recognisable. + + * The configuration variable rebase.rescheduleFailedExec should be + effective only while running an interactive rebase and should not + affect anything when running a non-interactive one, which was not + the case. This has been corrected. + + * "git submodule foreach" did not protect command line options passed + to the command to be run in each submodule correctly, when the + "--recursive" option was in use. + + * Use "Erase in Line" CSI sequence that is already used in the editor + support to clear cruft in the progress output. + + * The codepath to compute delta islands used to spew progress output + without giving the callers any way to squelch it, which has been + fixed. + + * The code to parse scaled numbers out of configuration files has + been made more robust and also easier to follow. + + * An incorrect list of options was cached after command line + completion failed (e.g. trying to complete a command that requires + a repository outside one), which has been corrected. + + * "git rebase --abort" used to leave refs/rewritten/ when concluding + "git rebase -r", which has been corrected. + + * "git stash show 23" used to work, but no more after getting + rewritten in C; this regression has been corrected. + + * "git interpret-trailers" always treated '#' as the comment + character, regardless of core.commentChar setting, which has been + corrected. + + * Code clean-up to avoid signed integer overlaps during binary search. + + * "git checkout -p" needs to selectively apply a patch in reverse, + which did not work well. + + * The commit-graph file is now part of the "files that the runtime + may keep open file descriptors on, all of which would need to be + closed when done with the object store", and the file descriptor to + an existing commit-graph file now is closed before "gc" finalizes a + new instance to replace it. + + * Code restructuring during 2.20 period broke fetching tags via + "import" based transports. + + * We have been trying out a few language features outside c89; the + coding guidelines document did not talk about them and instead had + a blanket ban against them. + + * The internal diff machinery can be made to read out of bounds while + looking for --funcion-context line in a corner case, which has been + corrected. + +Also contains various documentation updates, code clean-ups and minor fixups. diff --git a/Documentation/config/alias.txt b/Documentation/config/alias.txt index 0b14178..f1ca739 100644 --- a/Documentation/config/alias.txt +++ b/Documentation/config/alias.txt @@ -1,18 +1,28 @@ alias.*:: Command aliases for the linkgit:git[1] command wrapper - e.g. - after defining "alias.last = cat-file commit HEAD", the invocation - "git last" is equivalent to "git cat-file commit HEAD". To avoid + after defining `alias.last = cat-file commit HEAD`, the invocation + `git last` is equivalent to `git cat-file commit HEAD`. To avoid confusion and troubles with script usage, aliases that hide existing Git commands are ignored. Arguments are split by spaces, the usual shell quoting and escaping is supported. A quote pair or a backslash can be used to quote them. + +Note that the first word of an alias does not necessarily have to be a +command. It can be a command-line option that will be passed into the +invocation of `git`. In particular, this is useful when used with `-c` +to pass in one-time configurations or `-p` to force pagination. For example, +`loud-rebase = -c commit.verbose=true rebase` can be defined such that +running `git loud-rebase` would be equivalent to +`git -c commit.verbose=true rebase`. Also, `ps = -p status` would be a +helpful alias since `git ps` would paginate the output of `git status` +where the original command does not. ++ If the alias expansion is prefixed with an exclamation point, it will be treated as a shell command. For example, defining -"alias.new = !gitk --all --not ORIG_HEAD", the invocation -"git new" is equivalent to running the shell command -"gitk --all --not ORIG_HEAD". Note that shell commands will be +`alias.new = !gitk --all --not ORIG_HEAD`, the invocation +`git new` is equivalent to running the shell command +`gitk --all --not ORIG_HEAD`. Note that shell commands will be executed from the top-level directory of a repository, which may not necessarily be the current directory. -`GIT_PREFIX` is set as returned by running 'git rev-parse --show-prefix' +`GIT_PREFIX` is set as returned by running `git rev-parse --show-prefix` from the original current directory. See linkgit:git-rev-parse[1]. diff --git a/Documentation/config/gpg.txt b/Documentation/config/gpg.txt index f999f8e..cce2c89 100644 --- a/Documentation/config/gpg.txt +++ b/Documentation/config/gpg.txt @@ -2,7 +2,7 @@ gpg.program:: Use this custom program instead of "`gpg`" found on `$PATH` when making or verifying a PGP signature. The program must support the same command-line interface as GPG, namely, to verify a detached - signature, "`gpg --verify $file - <$signature`" is run, and the + signature, "`gpg --verify $signature - <$file`" is run, and the program is expected to signal a good signature by exiting with code 0, and to generate an ASCII-armored detached signature, the standard input of "`gpg -bsau $key`" is fed with the contents to be diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index 6ebd512..d9325e2 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -8,12 +8,15 @@ git-branch - List, create, or delete branches SYNOPSIS -------- [verse] -'git branch' [--color[=] | --no-color] [-r | -a] - [--list] [--show-current] [-v [--abbrev= | --no-abbrev]] +'git branch' [--color[=] | --no-color] + [-v [--abbrev= | --no-abbrev]] + [--show-current] [--column[=] | --no-column] [--sort=] [(--merged | --no-merged) []] [--contains []] - [--points-at ] [--format=] [...] + [--points-at ] [--format=] + [(-r | --remotes) | (-a | --all)] + [--list] [...] 'git branch' [--track | --no-track] [-f] [] 'git branch' (--set-upstream-to= | -u ) [] 'git branch' --unset-upstream [] @@ -28,11 +31,15 @@ DESCRIPTION If `--list` is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted with an asterisk. Option `-r` causes the remote-tracking branches to be listed, -and option `-a` shows both local and remote branches. If a `` +and option `-a` shows both local and remote branches. + +If a `` is given, it is used as a shell wildcard to restrict the output to matching branches. If multiple patterns are given, a branch is shown if -it matches any of the patterns. Note that when providing a -``, you must use `--list`; otherwise the command is interpreted +it matches any of the patterns. + +Note that when providing a +``, you must use `--list`; otherwise the command may be interpreted as branch creation. With `--contains`, shows only the branches that contain the named commit @@ -153,10 +160,12 @@ This option is only applicable in non-verbose mode. -r:: --remotes:: List or delete (if used with -d) the remote-tracking branches. + Combine with `--list` to match the optional pattern(s). -a:: --all:: List both remote-tracking branches and local branches. + Combine with `--list` to match optional pattern(s). -l:: --list:: @@ -322,6 +331,18 @@ $ git branch -D test <2> <2> Delete the "test" branch even if the "master" branch (or whichever branch is currently checked out) does not have all commits from the test branch. +Listing branches from a specific remote:: ++ +------------ +$ git branch -r -l '/' <1> +$ git for-each-ref 'refs/remotes//' <2> +------------ ++ +<1> Using `-a` would conflate with any local branches you happen to + have been prefixed with the same pattern. +<2> `for-each-ref` can take a wide range of options. See linkgit:git-for-each-ref[1] + +Patterns will normally need quoting. NOTES ----- diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt index a0f14b5..ca8871c 100644 --- a/Documentation/git-clone.txt +++ b/Documentation/git-clone.txt @@ -22,7 +22,7 @@ DESCRIPTION Clones a repository into a newly created directory, creates remote-tracking branches for each branch in the cloned repository -(visible using `git branch -r`), and creates and checks out an +(visible using `git branch --remotes`), and creates and checks out an initial branch that is forked from the cloned repository's currently active branch. @@ -40,8 +40,8 @@ configuration variables. OPTIONS ------- ---local:: -l:: +--local:: When the repository to clone from is on a local machine, this flag bypasses the normal "Git aware" transport mechanism and clones the repository by making a copy of @@ -62,8 +62,8 @@ Git transport instead. directory instead of using hardlinks. This may be desirable if you are trying to make a back-up of your repository. ---shared:: -s:: +--shared:: When the repository to clone is on the local machine, instead of using hard links, automatically setup `.git/objects/info/alternates` to share the objects @@ -80,13 +80,13 @@ which automatically call `git gc --auto`. (See linkgit:git-gc[1].) If these objects are removed and were referenced by the cloned repository, then the cloned repository will become corrupt. + -Note that running `git repack` without the `-l` option in a repository -cloned with `-s` will copy objects from the source repository into a pack -in the cloned repository, removing the disk space savings of `clone -s`. -It is safe, however, to run `git gc`, which uses the `-l` option by +Note that running `git repack` without the `--local` option in a repository +cloned with `--shared` will copy objects from the source repository into a pack +in the cloned repository, removing the disk space savings of `clone --shared`. +It is safe, however, to run `git gc`, which uses the `--local` option by default. + -If you want to break the dependency of a repository cloned with `-s` on +If you want to break the dependency of a repository cloned with `--shared` on its source repository, you can simply run `git repack -a` to copy all objects from the source repository into a pack in the cloned repository. @@ -115,19 +115,19 @@ objects from the source repository into a pack in the cloned repository. same repository, and this option can be used to stop the borrowing. ---quiet:: -q:: +--quiet:: Operate quietly. Progress is not reported to the standard error stream. ---verbose:: -v:: +--verbose:: Run verbosely. Does not affect the reporting of progress status to the standard error stream. --progress:: Progress status is reported on the standard error stream - by default when it is attached to a terminal, unless -q + by default when it is attached to a terminal, unless `--quiet` is specified. This flag forces progress status even if the standard error stream is not directed to a terminal. @@ -139,15 +139,15 @@ objects from the source repository into a pack in the cloned repository. When multiple `--server-option=