Compare

f27e711b7bd69406ce1ddc51a8239a894e6b88cc..843047f8613da2f38f024c5b69e7e89a4ff175fb

mingw: only enable the MSYS2-specific stuff when compiling in MSYS2

The tell-tale is the presence of the `MSYSTEM` value while compiling, of
course. In that case, we want to ensure that `MSYSTEM` is set when
running `git.exe`, and also enable the magic MSYS2 tty detection.

Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin <johannes.schindelin@gmx.de> · 2026-09-10 06:05 UTC · committed by Junio C Hamano

Browse files
65 files changed, +1095 −2142
modified .github/workflows/main.yml
@@ -460,8 +460,8 @@ jobs:
460 460 if: needs.ci-config.outputs.enabled == 'yes'
461 461 env:
462 462 jobname: StaticAnalysis
463 - CI_JOB_IMAGE: ubuntu-latest
464 - runs-on: ubuntu-latest
463 + CI_JOB_IMAGE: ubuntu-22.04
464 + runs-on: ubuntu-22.04
465 465 concurrency:
466 466 group: static-analysis-${{ github.ref }}
467 467 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
modified .gitlab-ci.yml
@@ -227,7 +227,7 @@ test:fuzz-smoke-tests:
227 227 - ./ci/run-build-and-minimal-fuzzers.sh
228 228
229 229 static-analysis:
230 - image: ubuntu:latest
230 + image: ubuntu:22.04
231 231 stage: analyze
232 232 needs: [ ]
233 233 variables:
modified .mailmap
@@ -39,13 +39,12 @@ Chris Shoemaker <c.shoemaker@cox.net>
39 39 Chris Wright <chrisw@sous-sol.org> <chrisw@osdl.org>
40 40 Christian Ludwig <chrissicool@gmail.com> <chrissicool@googlemail.com>
41 41 Cord Seele <cowose@gmail.com> <cowose@googlemail.com>
42 - Christian Couder <christian.couder@gmail.com> <chriscool@tuxfamily.org>
42 + Christian Couder <chriscool@tuxfamily.org> <christian.couder@gmail.com>
43 43 Christian Stimming <stimming@tuhh.de> <chs@ckiste.goetheallee>
44 44 Christopher Díaz Riveros <chrisadr@gentoo.org> Christopher Diaz Riveros
45 45 Clemens Buchacher <drizzd@gmx.net> <drizzd@aon.at>
46 46 Clemens Buchacher <drizzd@gmx.net> <clemens.buchacher@intel.com>
47 47 Csaba Henk <csaba@gluster.com> <csaba@lowlife.hu>
48 - D. Ben Knoble <ben.knoble@gmail.com> <ben.knoble+github@gmail.com>
49 48 Dan Johnson <computerdruid@gmail.com>
50 49 Dana L. How <danahow@gmail.com> <how@deathvalley.cswitch.com>
51 50 Dana L. How <danahow@gmail.com> Dana How
@@ -66,8 +65,6 @@ Derrick Stolee <stolee@gmail.com> <dstolee@microsoft.com>
66 65 Deskin Miller <deskinm@umich.edu>
67 66 Đoàn Trần Công Danh <congdanhqx@gmail.com> Doan Tran Cong Danh
68 67 Dirk Süsserott <newsletter@dirk.my1.cc>
69 - Elijah Newren <newren@gmail.com> <newren@palantir.com>
70 - Elijah Newren <newren@gmail.com> <newren@github.com>
71 68 Emily Shaffer <nasamuffin@google.com> <emilyshaffer@google.com>
72 69 Eric Blake <eblake@redhat.com> <ebb9@byu.net>
73 70 Eric Hanchrow <eric.hanchrow@gmail.com> <offby1@blarg.net>
modified Documentation/RelNotes/2.56.0.adoc
@@ -76,15 +76,6 @@ UI, Workflows & Features
76 76 filtered on the client based on server-advertised capabilities,
77 77 returning empty strings for inapplicable or unsupported fields.
78 78
79 - * 'git branch -d' has been taught to report when a branch cannot be
80 - deleted because it is being used in an active bisect run.
81 -
82 - * 'git mv' has been updated to check for a missing destination
83 - leading directory during the checking phase, allowing 'git mv -n'
84 - to report the failure. The error message when the rename(2)
85 - syscall fails has also been improved to name both the source and
86 - the destination.
87 -
88 79
89 80 Performance, Internal Implementation, Development Support etc.
90 81 --------------------------------------------------------------
@@ -289,51 +280,6 @@ Performance, Internal Implementation, Development Support etc.
289 280 first refactoring force_object_loose() to use generic ODB write
290 281 interfaces instead of loose-backend internals.
291 282
292 - * Object database housekeeping in 'git gc' and 'git maintenance' has
293 - been refactored to be pluggable. The files-backend-specific logic,
294 - including incremental and geometric repacking as well as object
295 - pruning, has been moved out of the command implementation and into the
296 - files object database source, enabling future alternative object
297 - database backends to implement their own housekeeping services.
298 -
299 - * The image version used by the static-analysis CI job has been bumped
300 - to ubuntu-latest (Ubuntu 24.04), which brings in a newer Coccinelle
301 - version that resolves a severe performance regression. A false
302 - positive warning from the 'CHECK_ASSERTION_SIDE_EFFECTS' build with
303 - GCC 15 in the Bloom filter code has also been silenced to facilitate
304 - the image upgrade.
305 - (merge 1a1579c42d jk/ci-static-analysis-image-bump later to maint).
306 -
307 - * The alias tests in 't/t0014-alias.sh' have been updated to dynamically
308 - query the list of deprecated commands using 'git
309 - --list-cmds=deprecated' to avoid test failures when running with
310 - 'WITH_BREAKING_CHANGES' in a build directory that contains stale
311 - executables of formerly deprecated commands.
312 - (merge bc57ecb915 jk/t0014-dynamic-deprecated-cmds later to maint).
313 -
314 - * The code path that deals with relative paths in the diff-lib has
315 - been cleaned up.
316 -
317 - * The get_commit_action() function has been refactored to be a pure
318 - predicate by moving the side-effecting line-level log range folding to
319 - simplify_commit(). This ensures that evaluating a commit's action
320 - before the walk reaches it does not prematurely mutate its tracked
321 - line ranges, making it safer for potential lookahead evaluations.
322 -
323 - * Synopsis and options in the documentation for 'git format-patch',
324 - 'git imap-send', 'git send-email', and 'git request-pull' have been
325 - updated to the modern style.
326 -
327 - * A new test helper commit_body() has been introduced to print the
328 - message body of a commit, and various tests have been updated to use
329 - it instead of spelling out the command pipeline manually and losing
330 - the exit status of the 'git cat-file' command on the upstream of the
331 - pipe.
332 -
333 - * Tests for 'git merge-base --is-ancestor' have been added to cover
334 - exit codes (0 for success, 1 for non-ancestor, 128 for errors) and
335 - to ensure it cannot be combined with '--all'.
336 -
337 283
338 284 Fixes since v2.55
339 285 -----------------
@@ -520,42 +466,3 @@ Fixes since v2.55
520 466 * The remote-matching logic for submodules has been corrected to resolve
521 467 'url.*.insteadOf' aliases before comparing the inventoried URL from
522 468 '.gitmodules' with the URLs of configured remotes.
523 -
524 - * 'git diff --relative' running with '--cached' has been corrected to
525 - avoid a segfault when encountering unmerged paths outside the
526 - prefix.
527 - (merge 447126ed7d jk/diff-relative-cached-unmerged later to maint).
528 -
529 - * Two bugs in how 'git rebase' handles skipped 'fixup' and 'squash'
530 - commands have been fixed. One bug caused an incorrect commit count to
531 - be shown in the template message when multiple commands were skipped,
532 - and another prevented the editor from opening when the final command
533 - in a chain containing 'fixup -c' was skipped.
534 -
535 - * Git for Windows has been updated to avoid auto-detecting the symlink
536 - type if the target path starts with a slash, preventing NTLM
537 - credential leaks when checking out repositories with crafted
538 - symbolic links pointing to network shares.
539 -
540 - * 'git cat-file --batch-command' that asked for 'contents' without
541 - 'type' segfaults, which has been corrected.
542 - (merge 2abc7f0304 jk/cat-file-batch-wo-type-fix later to maint).
543 -
544 - * A memory leak in 'git merge' when run without arguments (which
545 - triggers the default-to-upstream path) has been fixed. A test has
546 - been added to cover this case.
547 - (merge 68cce04a02 tc/merge-default-to-upstream-leakfix later to maint).
548 -
549 - * A boundary case check in reachability bitmap traversal has been
550 - corrected to properly handle the object at position zero, which was
551 - previously skipped, leading to redundant bitmap loading.
552 - (merge b56b48301e dl/pack-bitmap-position-zero later to maint).
553 -
554 - * A crash in the 'sparse-index' collapse code when encountering an
555 - invalidated cache-tree node (due to an intent-to-add path) has been
556 - fixed by avoiding collapsing such subtrees.
557 - (merge eede1e69fe ds/sparse-index-ita-crash later to maint).
558 -
559 - * Documentation for 'git replay' has been updated to refer to its
560 - configuration variables.
561 - (merge 48c0549f5c kh/doc-replay-config later to maint).
modified Documentation/config.adoc
@@ -568,8 +568,6 @@ include::config/remotes.adoc[]
568 568
569 569 include::config/repack.adoc[]
570 570
571 - include::config/replay.adoc[]
572 -
573 571 include::config/rerere.adoc[]
574 572
575 573 include::config/revert.adoc[]
modified Documentation/config/imap.adoc
@@ -41,7 +41,7 @@
41 41 `imap.authMethod`::
42 42 Specify the authentication method for authenticating with the IMAP server.
43 43 If Git was built with the NO_CURL option, or if your curl version is older
44 - than 7.34.0, or if you're running `git-imap-send` with the `--no-curl`
44 + than 7.34.0, or if you're running git-imap-send with the `--no-curl`
45 45 option, the only supported methods are `PLAIN`, `CRAM-MD5`, `OAUTHBEARER`
46 46 and `XOAUTH2`. If this is not set then `git imap-send` uses the basic IMAP
47 47 plaintext `LOGIN` command.
modified Documentation/config/replay.adoc
@@ -1,18 +1,11 @@
1 1 replay.refAction::
2 - Specifies the default mode for handling reference updates.
3 - The value can be:
2 + Specifies the default mode for handling reference updates in
3 + `git replay`. The value can be:
4 4 +
5 5 --
6 - ////
7 - These use the first sentences from the description list in git-replay(1).
8 - ////
9 - `update`;; (default) Update refs directly using an atomic transaction.
10 - `print`;; Output update-ref commands for pipeline use.
6 + * `update`: Update refs directly using an atomic transaction (default behavior).
7 + * `print`: Output update-ref commands for pipeline use.
11 8 --
12 9 +
13 - ifdef::git-replay[]
14 - See `--ref-action`.
15 - endif::git-replay[]
16 - ifndef::git-replay[]
17 - See `--ref-action` in linkgit:git-replay[1] for details.
18 - endif::git-replay[]
10 + This setting can be overridden with the `--ref-action` command-line option.
11 + When not configured, `git replay` defaults to `update` mode.
modified Documentation/config/sendemail.adoc
@@ -1,25 +1,25 @@
1 - `sendemail.identity`::
1 + sendemail.identity::
2 2 A configuration identity. When given, causes values in the
3 3 `sendemail.<identity>` subsection to take precedence over
4 4 values in the `sendemail` section. The default identity is
5 5 the value of `sendemail.identity`.
6 6
7 - `sendemail.smtpEncryption`::
7 + sendemail.smtpEncryption::
8 8 See linkgit:git-send-email[1] for description. Note that this
9 9 setting is not subject to the `identity` mechanism.
10 10
11 - `sendemail.smtpSSLCertPath`::
11 + sendemail.smtpSSLCertPath::
12 12 Path to ca-certificates (either a directory or a single file).
13 13 Set it to an empty string to disable certificate verification.
14 14
15 - `sendemail.smtpSSLClientCert`::
15 + sendemail.smtpSSLClientCert::
16 16 Path to the client certificate file to present if requested by the
17 17 server. This is required when the server is set up to verify client
18 18 certificates. If the corresponding private key is not included in the
19 19 file, it must be supplied using `sendemail.smtpSSLClientKey` or the
20 20 `--smtp-ssl-client-key` option.
21 21
22 - `sendemail.smtpSSLClientKey`::
22 + sendemail.smtpSSLClientKey::
23 23 Path to the client private key file that corresponds to the client
24 24 certificate. To avoid misconfiguration, this configuration must be used
25 25 in conjunction with `sendemail.smtpSSLClientCert` or the
@@ -28,45 +28,45 @@
28 28 the certificate. Visit https://metacpan.org/pod/IO::Socket::SSL for more
29 29 details.
30 30
31 - `sendemail.<identity>.<config>`::
32 - Identity-specific versions of the `sendemail.<config>` parameters
31 + sendemail.<identity>.*::
32 + Identity-specific versions of the `sendemail.*` parameters
33 33 found below, taking precedence over those when this
34 34 identity is selected, through either the command-line or
35 35 `sendemail.identity`.
36 36
37 - `sendemail.multiEdit`::
37 + sendemail.multiEdit::
38 38 If `true` (default), a single editor instance will be spawned to edit
39 39 files you have to edit (patches when `--annotate` is used, and the
40 40 summary when `--compose` is used). If `false`, files will be edited one
41 41 after the other, spawning a new editor each time.
42 42
43 - `sendemail.confirm`::
43 + sendemail.confirm::
44 44 Sets the default for whether to confirm before sending. Must be
45 45 one of `always`, `never`, `cc`, `compose`, or `auto`. See `--confirm`
46 46 in the linkgit:git-send-email[1] documentation for the meaning of these
47 47 values.
48 48
49 - `sendemail.mailmap`::
49 + sendemail.mailmap::
50 50 If `true`, makes linkgit:git-send-email[1] assume `--mailmap`,
51 51 otherwise assume `--no-mailmap`. `False` by default.
52 52
53 - `sendemail.mailmap.file`::
53 + sendemail.mailmap.file::
54 54 The location of a linkgit:git-send-email[1] specific augmenting
55 55 mailmap file. The default mailmap and `mailmap.file` are loaded
56 56 first. Thus, entries in this file take precedence over entries in
57 57 the default mailmap locations. See linkgit:gitmailmap[5].
58 58
59 - `sendemail.mailmap.blob`::
59 + sendemail.mailmap.blob::
60 60 Like `sendemail.mailmap.file`, but consider the value as a reference
61 61 to a blob in the repository. Entries in `sendemail.mailmap.file`
62 62 take precedence over entries here. See linkgit:gitmailmap[5].
63 63
64 - `sendemail.aliasesFile`::
64 + sendemail.aliasesFile::
65 65 To avoid typing long email addresses, point this to one or more
66 66 email aliases files. You must also supply `sendemail.aliasFileType`.
67 67
68 - `sendemail.aliasFileType`::
69 - Format of the file(s) specified in `sendemail.aliasesFile`. Must be
68 + sendemail.aliasFileType::
69 + Format of the file(s) specified in sendemail.aliasesFile. Must be
70 70 one of `mutt`, `mailrc`, `pine`, `elm`, `gnus`, or `sendmail`.
71 71 +
72 72 What an alias file in each format looks like can be found in
@@ -75,7 +75,7 @@ differences and limitations from the standard formats are
75 75 described below:
76 76 +
77 77 --
78 - `sendmail`;;
78 + sendmail;;
79 79 * Quoted aliases and quoted addresses are not supported: lines that
80 80 contain a `"` symbol are ignored.
81 81 * Redirection to a file (`/path/name`) or pipe (`|command`) is not
@@ -85,54 +85,54 @@ described below:
85 85 explicitly unsupported constructs, and any other lines that are not
86 86 recognized by the parser.
87 87 --
88 - `sendemail.annotate`::
89 - `sendemail.bcc`::
90 - `sendemail.cc`::
91 - `sendemail.ccCmd`::
92 - `sendemail.chainReplyTo`::
93 - `sendemail.envelopeSender`::
94 - `sendemail.from`::
95 - `sendemail.headerCmd`::
96 - `sendemail.signedOffByCc`::
97 - `sendemail.smtpPass`::
98 - `sendemail.suppressCc`::
99 - `sendemail.suppressFrom`::
100 - `sendemail.to`::
101 - `sendemail.toCmd`::
102 - `sendemail.smtpDomain`::
103 - `sendemail.smtpServer`::
104 - `sendemail.smtpServerPort`::
105 - `sendemail.smtpServerOption`::
106 - `sendemail.smtpUser`::
107 - `sendemail.imapSentFolder`::
108 - `sendemail.useImapOnly`::
109 - `sendemail.thread`::
110 - `sendemail.transferEncoding`::
111 - `sendemail.validate`::
112 - `sendemail.xmailer`::
88 + sendemail.annotate::
89 + sendemail.bcc::
90 + sendemail.cc::
91 + sendemail.ccCmd::
92 + sendemail.chainReplyTo::
93 + sendemail.envelopeSender::
94 + sendemail.from::
95 + sendemail.headerCmd::
96 + sendemail.signedOffByCc::
97 + sendemail.smtpPass::
98 + sendemail.suppressCc::
99 + sendemail.suppressFrom::
100 + sendemail.to::
101 + sendemail.toCmd::
102 + sendemail.smtpDomain::
103 + sendemail.smtpServer::
104 + sendemail.smtpServerPort::
105 + sendemail.smtpServerOption::
106 + sendemail.smtpUser::
107 + sendemail.imapSentFolder::
108 + sendemail.useImapOnly::
109 + sendemail.thread::
110 + sendemail.transferEncoding::
111 + sendemail.validate::
112 + sendemail.xmailer::
113 113 These configuration variables all provide a default for
114 114 linkgit:git-send-email[1] command-line options. See its
115 115 documentation for details.
116 116
117 - `sendemail.outlookidfix`::
117 + sendemail.outlookidfix::
118 118 If `true`, makes linkgit:git-send-email[1] assume `--outlook-id-fix`,
119 119 and if `false` assume `--no-outlook-id-fix`. If not specified, it will
120 120 behave the same way as if `--outlook-id-fix` is not specified.
121 121
122 - `sendemail.signedOffCc` (deprecated)::
122 + sendemail.signedOffCc (deprecated)::
123 123 Deprecated alias for `sendemail.signedOffByCc`.
124 124
125 - `sendemail.smtpBatchSize`::
125 + sendemail.smtpBatchSize::
126 126 Number of messages to be sent per connection, after that a relogin
127 127 will happen. If the value is `0` or undefined, send all messages in
128 128 one connection.
129 129 See also the `--batch-size` option of linkgit:git-send-email[1].
130 130
131 - `sendemail.smtpReloginDelay`::
131 + sendemail.smtpReloginDelay::
132 132 Seconds to wait before reconnecting to the smtp server.
133 133 See also the `--relogin-delay` option of linkgit:git-send-email[1].
134 134
135 - `sendemail.forbidSendmailVariables`::
135 + sendemail.forbidSendmailVariables::
136 136 To avoid common misconfiguration mistakes, linkgit:git-send-email[1]
137 137 will abort with a warning if any configuration options for `sendmail`
138 138 exist. Set this variable to bypass the check.
modified Documentation/diff-options.adoc
@@ -13,8 +13,8 @@ endif::git-diff[]
13 13 endif::git-format-patch[]
14 14
15 15 ifdef::git-format-patch[]
16 - `-p`::
17 - `--no-stat`::
16 + -p::
17 + --no-stat::
18 18 Generate plain patches without any diffstats.
19 19 endif::git-format-patch[]
20 20
@@ -893,8 +893,8 @@ endif::git-format-patch[]
893 893 reverted with `--ita-visible-in-index`. Both options are
894 894 experimental and could be removed in future.
895 895
896 - `--max-depth=<depth>`::
897 - For each pathspec given on command line, descend at most _<depth>_
896 + --max-depth=<depth>::
897 + For each pathspec given on command line, descend at most `<depth>`
898 898 levels of directories. A value of `-1` means no limit.
899 899 Cannot be combined with wildcards in the pathspec.
900 900 Given a tree containing `foo/bar/baz`, the following list shows the
modified Documentation/git-format-patch.adoc
@@ -8,8 +8,8 @@ git-format-patch - Prepare patches for e-mail submission
8 8
9 9 SYNOPSIS
10 10 --------
11 - [synopsis]
12 - git format-patch [-k] [(-o|--output-directory) <dir> | --stdout]
11 + [verse]
12 + 'git format-patch' [-k] [(-o|--output-directory) <dir> | --stdout]
13 13 [--no-thread | --thread[=<style>]]
14 14 [(--attach|--inline)[=<boundary>] | --no-attach]
15 15 [-s | --signoff]
@@ -40,20 +40,20 @@ DESCRIPTION
40 40 Prepare each non-merge commit with its "patch" in
41 41 one "message" per commit, formatted to resemble a UNIX mailbox.
42 42 The output of this command is convenient for e-mail submission or
43 - for use with `git am`.
43 + for use with 'git am'.
44 44
45 45 A "message" generated by the command consists of three parts:
46 46
47 47 * A brief metadata header that begins with `From <commit>`
48 48 with a fixed `Mon Sep 17 00:00:00 2001` datestamp to help programs
49 - like `file`(1) to recognize that the file is an output from this
49 + like "file(1)" to recognize that the file is an output from this
50 50 command, fields that record the author identity, the author date,
51 51 and the title of the change (taken from the first paragraph of the
52 52 commit log message).
53 53
54 54 * The second and subsequent paragraphs of the commit log message.
55 55
56 - * The "patch", which is the `diff -p --stat` output (see
56 + * The "patch", which is the "diff -p --stat" output (see
57 57 linkgit:git-diff[1]) between the commit and its parent.
58 58
59 59 The log message and the patch are separated by a line with a
@@ -61,18 +61,18 @@ three-dash line.
61 61
62 62 There are two ways to specify which commits to operate on.
63 63
64 - 1. A single commit, _<since>_, specifies that the commits leading
64 + 1. A single commit, <since>, specifies that the commits leading
65 65 to the tip of the current branch that are not in the history
66 - that leads to the _<since>_ to be output.
66 + that leads to the <since> to be output.
67 67
68 - 2. Generic _<revision-range>_ expression (see 'SPECIFYING
69 - REVISIONS' section in linkgit:gitrevisions[7]) means the
68 + 2. Generic <revision-range> expression (see "SPECIFYING
69 + REVISIONS" section in linkgit:gitrevisions[7]) means the
70 70 commits in the specified range.
71 71
72 - The first rule takes precedence in the case of a single _<commit>_. To
72 + The first rule takes precedence in the case of a single <commit>. To
73 73 apply the second rule, i.e., format everything since the beginning of
74 - history up until _<commit>_, use the `--root` option: `git format-patch
75 - --root <commit>`. If you want to format only _<commit>_ itself, you
74 + history up until <commit>, use the `--root` option: `git format-patch
75 + --root <commit>`. If you want to format only <commit> itself, you
76 76 can do this with `git format-patch -1 <commit>`.
77 77
78 78 By default, each output file is numbered sequentially from 1, and uses the
@@ -82,7 +82,7 @@ will only be numbers, without the first line of the commit appended.
82 82 The names of the output files are printed to standard
83 83 output, unless the `--stdout` option is specified.
84 84
85 - If `-o` is specified, output files are created in _<dir>_. Otherwise
85 + If `-o` is specified, output files are created in <dir>. Otherwise
86 86 they are created in the current working directory. The default path
87 87 can be set with the `format.outputDirectory` configuration option.
88 88 The `-o` option takes precedence over `format.outputDirectory`.
@@ -108,119 +108,119 @@ OPTIONS
108 108 :git-format-patch: 1
109 109 include::diff-options.adoc[]
110 110
111 - `-<n>`::
112 - Prepare patches from the topmost _<n>_ commits.
111 + -<n>::
112 + Prepare patches from the topmost <n> commits.
113 113
114 - `-o <dir>`::
115 - `--output-directory=<dir>`::
116 - Use _<dir>_ to store the resulting files, instead of the
114 + -o <dir>::
115 + --output-directory <dir>::
116 + Use <dir> to store the resulting files, instead of the
117 117 current working directory.
118 118
119 - `-n`::
120 - `--numbered`::
119 + -n::
120 + --numbered::
121 121 Name output in '[PATCH n/m]' format, even with a single patch.
122 122
123 - `-N`::
124 - `--no-numbered`::
123 + -N::
124 + --no-numbered::
125 125 Name output in '[PATCH]' format.
126 126
127 - `--start-number <n>`::
128 - Start numbering the patches at _<n>_ instead of 1.
127 + --start-number <n>::
128 + Start numbering the patches at <n> instead of 1.
129 129
130 - `--numbered-files`::
130 + --numbered-files::
131 131 Output file names will be a simple number sequence
132 132 without the default first line of the commit appended.
133 133
134 - `-k`::
135 - `--keep-subject`::
134 + -k::
135 + --keep-subject::
136 136 Do not strip/add '[PATCH]' from the first line of the
137 137 commit log message.
138 138
139 - `-s`::
140 - `--signoff`::
139 + -s::
140 + --signoff::
141 141 Add a `Signed-off-by` trailer to the commit message, using
142 142 the committer identity of yourself.
143 143 See the signoff option in linkgit:git-commit[1] for more information.
144 144
145 - `--stdout`::
145 + --stdout::
146 146 Print all commits to the standard output in mbox format,
147 147 instead of creating a file for each one.
148 148
149 - `--attach[=<boundary>]`::
149 + --attach[=<boundary>]::
150 150 Create multipart/mixed attachment, the first part of
151 151 which is the commit message and the patch itself in the
152 152 second part, with `Content-Disposition: attachment`.
153 153
154 - `--no-attach`::
154 + --no-attach::
155 155 Disable the creation of an attachment, overriding the
156 156 configuration setting.
157 157
158 - `--inline[=<boundary>]`::
158 + --inline[=<boundary>]::
159 159 Create multipart/mixed attachment, the first part of
160 160 which is the commit message and the patch itself in the
161 161 second part, with `Content-Disposition: inline`.
162 162
163 - `--thread[=<style>]`::
164 - `--no-thread`::
165 - Control addition of `In-Reply-To` and `References` headers to
163 + --thread[=<style>]::
164 + --no-thread::
165 + Controls addition of `In-Reply-To` and `References` headers to
166 166 make the second and subsequent mails appear as replies to the
167 167 first. Also controls generation of the `Message-ID` header to
168 168 reference.
169 169 +
170 - The optional _<style>_ argument can be either `shallow` or `deep`.
171 - `shallow` threading makes every mail a reply to the head of the
170 + The optional <style> argument can be either `shallow` or `deep`.
171 + 'shallow' threading makes every mail a reply to the head of the
172 172 series, where the head is chosen from the cover letter, the
173 - `--in-reply-to`, and the first patch mail, in this order. `deep`
173 + `--in-reply-to`, and the first patch mail, in this order. 'deep'
174 174 threading makes every mail a reply to the previous one.
175 175 +
176 176 The default is `--no-thread`, unless the `format.thread` configuration
177 177 is set. `--thread` without an argument is equivalent to `--thread=shallow`.
178 178 +
179 - Beware that the default for `git send-email` is to thread emails
179 + Beware that the default for 'git send-email' is to thread emails
180 180 itself. If you want `git format-patch` to take care of threading, you
181 181 will want to ensure that threading is disabled for `git send-email`.
182 182
183 - `--in-reply-to=<message-id>`::
183 + --in-reply-to=<message-id>::
184 184 Make the first mail (or all the mails with `--no-thread`) appear as a
185 - reply to the given _<message-id>_, which avoids breaking threads to
185 + reply to the given <message-id>, which avoids breaking threads to
186 186 provide a new patch series.
187 187
188 - `--ignore-if-in-upstream`::
188 + --ignore-if-in-upstream::
189 189 Do not include a patch that matches a commit in
190 - _<until>_.._<since>_. This will examine all patches reachable
191 - from _<since>_ but not from _<until>_ and compare them with the
190 + <until>..<since>. This will examine all patches reachable
191 + from <since> but not from <until> and compare them with the
192 192 patches being generated, and any patch that matches is
193 193 ignored.
194 194
195 - `--always`::
195 + --always::
196 196 Include patches for commits that do not introduce any change,
197 197 which are omitted by default.
198 198
199 - `--cover-from-description=<mode>`::
200 - Control which parts of the cover letter will be automatically
199 + --cover-from-description=<mode>::
200 + Controls which parts of the cover letter will be automatically
201 201 populated using the branch's description.
202 202 +
203 - _<mode>_ can have the following values:
204 -
205 - `message`;;
206 - `default`;; the cover letter subject will be
203 + If `<mode>` is `message` or `default`, the cover letter subject will be
207 204 populated with placeholder text. The body of the cover letter will be
208 205 populated with the branch's description. This is the default mode when
209 206 no configuration nor command line option is specified.
210 - `subject`;; the first paragraph of the branch description will
207 + +
208 + If `<mode>` is `subject`, the first paragraph of the branch description will
211 209 populate the cover letter subject. The remainder of the description will
212 210 populate the body of the cover letter.
213 - `auto`;; if the first paragraph of the branch description
211 + +
212 + If `<mode>` is `auto`, if the first paragraph of the branch description
214 213 is greater than 100 bytes, then the mode will be `message`, otherwise
215 214 `subject` will be used.
216 - `none`;; both the cover letter subject and body will be
215 + +
216 + If `<mode>` is `none`, both the cover letter subject and body will be
217 217 populated with placeholder text.
218 218
219 - `--description-file=<file>`::
220 - Use the contents of _<file>_ instead of the branch's description
219 + --description-file=<file>::
220 + Use the contents of <file> instead of the branch's description
221 221 for generating the cover letter.
222 222
223 - `--subject-prefix=<subject-prefix>`::
223 + --subject-prefix=<subject-prefix>::
224 224 Use '[<subject-prefix>]' instead of the standard '[PATCH]'
225 225 prefix in the subject line. This can be used to name a patch
226 226 series, and can be combined with the `--numbered` option.
@@ -231,14 +231,14 @@ all patches. This is often useful on mailing lists which receive
231 231 patches for several repositories and can be used to disambiguate
232 232 the patches (with a value of e.g. "PATCH my-project").
233 233
234 - `--filename-max-length=<n>`::
234 + --filename-max-length=<n>::
235 235 Instead of the standard 64 bytes, chomp the generated output
236 - filenames at around _<n>_ bytes (too short a value will be
236 + filenames at around '<n>' bytes (too short a value will be
237 237 silently raised to a reasonable length). Defaults to the
238 238 value of the `format.filenameMaxLength` configuration
239 239 variable, or 64 if unconfigured.
240 240
241 - `--rfc[=<rfc>]`::
241 + --rfc[=<rfc>]::
242 242 Prepends the string _<rfc>_ (defaults to "RFC") to
243 243 the subject prefix. As the subject prefix defaults to
244 244 "PATCH", you'll get "RFC PATCH" by default.
@@ -254,38 +254,38 @@ can be prefixed with a dash ("`-`") to signal that the rest of
254 254 the _<rfc>_ string should be appended to the subject prefix instead,
255 255 e.g., `--rfc='-(WIP)'` results in "PATCH (WIP)".
256 256
257 - `-v <n>`::
258 - `--reroll-count=<n>`::
259 - Mark the series as the _<n>_-th iteration of the topic. The
257 + -v <n>::
258 + --reroll-count=<n>::
259 + Mark the series as the <n>-th iteration of the topic. The
260 260 output filenames have `v<n>` prepended to them, and the
261 261 subject prefix ("PATCH" by default, but configurable via the
262 - `--subject-prefix` option) has `v<n>` appended to it. E.g.
262 + `--subject-prefix` option) has ` v<n>` appended to it. E.g.
263 263 `--reroll-count=4` may produce `v4-0001-add-makefile.patch`
264 264 file that has "Subject: [PATCH v4 1/20] Add makefile" in it.
265 - _<n>_ does not have to be an integer (e.g. `--reroll-count=4.4`,
266 - or `--reroll-count=4rev2` are allowed), but the downside of
265 + `<n>` does not have to be an integer (e.g. "--reroll-count=4.4",
266 + or "--reroll-count=4rev2" are allowed), but the downside of
267 267 using such a reroll-count is that the range-diff/interdiff
268 268 with the previous version does not state exactly which
269 269 version the new iteration is compared against.
270 270
271 - `--to=<email>`::
271 + --to=<email>::
272 272 Add a `To:` header to the email headers. This is in addition
273 273 to any configured headers, and may be used multiple times.
274 274 The negated form `--no-to` discards all `To:` headers added so
275 275 far (from config or command line).
276 276
277 - `--cc=<email>`::
277 + --cc=<email>::
278 278 Add a `Cc:` header to the email headers. This is in addition
279 279 to any configured headers, and may be used multiple times.
280 280 The negated form `--no-cc` discards all `Cc:` headers added so
281 281 far (from config or command line).
282 282
283 - `--from`::
284 - `--from=<ident>`::
285 - Use _<ident>_ in the `From:` header of each email. In case of a
283 + --from::
284 + --from=<ident>::
285 + Use `ident` in the `From:` header of each email. In case of a
286 286 commit email, if the author ident of the commit is not textually
287 - identical to the provided _<ident>_, place a `From:` header in the
288 - body of the message with the original author. If no _<ident>_ is
287 + identical to the provided `ident`, place a `From:` header in the
288 + body of the message with the original author. If no `ident` is
289 289 given, or if the option is not passed at all, use the ident of
290 290 the current committer.
291 291 +
@@ -296,8 +296,8 @@ header). Note also that `git send-email` already handles this
296 296 transformation for you, and this option should not be used if you are
297 297 feeding the result to `git send-email`.
298 298
299 - `--force-in-body-from`::
300 - `--no-force-in-body-from`::
299 + --force-in-body-from::
300 + --no-force-in-body-from::
301 301 With the e-mail sender specified via the `--from` option, by
302 302 default, an in-body "From:" to identify the real author of
303 303 the commit is added at the top of the commit log message if
@@ -308,7 +308,7 @@ feeding the result to `git send-email`.
308 308 Defaults to the value of the `format.forceInBodyFrom`
309 309 configuration variable.
310 310
311 - `--add-header=<header>`::
311 + --add-header=<header>::
312 312 Add an arbitrary header to the email headers. This is in addition
313 313 to any configured headers, and may be used multiple times.
314 314 For example, `--add-header="Organization: git-foo"`.
@@ -316,13 +316,13 @@ feeding the result to `git send-email`.
316 316 `Cc:`, and custom) headers added so far from config or command
317 317 line.
318 318
319 - `--cover-letter`::
320 - `--no-cover-letter`::
319 + --cover-letter::
320 + --no-cover-letter::
321 321 In addition to the patches, generate a cover letter file containing the
322 322 branch description, commit list and the overall diffstat. You can fill
323 323 in a description in the file before sending it out.
324 324
325 - `--commit-list-format=<format-spec>`::
325 + --commit-list-format=<format-spec>::
326 326 Specify the format in which to generate the commit list of the patch
327 327 series. The accepted values for format-spec are `shortlog`, `modern` or
328 328 a format-string prefixed with `log:`. E.g. `log: %s (%an)`.
@@ -334,28 +334,28 @@ feeding the result to `git send-email`.
334 334 This option given from the command-line implies the use of
335 335 `--cover-letter` unless `--no-cover-letter` is given.
336 336
337 - `--encode-email-headers`::
338 - `--no-encode-email-headers`::
337 + --encode-email-headers::
338 + --no-encode-email-headers::
339 339 Encode email headers that have non-ASCII characters with
340 340 "Q-encoding" (described in RFC 2047), instead of outputting the
341 341 headers verbatim. Defaults to the value of the
342 342 `format.encodeEmailHeaders` configuration variable.
343 343
344 - `--interdiff=<previous>`::
344 + --interdiff=<previous>::
345 345 As a reviewer aid, insert an interdiff into the cover letter,
346 346 or as commentary of the lone patch of a 1-patch series, showing
347 347 the differences between the previous version of the patch series and
348 - the series currently being formatted. _<previous>_ is a single revision
348 + the series currently being formatted. `previous` is a single revision
349 349 naming the tip of the previous series which shares a common base with
350 350 the series being formatted (for example `git format-patch
351 351 --cover-letter --interdiff=feature/v1 -3 feature/v2`).
352 352
353 - `--range-diff=<previous>`::
353 + --range-diff=<previous>::
354 354 As a reviewer aid, insert a range-diff (see linkgit:git-range-diff[1])
355 355 into the cover letter, or as commentary of the lone patch of a
356 356 1-patch series, showing the differences between the previous
357 357 version of the patch series and the series currently being formatted.
358 - _<previous>_ can be a single revision naming the tip of the previous
358 + `previous` can be a single revision naming the tip of the previous
359 359 series if it shares a common base with the series being formatted (for
360 360 example `git format-patch --cover-letter --range-diff=feature/v1 -3
361 361 feature/v2`), or a revision range if the two versions of the series are
@@ -367,7 +367,7 @@ product of `format-patch` is generated, and they are not passed to
367 367 the underlying `range-diff` machinery used to generate the cover-letter
368 368 material (this may change in the future).
369 369
370 - `--creation-factor=<percent>`::
370 + --creation-factor=<percent>::
371 371 Used with `--range-diff`, tweak the heuristic which matches up commits
372 372 between the previous and current series of patches by adjusting the
373 373 creation/deletion cost fudge factor. See linkgit:git-range-diff[1])
@@ -378,8 +378,8 @@ case is to show comparison with an older iteration of the same
378 378 topic and the tool should find more correspondence between the two
379 379 sets of patches.
380 380
381 - `--notes[=<ref>]`::
382 - `--no-notes`::
381 + --notes[=<ref>]::
382 + --no-notes::
383 383 Append the notes (see linkgit:git-notes[1]) for the commit
384 384 after the three-dash line.
385 385 +
@@ -394,17 +394,17 @@ configuration options in linkgit:git-notes[1] to use this workflow).
394 394 The default is `--no-notes`, unless the `format.notes` configuration is
395 395 set.
396 396
397 - `--signature=<signature>`::
398 - `--no-signature`::
397 + --signature=<signature>::
398 + --no-signature::
399 399 Add a signature to each message produced. Per RFC 3676 the signature
400 - is separated from the body by a line with "-- " on it. If the
400 + is separated from the body by a line with '-- ' on it. If the
401 401 signature option is omitted the signature defaults to the Git version
402 402 number.
403 403
404 - `--signature-file=<file>`::
405 - Works just like `--signature` except the signature is read from a file.
404 + --signature-file=<file>::
405 + Works just like --signature except the signature is read from a file.
406 406
407 - `--suffix=.<sfx>`::
407 + --suffix=.<sfx>::
408 408 Instead of using `.patch` as the suffix for generated
409 409 filenames, use specified suffix. A common alternative is
410 410 `--suffix=.txt`. Leaving this empty will remove the `.patch`
@@ -413,36 +413,36 @@ set.
413 413 Note that the leading character does not have to be a dot; for example,
414 414 you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
415 415
416 - `-q`::
417 - `--quiet`::
416 + -q::
417 + --quiet::
418 418 Do not print the names of the generated files to standard output.
419 419
420 - `--no-binary`::
420 + --no-binary::
421 421 Do not output contents of changes in binary files, instead
422 422 display a notice that those files changed. Patches generated
423 423 using this option cannot be applied properly, but they are
424 424 still useful for code review.
425 425
426 - `--zero-commit`::
426 + --zero-commit::
427 427 Output an all-zero hash in each patch's From header instead
428 428 of the hash of the commit.
429 429
430 - `--no-base`::
431 - `--base[=<commit>]`::
430 + --no-base::
431 + --base[=<commit>]::
432 432 Record the base tree information to identify the state the
433 433 patch series applies to. See the BASE TREE INFORMATION section
434 - below for details. If _<commit>_ is `auto`, a base commit is
434 + below for details. If <commit> is "auto", a base commit is
435 435 automatically chosen. The `--no-base` option overrides a
436 436 `format.useAutoBase` configuration.
437 437
438 - `--root`::
439 - Treat the revision argument as a _<revision-range>_, even if it
438 + --root::
439 + Treat the revision argument as a <revision-range>, even if it
440 440 is just a single commit (that would normally be treated as a
441 - _<since>_). Note that root commits included in the specified
441 + <since>). Note that root commits included in the specified
442 442 range are always formatted as creation patches, independently
443 443 of this flag.
444 444
445 - `--progress`::
445 + --progress::
446 446 Show progress reports on stderr as patches are generated.
447 447
448 448 CONFIGURATION
@@ -453,7 +453,7 @@ outputting more than one patch, add "To:" or "Cc:" headers, configure
453 453 attachments, change the patch output directory, and sign off patches
454 454 with configuration variables.
455 455
456 - ----
456 + ------------
457 457 [format]
458 458 headers = "Organization: git-foo\n"
459 459 subjectPrefix = CHANGE
@@ -467,16 +467,17 @@ with configuration variables.
467 467 coverLetter = auto
468 468 commitListFormat = shortlog
469 469 coverFromDescription = auto
470 - ----
470 + ------------
471 +
471 472
472 473 DISCUSSION
473 474 ----------
474 475
475 - The patch produced by `git format-patch` is in UNIX mailbox format,
476 + The patch produced by 'git format-patch' is in UNIX mailbox format,
476 477 with a fixed "magic" time stamp to indicate that the file is output
477 478 from format-patch rather than a real mailbox, like so:
478 479
479 - ----
480 + ------------
480 481 From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001
481 482 From: Tony Luck <tony.luck@intel.com>
482 483 Date: Tue, 13 Jul 2010 11:42:54 -0700
@@ -491,7 +492,7 @@ arch/arm config files were slimmed down using a python script
491 492
492 493 Do the same for ia64 so we can have sleek & trim looking
493 494 ...
494 - ----
495 + ------------
495 496
496 497 Typically it will be placed in a MUA's drafts folder, edited to add
497 498 timely commentary that should not go in the changelog after the three
@@ -501,12 +502,12 @@ can save interesting patches in a UNIX mailbox and apply them with
501 502 linkgit:git-am[1].
502 503
503 504 When a patch is part of an ongoing discussion, the patch generated by
504 - `git format-patch` can be tweaked to take advantage of the `git am
505 - --scissors` feature. After your response to the discussion comes a
505 + 'git format-patch' can be tweaked to take advantage of the 'git am
506 + --scissors' feature. After your response to the discussion comes a
506 507 line that consists solely of "`-- >8 --`" (scissors and perforation),
507 508 followed by the patch with unnecessary header fields removed:
508 509
509 - ----
510 + ------------
510 511 ...
511 512 > So we should do such-and-such.
512 513
@@ -517,7 +518,7 @@ Subject: [IA64] Put ia64 config files on the Uwe Kleine-König diet
517 518
518 519 arch/arm config files were slimmed down using a python script
519 520 ...
520 - ----
521 + ------------
521 522
522 523 When sending a patch this way, most often you are sending your own
523 524 patch, so in addition to the "`From $SHA1 $magic_timestamp`" marker you
@@ -539,7 +540,7 @@ two common types of corruption:
539 540 One way to test if your MUA is set up correctly is:
540 541
541 542 * Send the patch to yourself, exactly the way you would, except
542 - with `To:` and `Cc:` lines that do not contain the list and
543 + with To: and Cc: lines that do not contain the list and
543 544 maintainer address.
544 545
545 546 * Save that patch to a file in UNIX mailbox format. Call it a.patch,
@@ -560,12 +561,12 @@ If it does not apply correctly, there can be various reasons.
560 561 this case.
561 562
562 563 * The MUA corrupted your patch; "am" would complain that
563 - the patch does not apply. Look in the `.git/rebase-apply/` subdirectory and
564 - see what `patch` file contains and check for the common
565 - corruption patterns mentioned above.
564 + the patch does not apply. Look in the .git/rebase-apply/ subdirectory and
565 + see what 'patch' file contains and check for the common
566 + corruption patterns mentioned above.
566 567
567 - * While at it, check the `info` and `final-commit` files as well.
568 - If what is in `final-commit` is not exactly what you would want to
568 + * While at it, check the 'info' and 'final-commit' files as well.
569 + If what is in 'final-commit' is not exactly what you would want to
569 570 see in the commit log message, it is very likely that the
570 571 receiver would end up hand editing the log message when applying
571 572 your patch. Things like "Hi, this is my first patch.\n" in the
@@ -581,11 +582,11 @@ GMail
581 582 ~~~~~
582 583 GMail does not have any way to turn off line wrapping in the web
583 584 interface, so it will mangle any emails that you send. You can however
584 - use `git send-email` and send your patches through the GMail SMTP server, or
585 + use "git send-email" and send your patches through the GMail SMTP server, or
585 586 use any IMAP email client to connect to the google IMAP server and forward
586 587 the emails through that.
587 588
588 - For hints on using `git send-email` to send your patches through the
589 + For hints on using 'git send-email' to send your patches through the
589 590 GMail SMTP server, see the EXAMPLE section of linkgit:git-send-email[1].
590 591
591 592 For hints on submission using the IMAP interface, see the EXAMPLE
@@ -594,7 +595,7 @@ section of linkgit:git-imap-send[1].
594 595 Thunderbird
595 596 ~~~~~~~~~~~
596 597 By default, Thunderbird will both wrap emails as well as flag
597 - them as being `format=flowed`, both of which will make the
598 + them as being 'format=flowed', both of which will make the
598 599 resulting email unusable by Git.
599 600
600 601 There are three different approaches: use an add-on to turn off line wraps,
@@ -608,14 +609,14 @@ Install the Toggle Line Wrap add-on that is available from
608 609 https://addons.thunderbird.net/thunderbird/addon/toggle-line-wrap
609 610 It adds a button "Line Wrap" to the composer's toolbar
610 611 that you can tick off. Now you can compose the message as you otherwise do
611 - (cut + paste, `git format-patch` | `git imap-send`, etc), but you have to
612 + (cut + paste, 'git format-patch' | 'git imap-send', etc), but you have to
612 613 insert line breaks manually in any text that you type.
613 614
614 615 As a bonus feature, the add-on can detect patch text in the composer
615 616 and warns when line wrapping has not yet been turned off.
616 617
617 618 The add-on requires a few tweaks of the advanced configuration
618 - (`about:config`). These are listed on the download page.
619 + (about:config). These are listed on the download page.
619 620
620 621 Approach #2 (configuration)
621 622 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -642,7 +643,7 @@ Toggle it to make sure it is set to `false`. Also, search for
642 643 Toggle it to make sure it is set to `false`.
643 644
644 645 After that is done, you should be able to compose email as you
645 - otherwise would (cut + paste, `git format-patch` | `git imap-send`, etc),
646 + otherwise would (cut + paste, 'git format-patch' | 'git imap-send', etc),
646 647 and the patches will not be mangled.
647 648
648 649 Approach #3 (external editor)
@@ -659,14 +660,14 @@ External Editor from https://globs.org/articles.php?lng=en&pg=8
659 660 "Composition & Addressing" panel of the account to be used to
660 661 send the patch.
661 662
662 - 3. In the main Thunderbird window, _before_ you open the compose
663 + 3. In the main Thunderbird window, 'before' you open the compose
663 664 window for the patch, use Tools->about:config to set the
664 665 following to the indicated values:
665 666 +
666 - ----
667 + ----------
667 668 mailnews.send_plaintext_flowed => false
668 669 mailnews.wraplength => 0
669 - ----
670 + ----------
670 671
671 672 4. Open a compose window and click the external editor icon.
672 673
@@ -676,11 +677,11 @@ External Editor from https://globs.org/articles.php?lng=en&pg=8
676 677 Side note: it may be possible to do step 2 with
677 678 about:config and the following settings but no one's tried yet.
678 679
679 - ----
680 + ----------
680 681 mail.html_compose => false
681 682 mail.identity.default.compose_html => false
682 683 mail.identity.id?.compose_html => false
683 - ----
684 + ----------
684 685
685 686 There is a script in contrib/thunderbird-patch-inline which can help
686 687 you include patches with Thunderbird in an easy way. To use it, do the
@@ -707,15 +708,15 @@ BASE TREE INFORMATION
707 708
708 709 The base tree information block is used for maintainers or third party
709 710 testers to know the exact state the patch series applies to. It consists
710 - of the "base commit", which is a well-known commit that is part of the
711 + of the 'base commit', which is a well-known commit that is part of the
711 712 stable part of the project history everybody else works off of, and zero
712 - or more "prerequisite patches", which are well-known patches in flight
713 - that is not yet part of the "base commit" that need to be applied on top
714 - of "base commit" in topological order before the patches can be applied.
713 + or more 'prerequisite patches', which are well-known patches in flight
714 + that is not yet part of the 'base commit' that need to be applied on top
715 + of 'base commit' in topological order before the patches can be applied.
715 716
716 - The "base commit" is shown as "`base-commit:` " followed by the 40-hex of
717 - the commit object name. A "prerequisite patch" is shown as
718 - "`prerequisite-patch-id:` " followed by the 40-hex "patch id", which can
717 + The 'base commit' is shown as "base-commit: " followed by the 40-hex of
718 + the commit object name. A 'prerequisite patch' is shown as
719 + "prerequisite-patch-id: " followed by the 40-hex 'patch id', which can
719 720 be obtained by passing the patch through the `git patch-id --stable`
720 721 command.
721 722
@@ -733,12 +734,12 @@ range), the base tree information block is shown at the end of the
733 734 first message the command outputs (either the first patch, or the
734 735 cover letter), like this:
735 736
736 - ----
737 + ------------
737 738 base-commit: P
738 739 prerequisite-patch-id: X
739 740 prerequisite-patch-id: Y
740 741 prerequisite-patch-id: Z
741 - ----
742 + ------------
742 743
743 744 For non-linear topology, such as
744 745
@@ -762,7 +763,7 @@ EXAMPLES
762 763 --------
763 764
764 765 * Extract commits between revisions R1 and R2, and apply them on top of
765 - the current branch using `git am` to cherry-pick them:
766 + the current branch using 'git am' to cherry-pick them:
766 767 +
767 768 ------------
768 769 $ git format-patch -k --stdout R1..R2 | git am -3 -k
@@ -777,7 +778,7 @@ $ git format-patch origin
777 778 +
778 779 For each commit a separate file is created in the current directory.
779 780
780 - * Extract all commits that lead to `origin` since the inception of the
781 + * Extract all commits that lead to 'origin' since the inception of the
781 782 project:
782 783 +
783 784 ------------
@@ -793,7 +794,7 @@ $ git format-patch -M -B origin
793 794 Additionally, it detects and handles renames and complete rewrites
794 795 intelligently to produce a renaming patch. A renaming patch reduces
795 796 the amount of text output, and generally makes it easier to review.
796 - Note that non-Git `patch` programs won't understand renaming patches, so
797 + Note that non-Git "patch" programs won't understand renaming patches, so
797 798 use it only when you know the recipient uses Git to apply your patch.
798 799
799 800 * Extract three topmost commits from the current branch and format them
modified Documentation/git-imap-send.adoc
@@ -24,9 +24,9 @@ that order.
24 24
25 25 Typical usage is something like:
26 26
27 - ----
27 + ------
28 28 $ git format-patch --signoff --stdout --attach origin | git imap-send
29 - ----
29 + ------
30 30
31 31
32 32 OPTIONS
@@ -138,13 +138,13 @@ have set up) may not be verified correctly.
138 138
139 139 Using Gmail's IMAP interface:
140 140
141 - ----
141 + ---------
142 142 [imap]
143 143 folder = "[Gmail]/Drafts"
144 144 host = imaps://imap.gmail.com
145 145 user = user@gmail.com
146 146 port = 993
147 - ----
147 + ---------
148 148
149 149 Gmail does not allow using your regular password for `git imap-send`.
150 150 If you have multi-factor authentication set up on your Gmail account, you
@@ -167,34 +167,32 @@ than using app-specific passwords, and also does not enforce the need of
167 167 having multi-factor authentication. You will have to use an OAuth2.0
168 168 access token in place of your password when using this authentication.
169 169
170 - ----
170 + ---------
171 171 [imap]
172 172 folder = "[Gmail]/Drafts"
173 173 host = imaps://imap.gmail.com
174 174 user = user@gmail.com
175 175 port = 993
176 176 authmethod = OAUTHBEARER
177 - ----
177 + ---------
178 178
179 179 Using Outlook's IMAP interface:
180 180
181 181 Unlike Gmail, Outlook only supports OAuth2.0 based authentication. Also, it
182 182 supports only `XOAUTH2` as the mechanism.
183 183
184 - ----
184 + ---------
185 185 [imap]
186 186 folder = "Drafts"
187 187 host = imaps://outlook.office365.com
188 188 user = user@outlook.com
189 189 port = 993
190 190 authmethod = XOAUTH2
191 - ----
191 + ---------
192 192
193 193 Once the commits are ready to be sent, run the following command:
194 194
195 - ----
196 - $ git format-patch --cover-letter -M --stdout origin/master | git imap-send
197 - ----
195 + $ git format-patch --cover-letter -M --stdout origin/master | git imap-send
198 196
199 197 Just make sure to disable line wrapping in the email client (Gmail's web
200 198 interface will wrap lines no matter what, so you need to use a real
@@ -219,7 +217,7 @@ users may wish to visit this web page for more information:
219 217
220 218 SEE ALSO
221 219 --------
222 - linkgit:git-format-patch[1], linkgit:git-send-email[1], `mbox`(5)
220 + linkgit:git-format-patch[1], linkgit:git-send-email[1], mbox(5)
223 221
224 222 GIT
225 223 ---
modified Documentation/git-replay.adoc
@@ -80,13 +80,10 @@ incompatible with `--contained` (which is a modifier for `--onto` only).
80 80 Control how references are updated. The mode can be:
81 81 +
82 82 --
83 - ////
84 - Expanded description list compared to 'replay.refAction'.
85 - ////
86 - `update`;; (default) Update refs directly using an atomic transaction.
87 - All refs are updated or none are (all-or-nothing behavior).
88 - `print`;; Output update-ref commands for pipeline use. This is the
89 - traditional behavior where output can be piped to `git update-ref --stdin`.
83 + * `update` (default): Update refs directly using an atomic transaction.
84 + All refs are updated or none are (all-or-nothing behavior).
85 + * `print`: Output update-ref commands for pipeline use. This is the
86 + traditional behavior where output can be piped to `git update-ref --stdin`.
90 87 --
91 88 +
92 89 The default mode can be configured via the `replay.refAction` configuration variable.
@@ -212,11 +209,6 @@ This replays the range `aabbcc..ddeeff` onto commit `112233` and updates
212 209 `refs/heads/mybranch` to point at the result. This can be useful when you want
213 210 to use bare commit IDs instead of branch names.
214 211
215 - CONFIGURATION
216 - -------------
217 - :git-replay: 1
218 - include::config/replay.adoc[]
219 -
220 212 GIT
221 213 ---
222 214 Part of the linkgit:git[1] suite
modified Documentation/git-request-pull.adoc
@@ -7,8 +7,8 @@ git-request-pull - Generates a summary of pending changes
7 7
8 8 SYNOPSIS
9 9 --------
10 - [synopsis]
11 - git request-pull [-p] <start> <URL> [<end>]
10 + [verse]
11 + 'git request-pull' [-p] <start> <URL> [<end>]
12 12
13 13 DESCRIPTION
14 14 -----------
@@ -19,28 +19,28 @@ begins with the branch description, summarizes
19 19 the changes, and indicates from where they can be pulled.
20 20
21 21 The upstream project is expected to have the commit named by
22 - _<start>_ and the output asks it to integrate the changes you made
23 - since that commit, up to the commit named by _<end>_, by visiting
24 - the repository named by _<URL>_.
22 + `<start>` and the output asks it to integrate the changes you made
23 + since that commit, up to the commit named by `<end>`, by visiting
24 + the repository named by `<URL>`.
25 25
26 26
27 27 OPTIONS
28 28 -------
29 - `-p`::
29 + -p::
30 30 Include patch text in the output.
31 31
32 - _<start>_::
32 + <start>::
33 33 Commit to start at. This names a commit that is already in
34 34 the upstream history.
35 35
36 - _<URL>_::
36 + <URL>::
37 37 The repository URL to be pulled from.
38 38
39 - _<end>_::
40 - Commit to end at (defaults to `HEAD`). This names the commit
39 + <end>::
40 + Commit to end at (defaults to HEAD). This names the commit
41 41 at the tip of the history you are asking to be pulled.
42 42 +
43 - When the repository named by _<URL>_ has the commit at a tip of a
43 + When the repository named by `<URL>` has the commit at a tip of a
44 44 ref that is different from the ref you have locally, you can use the
45 45 `<local>:<remote>` syntax, to have its local name, a colon `:`, and
46 46 its remote name.
@@ -54,15 +54,11 @@ the `v1.0` release, and want it to be integrated into the project.
54 54 First you push that change to your public repository for others to
55 55 see:
56 56
57 - ----
58 - git push https://git.ko.xz/project master
59 - ----
57 + git push https://git.ko.xz/project master
60 58
61 59 Then, you run this command:
62 60
63 - ----
64 - git request-pull v1.0 https://git.ko.xz/project master
65 - ----
61 + git request-pull v1.0 https://git.ko.xz/project master
66 62
67 63 which will produce a request to the upstream, summarizing the
68 64 changes between the `v1.0` release and your `master`, to pull it
@@ -71,15 +67,11 @@ from your public repository.
71 67 If you pushed your change to a branch whose name is different from
72 68 the one you have locally, e.g.
73 69
74 - ----
75 - git push https://git.ko.xz/project master:for-linus
76 - ----
70 + git push https://git.ko.xz/project master:for-linus
77 71
78 72 then you can ask that to be pulled with
79 73
80 - ----
81 - git request-pull v1.0 https://git.ko.xz/project master:for-linus
82 - ----
74 + git request-pull v1.0 https://git.ko.xz/project master:for-linus
83 75
84 76
85 77 GIT
modified Documentation/git-send-email.adoc
@@ -8,11 +8,11 @@ git-send-email - Send a collection of patches as emails
8 8
9 9 SYNOPSIS
10 10 --------
11 - [synopsis]
12 - git send-email [<options>] (<file>|<directory>)...
13 - git send-email [<options>] <format-patch-options>
14 - git send-email --dump-aliases
15 - git send-email --translate-aliases
11 + [verse]
12 + 'git send-email' [<options>] (<file>|<directory>)...
13 + 'git send-email' [<options>] <format-patch-options>
14 + 'git send-email' --dump-aliases
15 + 'git send-email' --translate-aliases
16 16
17 17
18 18 DESCRIPTION
@@ -48,24 +48,24 @@ OPTIONS
48 48 Composing
49 49 ~~~~~~~~~
50 50
51 - `--annotate`::
51 + --annotate::
52 52 Review and edit each patch you're about to send. Default is the value
53 53 of `sendemail.annotate`. See the CONFIGURATION section for
54 54 `sendemail.multiEdit`.
55 55
56 - `--bcc=<address>,...`::
56 + --bcc=<address>,...::
57 57 Specify a `Bcc:` value for each email. Default is the value of
58 58 `sendemail.bcc`.
59 59 +
60 60 This option may be specified multiple times.
61 61
62 - `--cc=<address>,...`::
62 + --cc=<address>,...::
63 63 Specify a starting `Cc:` value for each email.
64 64 Default is the value of `sendemail.cc`.
65 65 +
66 66 This option may be specified multiple times.
67 67
68 - `--compose`::
68 + --compose::
69 69 Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
70 70 to edit an introductory message for the patch series.
71 71 +
@@ -80,7 +80,7 @@ Missing `From` or `In-Reply-To` headers will be prompted for.
80 80 +
81 81 See the CONFIGURATION section for `sendemail.multiEdit`.
82 82
83 - `--from=<address>`::
83 + --from=<address>::
84 84 Specify the sender of the emails. If not specified on the command line,
85 85 the value of the `sendemail.from` configuration option is used. If
86 86 neither the command-line option nor `sendemail.from` are set, then the
@@ -88,12 +88,12 @@ See the CONFIGURATION section for `sendemail.multiEdit`.
88 88 the value of `GIT_AUTHOR_IDENT`, or `GIT_COMMITTER_IDENT` if that is not
89 89 set, as returned by `git var -l`.
90 90
91 - `--reply-to=<address>`::
91 + --reply-to=<address>::
92 92 Specify the address where replies from recipients should go to.
93 93 Use this if replies to messages should go to another address than what
94 94 is specified with the `--from` parameter.
95 95
96 - `--in-reply-to=<identifier>`::
96 + --in-reply-to=<identifier>::
97 97 Make the first mail (or all the mails with `--no-thread`) appear as a
98 98 reply to the given Message-ID, which avoids breaking threads to
99 99 provide a new patch series.
@@ -115,8 +115,8 @@ illustration below where `[PATCH v2 0/3]` is in reply to `[PATCH 0/2]`:
115 115 Only necessary if `--compose` is also set. If `--compose`
116 116 is not set, this will be prompted for.
117 117
118 - `--outlook-id-fix`::
119 - `--no-outlook-id-fix`::
118 + --outlook-id-fix::
119 + --no-outlook-id-fix::
120 120 Microsoft Outlook SMTP servers discard the Message-ID sent via email and
121 121 assign a new random Message-ID, thus breaking threads.
122 122 +
@@ -126,15 +126,15 @@ threading. Use it only when you know that the server reports the
126 126 rewritten Message-ID the same way as Outlook servers do.
127 127 +
128 128 Without this option specified, the fix is done by default when talking
129 - to `smtp.office365.com` or `smtp-mail.outlook.com`. Use
129 + to 'smtp.office365.com' or 'smtp-mail.outlook.com'. Use
130 130 `--no-outlook-id-fix` to disable even when talking to these two servers.
131 131
132 - `--subject=<string>`::
132 + --subject=<string>::
133 133 Specify the initial subject of the email thread.
134 134 Only necessary if `--compose` is also set. If `--compose`
135 135 is not set, this will be prompted for.
136 136
137 - `--to=<address>,...`::
137 + --to=<address>,...::
138 138 Specify the primary recipient of the emails generated. Generally, this
139 139 will be the upstream maintainer of the project involved. Default is the
140 140 value of the `sendemail.to` configuration value; if that is unspecified,
@@ -142,20 +142,20 @@ to `smtp.office365.com` or `smtp-mail.outlook.com`. Use
142 142 +
143 143 This option may be specified multiple times.
144 144
145 - `--8bit-encoding=<encoding>`::
145 + --8bit-encoding=<encoding>::
146 146 When encountering a non-ASCII message or subject that does not
147 147 declare its encoding, add headers/quoting to indicate it is
148 - encoded in _<encoding>_. Default is the value of the
148 + encoded in <encoding>. Default is the value of the
149 149 `sendemail.assume8bitEncoding`; if that is unspecified, this
150 150 will be prompted for if any non-ASCII files are encountered.
151 151 +
152 152 Note that no attempts whatsoever are made to validate the encoding.
153 153
154 - `--compose-encoding=<encoding>`::
154 + --compose-encoding=<encoding>::
155 155 Specify encoding of compose message. Default is the value of the
156 156 `sendemail.composeEncoding`; if that is unspecified, UTF-8 is assumed.
157 157
158 - `--transfer-encoding=(7bit|8bit|quoted-printable|base64|auto)`::
158 + --transfer-encoding=(7bit|8bit|quoted-printable|base64|auto)::
159 159 Specify the transfer encoding to be used to send the message over SMTP.
160 160 `7bit` will fail upon encountering a non-ASCII message. `quoted-printable`
161 161 can be useful when the repository contains files that contain carriage
@@ -167,8 +167,8 @@ Note that no attempts whatsoever are made to validate the encoding.
167 167 Default is the value of the `sendemail.transferEncoding` configuration
168 168 value; if that is unspecified, default to `auto`.
169 169
170 - `--xmailer`::
171 - `--no-xmailer`::
170 + --xmailer::
171 + --no-xmailer::
172 172 Add (or prevent adding) the `X-Mailer:` header. By default,
173 173 the header is added, but it can be turned off by setting the
174 174 `sendemail.xmailer` configuration variable to `false`.
@@ -176,7 +176,7 @@ value; if that is unspecified, default to `auto`.
176 176 Sending
177 177 ~~~~~~~
178 178
179 - `--envelope-sender=<address>`::
179 + --envelope-sender=<address>::
180 180 Specify the envelope sender used to send the emails.
181 181 This is useful if your default address is not the address that is
182 182 subscribed to a list. In order to use the `From` address, set the
@@ -185,7 +185,7 @@ Sending
185 185 `sendemail.envelopeSender` configuration variable; if that is
186 186 unspecified, choosing the envelope sender is left to your MTA.
187 187
188 - `--sendmail-cmd=<command>`::
188 + --sendmail-cmd=<command>::
189 189 Specify a command to run to send the email. The command should
190 190 be sendmail-like; specifically, it must support the `-i` option.
191 191 The command will be executed in the shell if necessary. Default
@@ -193,7 +193,7 @@ Sending
193 193 `--smtp-server` is also unspecified, `git send-email` will search
194 194 for `sendmail` in `/usr/sbin`, `/usr/lib` and `$PATH`.
195 195
196 - `--smtp-encryption=<encryption>`::
196 + --smtp-encryption=<encryption>::
197 197 Specify in what way encrypting begins for the SMTP connection.
198 198 Valid values are `ssl` and `tls`. Any other value reverts to plain
199 199 (unencrypted) SMTP, which defaults to port 25.
@@ -207,14 +207,14 @@ Sending
207 207 documentation or your server configuration to make sure
208 208 for your own case. Default is the value of `sendemail.smtpEncryption`.
209 209
210 - `--smtp-domain=<FQDN>`::
210 + --smtp-domain=<FQDN>::
211 211 Specify the Fully Qualified Domain Name (FQDN) used in the
212 212 HELO/EHLO command to the SMTP server. Some servers require the
213 213 FQDN to match your IP address. If not set, `git send-email` attempts
214 214 to determine your FQDN automatically. Default is the value of
215 215 `sendemail.smtpDomain`.
216 216
217 - `--smtp-auth=<mechanisms>`::
217 + --smtp-auth=<mechanisms>::
218 218 Whitespace-separated list of allowed SMTP-AUTH mechanisms. This setting
219 219 forces using only the listed mechanisms. Example:
220 220 +
@@ -229,7 +229,7 @@ is specified, all mechanisms supported by the SASL library can be used. The
229 229 special value `none` maybe specified to completely disable authentication
230 230 independently of `--smtp-user`.
231 231
232 - `--smtp-pass[=<password>]`::
232 + --smtp-pass[=<password>]::
233 233 Password for SMTP-AUTH. The argument is optional: If no
234 234 argument is specified, then the empty string is used as
235 235 the password. Default is the value of `sendemail.smtpPass`,
@@ -241,10 +241,10 @@ or on the command line. If a username has been specified (with
241 241 specified (with `--smtp-pass` or `sendemail.smtpPass`), then
242 242 a password is obtained using linkgit:git-credential[1].
243 243
244 - `--no-smtp-auth`::
244 + --no-smtp-auth::
245 245 Disable SMTP authentication. Short hand for `--smtp-auth=none`.
246 246
247 - `--smtp-server=<host>`::
247 + --smtp-server=<host>::
248 248 Specify the outgoing SMTP server to use (e.g.
249 249 `smtp.example.com` or a raw IP address). If unspecified, and if
250 250 `--sendmail-cmd` is also unspecified, the default is to search
@@ -257,7 +257,7 @@ option. This method does not support passing arguments or using plain
257 257 command names. For those use cases, consider using `--sendmail-cmd`
258 258 instead.
259 259
260 - `--smtp-server-port=<port>`::
260 + --smtp-server-port=<port>::
261 261 Specify a port different from the default port (SMTP
262 262 servers typically listen to smtp port 25, but may also listen to
263 263 submission port 587, or the common SSL smtp port 465);
@@ -265,7 +265,7 @@ instead.
265 265 are also accepted. The port can also be set with the
266 266 `sendemail.smtpServerPort` configuration variable.
267 267
268 - `--smtp-server-option=<option>`::
268 + --smtp-server-option=<option>::
269 269 Specify the outgoing SMTP server option to use.
270 270 Default value can be specified by the `sendemail.smtpServerOption`
271 271 configuration option.
@@ -274,15 +274,15 @@ The `--smtp-server-option` option must be repeated for each option you want
274 274 to pass to the server. Likewise, different lines in the configuration files
275 275 must be used for each option.
276 276
277 - `--smtp-ssl`::
277 + --smtp-ssl::
278 278 Legacy alias for `--smtp-encryption ssl`.
279 279
280 - `--smtp-ssl-cert-path <path>`::
280 + --smtp-ssl-cert-path <path>::
281 281 Path to a store of trusted CA certificates for SMTP SSL/TLS
282 282 certificate validation (either a directory that has been processed
283 283 by `c_rehash`, or a single file containing one or more PEM format
284 284 certificates concatenated together: see the description of the
285 - `-CAfile <file>` and the `-CApath <dir>` options of
285 + `-CAfile` _<file>_ and the `-CApath` _<dir>_ options of
286 286 https://docs.openssl.org/master/man1/openssl-verify/
287 287 [OpenSSL's verify(1) manual page] for more information on these).
288 288 Set it to an empty string to disable certificate verification.
@@ -290,7 +290,7 @@ must be used for each option.
290 290 variable, if set, or the backing SSL library's compiled-in default
291 291 otherwise (which should be the best choice on most platforms).
292 292
293 - `--smtp-ssl-client-cert <path>`::
293 + --smtp-ssl-client-cert <path>::
294 294 Path to the client certificate file to present if requested by the
295 295 server. This option is required when the server is set up to verify
296 296 client certificates. If the corresponding private key is not included in
@@ -299,7 +299,7 @@ must be used for each option.
299 299 to the value of the `sendemail.smtpSSLClientCert` configuration
300 300 variable, if set.
301 301
302 - `--smtp-ssl-client-key <path>`::
302 + --smtp-ssl-client-key <path>::
303 303 Path to the client private key file that corresponds to the client
304 304 certificate. To avoid misconfiguration, this option must be used in
305 305 conjunction with the `sendemail.smtpSSLClientKey` configuration variable
@@ -309,17 +309,17 @@ must be used for each option.
309 309 more details. Defaults to the value of the `sendemail.smtpSSLClientKey`
310 310 configuration variable, if set.
311 311
312 - `--smtp-user=<user>`::
312 + --smtp-user=<user>::
313 313 Username for SMTP-AUTH. Default is the value of `sendemail.smtpUser`;
314 314 if a username is not specified (with `--smtp-user` or `sendemail.smtpUser`),
315 315 then authentication is not attempted.
316 316
317 - `--smtp-debug=(0|1)`::
317 + --smtp-debug=(0|1)::
318 318 Enable (1) or disable (0) debug output. If enabled, SMTP
319 319 commands and replies will be printed. Useful to debug TLS
320 320 connection and authentication problems.
321 321
322 - `--imap-sent-folder=<folder>`::
322 + --imap-sent-folder=<folder>::
323 323 Some email providers (e.g. iCloud) do not send a copy of the emails sent
324 324 using SMTP to the `Sent` folder or similar in your mailbox. Use this option
325 325 to use `git imap-send` to send a copy of the emails to the folder specified
@@ -331,8 +331,8 @@ must be used for each option.
331 331 This feature requires setting up `git imap-send`. See linkgit:git-imap-send[1]
332 332 for instructions.
333 333
334 - `--use-imap-only`::
335 - `--no-use-imap-only`::
334 + --use-imap-only::
335 + --no-use-imap-only::
336 336 If this is set, all emails will only be copied to the IMAP folder specified
337 337 with `--imap-sent-folder` or `sendemail.imapSentFolder` and will not be sent
338 338 to the recipients. Useful if you just want to create a draft of the emails
@@ -344,8 +344,8 @@ for instructions.
344 344 This feature requires setting up `git imap-send`. See linkgit:git-imap-send[1]
345 345 for instructions.
346 346
347 - `--batch-size=<num>`::
348 - Some email servers (e.g. `smtp.163.com`) limit the number of emails to be
347 + --batch-size=<num>::
348 + Some email servers (e.g. 'smtp.163.com') limit the number of emails to be
349 349 sent per session (connection) and this will lead to a failure when
350 350 sending many messages. With this option, send-email will disconnect after
351 351 sending _<num>_ messages and wait for a few seconds
@@ -354,7 +354,7 @@ for instructions.
354 354 retype your password every time this happens. Defaults to the
355 355 `sendemail.smtpBatchSize` configuration variable.
356 356
357 - `--relogin-delay=<int>`::
357 + --relogin-delay=<int>::
358 358 Waiting _<int>_ seconds before reconnecting to SMTP server. Used together
359 359 with `--batch-size` option. Defaults to the `sendemail.smtpReloginDelay`
360 360 configuration variable.
@@ -362,29 +362,29 @@ for instructions.
362 362 Automating
363 363 ~~~~~~~~~~
364 364
365 - `--no-to`::
366 - `--no-cc`::
367 - `--no-bcc`::
365 + --no-to::
366 + --no-cc::
367 + --no-bcc::
368 368 Clear any list of `To:`, `Cc:`, `Bcc:` addresses previously
369 369 set via config.
370 370
371 - `--no-identity`::
371 + --no-identity::
372 372 Clear the previously read value of `sendemail.identity` set
373 373 via config, if any.
374 374
375 - `--to-cmd=<command>`::
375 + --to-cmd=<command>::
376 376 Specify a command to execute once per patch file which
377 377 should generate patch file specific `To:` entries.
378 378 Output of this command must be single email address per line.
379 379 Default is the value of `sendemail.toCmd` configuration value.
380 380
381 - `--cc-cmd=<command>`::
381 + --cc-cmd=<command>::
382 382 Specify a command to execute once per patch file which
383 383 should generate patch file specific `Cc:` entries.
384 384 Output of this command must be single email address per line.
385 385 Default is the value of `sendemail.ccCmd` configuration value.
386 386
387 - `--header-cmd=<command>`::
387 + --header-cmd=<command>::
388 388 Specify a command that is executed once per outgoing message
389 389 and output RFC 2822 style header lines to be inserted into
390 390 them. When the `sendemail.headerCmd` configuration variable is
@@ -392,11 +392,11 @@ Automating
392 392 at the command line, its value takes precedence over the
393 393 `sendemail.headerCmd` configuration variable.
394 394
395 - `--no-header-cmd`::
395 + --no-header-cmd::
396 396 Disable any header command in use.
397 397
398 - `--chain-reply-to`::
399 - `--no-chain-reply-to`::
398 + --chain-reply-to::
399 + --no-chain-reply-to::
400 400 If this is set, each email will be sent as a reply to the previous
401 401 email sent. If disabled with `--no-chain-reply-to`, all emails after
402 402 the first will be sent as replies to the first email sent. When using
@@ -404,34 +404,34 @@ Automating
404 404 entire patch series. Disabled by default, but the `sendemail.chainReplyTo`
405 405 configuration variable can be used to enable it.
406 406
407 - `--identity=<identity>`::
407 + --identity=<identity>::
408 408 A configuration identity. When given, causes values in the
409 409 `sendemail.<identity>` subsection to take precedence over
410 410 values in the `sendemail` section. The default identity is
411 411 the value of `sendemail.identity`.
412 412
413 - `--signed-off-by-cc`::
414 - `--no-signed-off-by-cc`::
413 + --signed-off-by-cc::
414 + --no-signed-off-by-cc::
415 415 If this is set, add emails found in the `Signed-off-by` trailer or `Cc:`
416 416 lines to the cc list. Default is the value of `sendemail.signedOffByCc`
417 417 configuration value; if that is unspecified, default to
418 418 `--signed-off-by-cc`.
419 419
420 - `--cc-cover`::
421 - `--no-cc-cover`::
420 + --cc-cover::
421 + --no-cc-cover::
422 422 If this is set, emails found in `Cc:` headers in the first patch of
423 423 the series (typically the cover letter) are added to the cc list
424 424 for each email set. Default is the value of `sendemail.ccCover`
425 425 configuration value; if that is unspecified, default to `--no-cc-cover`.
426 426
427 - `--to-cover`::
428 - `--no-to-cover`::
427 + --to-cover::
428 + --no-to-cover::
429 429 If this is set, emails found in `To:` headers in the first patch of
430 430 the series (typically the cover letter) are added to the to list
431 431 for each email set. Default is the value of `sendemail.toCover`
432 432 configuration value; if that is unspecified, default to `--no-to-cover`.
433 433
434 - `--suppress-cc=<category>`::
434 + --suppress-cc=<category>::
435 435 Specify an additional category of recipients to suppress the
436 436 auto-cc of:
437 437 +
@@ -456,14 +456,14 @@ Default is the value of `sendemail.suppressCc` configuration value; if
456 456 that is unspecified, default to `self` if `--suppress-from` is
457 457 specified, as well as `body` if `--no-signed-off-by-cc` is specified.
458 458
459 - `--suppress-from`::
460 - `--no-suppress-from`::
459 + --suppress-from::
460 + --no-suppress-from::
461 461 If this is set, do not add the `From:` address to the `Cc:` list.
462 462 Default is the value of `sendemail.suppressFrom` configuration
463 463 value; if that is unspecified, default to `--no-suppress-from`.
464 464
465 - `--thread`::
466 - `--no-thread`::
465 + --thread::
466 + --no-thread::
467 467 If this is set, the `In-Reply-To` and `References` headers will be
468 468 added to each email sent. Whether each mail refers to the
469 469 previous email (`deep` threading per `git format-patch`
@@ -481,8 +481,8 @@ exists when `git send-email` is asked to add it (especially note that
481 481 Failure to do so may not produce the expected result in the
482 482 recipient's MUA.
483 483
484 - `--mailmap`::
485 - `--no-mailmap`::
484 + --mailmap::
485 + --no-mailmap::
486 486 Use the mailmap file (see linkgit:gitmailmap[5]) to map all
487 487 addresses to their canonical real name and email address. Additional
488 488 mailmap data specific to `git send-email` may be provided using the
@@ -492,7 +492,7 @@ recipient's MUA.
492 492 Administering
493 493 ~~~~~~~~~~~~~
494 494
495 - `--confirm=<mode>`::
495 + --confirm=<mode>::
496 496 Confirm just before sending:
497 497 +
498 498 --
@@ -508,22 +508,22 @@ Default is the value of `sendemail.confirm` configuration value; if that
508 508 is unspecified, default to `auto` unless any of the suppress options
509 509 have been specified, in which case default to `compose`.
510 510
511 - `--dry-run`::
511 + --dry-run::
512 512 Do everything except actually send the emails.
513 513
514 - `--format-patch`::
515 - `--no-format-patch`::
514 + --format-patch::
515 + --no-format-patch::
516 516 When an argument may be understood either as a reference or as a file name,
517 517 choose to understand it as a format-patch argument (`--format-patch`)
518 518 or as a file name (`--no-format-patch`). By default, when such a conflict
519 519 occurs, `git send-email` will fail.
520 520
521 - `--quiet`::
521 + --quiet::
522 522 Make `git send-email` less verbose. One line per email should be
523 523 all that is output.
524 524
525 - `--validate`::
526 - `--no-validate`::
525 + --validate::
526 + --no-validate::
527 527 Perform sanity checks on patches.
528 528 Currently, validation means the following:
529 529 +
@@ -539,20 +539,20 @@ have been specified, in which case default to `compose`.
539 539 Default is the value of `sendemail.validate`; if this is not set,
540 540 default to `--validate`.
541 541
542 - `--force`::
542 + --force::
543 543 Send emails even if safety checks would prevent it.
544 544
545 545
546 546 Information
547 547 ~~~~~~~~~~~
548 548
549 - `--dump-aliases`::
549 + --dump-aliases::
550 550 Instead of the normal operation, dump the shorthand alias names from
551 551 the configured alias file(s), one per line in alphabetical order. Note
552 552 that this only includes the alias name and not its expanded email addresses.
553 553 See `sendemail.aliasesFile` for more information about aliases.
554 554
555 - `--translate-aliases`::
555 + --translate-aliases::
556 556 Instead of the normal operation, read from standard input and
557 557 interpret each line as an email alias. Translate it according to the
558 558 configured alias file(s). Output each translated name and email
@@ -718,7 +718,7 @@ include::format-patch-caveats.adoc[]
718 718
719 719 SEE ALSO
720 720 --------
721 - linkgit:git-format-patch[1], linkgit:git-imap-send[1], `mbox`(5)
721 + linkgit:git-format-patch[1], linkgit:git-imap-send[1], mbox(5)
722 722
723 723 GIT
724 724 ---
modified bloom.c
@@ -610,10 +610,10 @@ int bloom_filter_contains_vec(const struct bloom_filter *filter,
610 610 uint32_t test_bloom_murmur3_seeded(uint32_t seed, const char *data, size_t len,
611 611 int version)
612 612 {
613 + assert(version == 1 || version == 2);
614 +
613 615 if (version == 2)
614 616 return murmur3_seeded_v2(seed, data, len);
615 - else if (version == 1)
616 - return murmur3_seeded_v1(seed, data, len);
617 617 else
618 - BUG("unexpected bloom version: %d", version);
618 + return murmur3_seeded_v1(seed, data, len);
619 619 }
modified branch.c
@@ -385,39 +385,6 @@ int validate_branchname(const char *name, struct strbuf *ref)
385 385 static int initialized_checked_out_branches;
386 386 static struct strmap current_checked_out_branches = STRMAP_INIT;
387 387
388 - enum branch_checkout_kind {
389 - BRANCH_CHECKOUT_KIND_CHECKOUT,
390 - BRANCH_CHECKOUT_KIND_REBASE,
391 - BRANCH_CHECKOUT_KIND_BISECT,
392 - BRANCH_CHECKOUT_KIND_UPDATE_REF,
393 - };
394 -
395 - struct checked_out_branch {
396 - char *refname;
397 - char *path;
398 - enum branch_checkout_kind kind;
399 - };
400 -
401 - static struct checked_out_branch *checked_out_branches;
402 - static size_t checked_out_branches_alloc, checked_out_branches_nr;
403 -
404 - static void register_checked_out_branch(const char *prefix, const char *name,
405 - const char *path,
406 - enum branch_checkout_kind kind)
407 - {
408 - char *refname = xstrfmt("%s%s", prefix, name);
409 - char *path_copy = xstrdup(path);
410 -
411 - ALLOC_GROW(checked_out_branches, checked_out_branches_nr + 1,
412 - checked_out_branches_alloc);
413 - checked_out_branches[checked_out_branches_nr].refname = refname;
414 - checked_out_branches[checked_out_branches_nr].path = path_copy;
415 - checked_out_branches[checked_out_branches_nr].kind = kind;
416 - checked_out_branches_nr++;
417 -
418 - strmap_put(&current_checked_out_branches, refname, path_copy);
419 - }
420 -
421 388 static void prepare_checked_out_branches(void)
422 389 {
423 390 int i = 0;
@@ -430,7 +397,7 @@ static void prepare_checked_out_branches(void)
430 397 worktrees = get_worktrees(the_repository);
431 398
432 399 while (worktrees[i]) {
433 - char *wt_gitdir;
400 + char *old, *wt_gitdir;
434 401 struct wt_status_state state = { 0 };
435 402 struct worktree *wt = worktrees[i++];
436 403 struct string_list update_refs = STRING_LIST_INIT_DUP;
@@ -439,25 +406,34 @@ static void prepare_checked_out_branches(void)
439 406 continue;
440 407
441 408 if (wt->head_ref) {
442 - register_checked_out_branch("", wt->head_ref, wt->path,
443 - BRANCH_CHECKOUT_KIND_CHECKOUT);
409 + old = strmap_put(&current_checked_out_branches,
410 + wt->head_ref,
411 + xstrdup(wt->path));
412 + free(old);
444 413 }
445 414
446 415 if (wt_status_check_rebase(wt, &state) &&
447 416 (state.rebase_in_progress || state.rebase_interactive_in_progress) &&
448 417 state.branch) {
449 - register_checked_out_branch("refs/heads/", state.branch,
450 - wt->path,
451 - BRANCH_CHECKOUT_KIND_REBASE);
418 + struct strbuf ref = STRBUF_INIT;
419 + strbuf_addf(&ref, "refs/heads/%s", state.branch);
420 + old = strmap_put(&current_checked_out_branches,
421 + ref.buf,
422 + xstrdup(wt->path));
423 + free(old);
424 + strbuf_release(&ref);
452 425 }
453 426 wt_status_state_free_buffers(&state);
454 427
455 428 if (wt_status_check_bisect(wt, &state) &&
456 429 state.bisecting_from) {
457 - register_checked_out_branch("refs/heads/",
458 - state.bisecting_from,
459 - wt->path,
460 - BRANCH_CHECKOUT_KIND_BISECT);
430 + struct strbuf ref = STRBUF_INIT;
431 + strbuf_addf(&ref, "refs/heads/%s", state.bisecting_from);
432 + old = strmap_put(&current_checked_out_branches,
433 + ref.buf,
434 + xstrdup(wt->path));
435 + free(old);
436 + strbuf_release(&ref);
461 437 }
462 438 wt_status_state_free_buffers(&state);
463 439
@@ -466,9 +442,10 @@ static void prepare_checked_out_branches(void)
466 442 &update_refs)) {
467 443 struct string_list_item *item;
468 444 for_each_string_list_item(item, &update_refs) {
469 - register_checked_out_branch("", item->string,
470 - wt->path,
471 - BRANCH_CHECKOUT_KIND_UPDATE_REF);
445 + old = strmap_put(&current_checked_out_branches,
446 + item->string,
447 + xstrdup(wt->path));
448 + free(old);
472 449 }
473 450 string_list_clear(&update_refs, 1);
474 451 }
@@ -485,17 +462,6 @@ const char *branch_checked_out(const char *refname)
485 462 return strmap_get(&current_checked_out_branches, refname);
486 463 }
487 464
488 - const char *branch_bisecting(const char *refname)
489 - {
490 - prepare_checked_out_branches();
491 - for (size_t i = 0; i < checked_out_branches_nr; i++) {
492 - if (!strcmp(refname, checked_out_branches[i].refname) &&
493 - checked_out_branches[i].kind == BRANCH_CHECKOUT_KIND_BISECT)
494 - return checked_out_branches[i].path;
495 - }
496 - return NULL;
497 - }
498 -
499 465 /*
500 466 * Check if a branch 'name' can be created as a new branch; die otherwise.
501 467 * 'force' can be used when it is OK for the named branch already exists.
modified branch.h
@@ -106,12 +106,6 @@ void create_branches_recursively(struct repository *r, const char *name,
106 106 */
107 107 const char *branch_checked_out(const char *refname);
108 108
109 - /*
110 - * If the branch at 'refname' is currently used for bisecting in a
111 - * worktree, then return the path to that worktree.
112 - */
113 - const char *branch_bisecting(const char *refname);
114 -
115 109 /*
116 110 * Check if 'name' can be a valid name for a branch; die otherwise.
117 111 * Return 1 if the named branch already exists; return 0 otherwise.
modified builtin/branch.c
@@ -266,13 +266,6 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
266 266
267 267 if (kinds == FILTER_REFS_BRANCHES) {
268 268 const char *path;
269 - if ((path = branch_bisecting(name))) {
270 - error(_("cannot delete branch '%s' "
271 - "used by worktree at '%s' for bisect"),
272 - bname.buf, path);
273 - ret = 1;
274 - continue;
275 - }
276 269 if ((path = branch_checked_out(name))) {
277 270 error(_("cannot delete branch '%s' "
278 271 "used by worktree at '%s'"),
modified builtin/cat-file.c
@@ -789,11 +789,8 @@ static void parse_cmd_contents(struct batch_options *opt,
789 789 struct strbuf *output,
790 790 struct expand_data *data)
791 791 {
792 - enum object_type *saved_typep = data->info.typep;
793 - data->info.typep = &data->type;
794 792 opt->batch_mode = BATCH_MODE_CONTENTS;
795 793 batch_one_object(line, output, opt, data);
796 - data->info.typep = saved_typep;
797 794 }
798 795
799 796 static void parse_cmd_info(struct batch_options *opt,
modified builtin/gc.c
@@ -30,11 +30,16 @@
30 30 #include "commit-graph.h"
31 31 #include "packfile.h"
32 32 #include "object-file.h"
33 - #include "odb.h"
33 + #include "pack.h"
34 + #include "pack-objects.h"
34 35 #include "path.h"
35 36 #include "reflog.h"
37 + #include "repack.h"
36 38 #include "rerere.h"
37 39 #include "revision.h"
40 + #include "blob.h"
41 + #include "tree.h"
42 + #include "promisor-remote.h"
38 43 #include "refs.h"
39 44 #include "remote.h"
40 45 #include "exec-cmd.h"
@@ -125,11 +130,22 @@ struct gc_config {
125 130 unsigned long max_cruft_size;
126 131 int aggressive_depth;
127 132 int aggressive_window;
133 + int gc_auto_threshold;
134 + int gc_auto_pack_limit;
128 135 int detach_auto;
129 136 char *gc_log_expire;
130 137 char *prune_expire;
131 138 char *prune_worktrees_expire;
139 + char *repack_filter;
140 + char *repack_filter_to;
132 141 char *repack_expire_to;
142 + unsigned long big_pack_threshold;
143 + unsigned long max_delta_cache_size;
144 + /*
145 + * Remove this member from gc_config once repo_settings is passed
146 + * through the callchain.
147 + */
148 + size_t delta_base_cache_limit;
133 149 };
134 150
135 151 #define GC_CONFIG_INIT { \
@@ -138,10 +154,14 @@ struct gc_config {
138 154 .cruft_packs = 1, \
139 155 .aggressive_depth = 50, \
140 156 .aggressive_window = 250, \
157 + .gc_auto_threshold = 6700, \
158 + .gc_auto_pack_limit = 50, \
141 159 .detach_auto = 1, \
142 160 .gc_log_expire = xstrdup("1.day.ago"), \
143 161 .prune_expire = xstrdup("2.weeks.ago"), \
144 162 .prune_worktrees_expire = xstrdup("3.months.ago"), \
163 + .max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE, \
164 + .delta_base_cache_limit = DEFAULT_DELTA_BASE_CACHE_LIMIT, \
145 165 }
146 166
147 167 static void gc_config_release(struct gc_config *cfg)
@@ -149,12 +169,15 @@ static void gc_config_release(struct gc_config *cfg)
149 169 free(cfg->gc_log_expire);
150 170 free(cfg->prune_expire);
151 171 free(cfg->prune_worktrees_expire);
172 + free(cfg->repack_filter);
173 + free(cfg->repack_filter_to);
152 174 }
153 175
154 176 static void gc_config(struct gc_config *cfg)
155 177 {
156 178 const char *value;
157 179 char *owned = NULL;
180 + unsigned long ulongval;
158 181
159 182 if (!repo_config_get_value(the_repository, "gc.packrefs", &value)) {
160 183 if (value && !strcmp(value, "notbare"))
@@ -169,6 +192,8 @@ static void gc_config(struct gc_config *cfg)
169 192
170 193 repo_config_get_int(the_repository, "gc.aggressivewindow", &cfg->aggressive_window);
171 194 repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth);
195 + repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold);
196 + repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
172 197 repo_config_get_bool(the_repository, "gc.autodetach", &cfg->detach_auto);
173 198 repo_config_get_bool(the_repository, "gc.cruftpacks", &cfg->cruft_packs);
174 199 repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
@@ -188,6 +213,22 @@ static void gc_config(struct gc_config *cfg)
188 213 cfg->gc_log_expire = owned;
189 214 }
190 215
216 + repo_config_get_ulong(the_repository, "gc.bigpackthreshold", &cfg->big_pack_threshold);
217 + repo_config_get_ulong(the_repository, "pack.deltacachesize", &cfg->max_delta_cache_size);
218 +
219 + if (!repo_config_get_ulong(the_repository, "core.deltabasecachelimit", &ulongval))
220 + cfg->delta_base_cache_limit = ulongval;
221 +
222 + if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) {
223 + free(cfg->repack_filter);
224 + cfg->repack_filter = owned;
225 + }
226 +
227 + if (!repo_config_get_string(the_repository, "gc.repackfilterto", &owned)) {
228 + free(cfg->repack_filter_to);
229 + cfg->repack_filter_to = owned;
230 + }
231 +
191 232 repo_config(the_repository, git_default_config, NULL);
192 233 }
193 234
@@ -423,13 +464,255 @@ out:
423 464 return should_gc;
424 465 }
425 466
426 - #define OPTIMIZE_FIELDS_FROM_GC_CONFIG(cfg, aggressive) \
427 - .prune_expire = (cfg)->prune_expire, \
428 - .expire_to = (cfg)->repack_expire_to, \
429 - .cruft_packs = (cfg)->cruft_packs, \
430 - .max_cruft_size = (cfg)->max_cruft_size, \
431 - .window = (aggressive) ? (cfg)->aggressive_window : 0, \
432 - .depth = (aggressive) ? (cfg)->aggressive_depth : 0
467 + static int too_many_loose_objects(int limit)
468 + {
469 + struct odb_source_files *files = odb_source_files_downcast(the_repository->objects->sources);
470 + /*
471 + * This is weird, but stems from legacy behaviour: the GC auto
472 + * threshold was always essentially interpreted as if it was rounded up
473 + * to the next multiple 256 of, so we retain this behaviour for now.
474 + */
475 + int auto_threshold = DIV_ROUND_UP(limit, 256) * 256;
476 + unsigned long loose_count;
477 +
478 + if (odb_source_count_objects(&files->loose->base, ODB_COUNT_OBJECTS_APPROXIMATE,
479 + &loose_count) < 0)
480 + return 0;
481 +
482 + return loose_count > auto_threshold;
483 + }
484 +
485 + static struct packed_git *find_base_packs(struct string_list *packs,
486 + unsigned long limit)
487 + {
488 + struct packed_git *p, *base = NULL;
489 +
490 + repo_for_each_pack(the_repository, p) {
491 + if (!p->pack_local || p->is_cruft)
492 + continue;
493 + if (limit) {
494 + if (p->pack_size >= limit)
495 + string_list_append(packs, p->pack_name);
496 + } else if (!base || base->pack_size < p->pack_size) {
497 + base = p;
498 + }
499 + }
500 +
501 + if (base)
502 + string_list_append(packs, base->pack_name);
503 +
504 + return base;
505 + }
506 +
507 + static int too_many_packs(struct gc_config *cfg)
508 + {
509 + struct packed_git *p;
510 + int cnt = 0;
511 +
512 + if (cfg->gc_auto_pack_limit <= 0)
513 + return 0;
514 +
515 + repo_for_each_pack(the_repository, p) {
516 + if (!p->pack_local)
517 + continue;
518 + if (p->pack_keep)
519 + continue;
520 + /*
521 + * Perhaps check the size of the pack and count only
522 + * very small ones here?
523 + */
524 + cnt++;
525 + }
526 + return cfg->gc_auto_pack_limit < cnt;
527 + }
528 +
529 + static uint64_t total_ram(void)
530 + {
531 + #if defined(HAVE_SYSINFO)
532 + struct sysinfo si;
533 +
534 + if (!sysinfo(&si)) {
535 + uint64_t total = si.totalram;
536 +
537 + if (si.mem_unit > 1)
538 + total *= (uint64_t)si.mem_unit;
539 + return total;
540 + }
541 + #elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM) || defined(HW_PHYSMEM64))
542 + uint64_t physical_memory;
543 + int mib[2];
544 + size_t length;
545 +
546 + mib[0] = CTL_HW;
547 + # if defined(HW_MEMSIZE)
548 + mib[1] = HW_MEMSIZE;
549 + # elif defined(HW_PHYSMEM64)
550 + mib[1] = HW_PHYSMEM64;
551 + # else
552 + mib[1] = HW_PHYSMEM;
553 + # endif
554 + length = sizeof(physical_memory);
555 + if (!sysctl(mib, 2, &physical_memory, &length, NULL, 0)) {
556 + if (length == 4) {
557 + uint32_t mem;
558 +
559 + if (!sysctl(mib, 2, &mem, &length, NULL, 0))
560 + physical_memory = mem;
561 + }
562 + return physical_memory;
563 + }
564 + #elif defined(GIT_WINDOWS_NATIVE)
565 + MEMORYSTATUSEX memInfo;
566 +
567 + memInfo.dwLength = sizeof(MEMORYSTATUSEX);
568 + if (GlobalMemoryStatusEx(&memInfo))
569 + return memInfo.ullTotalPhys;
570 + #endif
571 + return 0;
572 + }
573 +
574 + static uint64_t estimate_repack_memory(struct gc_config *cfg,
575 + struct packed_git *pack)
576 + {
577 + unsigned long nr_objects;
578 + size_t os_cache, heap;
579 +
580 + if (odb_count_objects(the_repository->objects,
581 + ODB_COUNT_OBJECTS_APPROXIMATE, &nr_objects) < 0)
582 + return 0;
583 +
584 + if (!pack || !nr_objects)
585 + return 0;
586 +
587 + /*
588 + * First we have to scan through at least one pack.
589 + * Assume enough room in OS file cache to keep the entire pack
590 + * or we may accidentally evict data of other processes from
591 + * the cache.
592 + */
593 + os_cache = pack->pack_size + pack->index_size;
594 + /* then pack-objects needs lots more for book keeping */
595 + heap = sizeof(struct object_entry) * nr_objects;
596 + /*
597 + * internal rev-list --all --objects takes up some memory too,
598 + * let's say half of it is for blobs
599 + */
600 + heap += sizeof(struct blob) * nr_objects / 2;
601 + /*
602 + * and the other half is for trees (commits and tags are
603 + * usually insignificant)
604 + */
605 + heap += sizeof(struct tree) * nr_objects / 2;
606 + /* and then obj_hash[], underestimated in fact */
607 + heap += sizeof(struct object *) * nr_objects;
608 + /* revindex is used also */
609 + heap += (sizeof(off_t) + sizeof(uint32_t)) * nr_objects;
610 + /*
611 + * read_sha1_file() (either at delta calculation phase, or
612 + * writing phase) also fills up the delta base cache
613 + */
614 + heap += cfg->delta_base_cache_limit;
615 + /* and of course pack-objects has its own delta cache */
616 + heap += cfg->max_delta_cache_size;
617 +
618 + return os_cache + heap;
619 + }
620 +
621 + static int keep_one_pack(struct string_list_item *item, void *data)
622 + {
623 + struct strvec *args = data;
624 + strvec_pushf(args, "--keep-pack=%s", basename(item->string));
625 + return 0;
626 + }
627 +
628 + static void add_repack_all_option(struct gc_config *cfg,
629 + struct string_list *keep_pack,
630 + struct strvec *args)
631 + {
632 + if (cfg->prune_expire && !strcmp(cfg->prune_expire, "now")
633 + && !(cfg->cruft_packs && cfg->repack_expire_to))
634 + strvec_push(args, "-a");
635 + else if (cfg->cruft_packs) {
636 + strvec_push(args, "--cruft");
637 + if (cfg->prune_expire)
638 + strvec_pushf(args, "--cruft-expiration=%s", cfg->prune_expire);
639 + if (cfg->max_cruft_size)
640 + strvec_pushf(args, "--max-cruft-size=%lu",
641 + cfg->max_cruft_size);
642 + if (cfg->repack_expire_to)
643 + strvec_pushf(args, "--expire-to=%s", cfg->repack_expire_to);
644 + } else {
645 + strvec_push(args, "-A");
646 + if (cfg->prune_expire)
647 + strvec_pushf(args, "--unpack-unreachable=%s", cfg->prune_expire);
648 + }
649 +
650 + if (keep_pack)
651 + for_each_string_list(keep_pack, keep_one_pack, args);
652 +
653 + if (cfg->repack_filter && *cfg->repack_filter)
654 + strvec_pushf(args, "--filter=%s", cfg->repack_filter);
655 + if (cfg->repack_filter_to && *cfg->repack_filter_to)
656 + strvec_pushf(args, "--filter-to=%s", cfg->repack_filter_to);
657 + }
658 +
659 + static void add_repack_incremental_option(struct strvec *args)
660 + {
661 + strvec_push(args, "--no-write-bitmap-index");
662 + }
663 +
664 + static int need_to_gc(struct gc_config *cfg, struct strvec *repack_args)
665 + {
666 + /*
667 + * Setting gc.auto to 0 or negative can disable the
668 + * automatic gc.
669 + */
670 + if (cfg->gc_auto_threshold <= 0)
671 + return 0;
672 +
673 + /*
674 + * If there are too many loose objects, but not too many
675 + * packs, we run "repack -d -l". If there are too many packs,
676 + * we run "repack -A -d -l". Otherwise we tell the caller
677 + * there is no need.
678 + */
679 + if (too_many_packs(cfg)) {
680 + struct string_list keep_pack = STRING_LIST_INIT_NODUP;
681 +
682 + if (cfg->big_pack_threshold) {
683 + find_base_packs(&keep_pack, cfg->big_pack_threshold);
684 + if (keep_pack.nr >= cfg->gc_auto_pack_limit) {
685 + cfg->big_pack_threshold = 0;
686 + string_list_clear(&keep_pack, 0);
687 + find_base_packs(&keep_pack, 0);
688 + }
689 + } else {
690 + struct packed_git *p = find_base_packs(&keep_pack, 0);
691 + uint64_t mem_have, mem_want;
692 +
693 + mem_have = total_ram();
694 + mem_want = estimate_repack_memory(cfg, p);
695 +
696 + /*
697 + * Only allow 1/2 of memory for pack-objects, leave
698 + * the rest for the OS and other processes in the
699 + * system.
700 + */
701 + if (!mem_have || mem_want < mem_have / 2)
702 + string_list_clear(&keep_pack, 0);
703 + }
704 +
705 + add_repack_all_option(cfg, &keep_pack, repack_args);
706 + string_list_clear(&keep_pack, 0);
707 + } else if (too_many_loose_objects(cfg->gc_auto_threshold))
708 + add_repack_incremental_option(repack_args);
709 + else
710 + return 0;
711 +
712 + if (run_hooks(the_repository, "pre-auto-gc"))
713 + return 0;
714 + return 1;
715 + }
433 716
434 717 /* return NULL on success, else hostname running the gc */
435 718 static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
@@ -558,27 +841,6 @@ static int gc_foreground_tasks(struct maintenance_run_opts *opts,
558 841 return 0;
559 842 }
560 843
561 - static int maintenance_task_odb(struct maintenance_run_opts *opts,
562 - struct gc_config *cfg,
563 - int keep_largest_pack,
564 - int aggressive)
565 - {
566 - struct odb_optimize_options odb_opts = {
567 - .strategy = ODB_OPTIMIZE_INCREMENTAL,
568 - .keep_largest_pack = keep_largest_pack,
569 - OPTIMIZE_FIELDS_FROM_GC_CONFIG(cfg, aggressive),
570 - };
571 -
572 - if (opts->auto_flag)
573 - odb_opts.flags |= ODB_OPTIMIZE_AUTO;
574 - if (!opts->quiet)
575 - odb_opts.flags |= ODB_OPTIMIZE_VERBOSE;
576 - if (aggressive)
577 - odb_opts.flags |= ODB_OPTIMIZE_NO_REUSE_DELTAS;
578 -
579 - return odb_optimize(the_repository->objects, &odb_opts);
580 - }
581 -
582 844 int cmd_gc(int argc,
583 845 const char **argv,
584 846 const char *prefix,
@@ -592,6 +854,7 @@ int cmd_gc(int argc,
592 854 int keep_largest_pack = -1;
593 855 int skip_foreground_tasks = 0;
594 856 timestamp_t dummy;
857 + struct strvec repack_args = STRVEC_INIT;
595 858 struct maintenance_run_opts opts = MAINTENANCE_RUN_OPTS_INIT;
596 859 struct gc_config cfg = GC_CONFIG_INIT;
597 860 const char *prune_expire_sentinel = "sentinel";
@@ -631,6 +894,8 @@ int cmd_gc(int argc,
631 894 show_usage_with_options_if_asked(argc, argv,
632 895 builtin_gc_usage, builtin_gc_options);
633 896
897 + strvec_pushl(&repack_args, "repack", "-d", "-l", NULL);
898 +
634 899 gc_config(&cfg);
635 900
636 901 if (parse_expiry_date(cfg.gc_log_expire, &gc_log_expire_time))
@@ -651,20 +916,24 @@ int cmd_gc(int argc,
651 916 if (cfg.prune_expire && parse_expiry_date(cfg.prune_expire, &dummy))
652 917 die(_("failed to parse prune expiry value %s"), cfg.prune_expire);
653 918
654 - if (opts.auto_flag) {
655 - struct odb_optimize_options optimize_opts = {
656 - .strategy = ODB_OPTIMIZE_INCREMENTAL,
657 - OPTIMIZE_FIELDS_FROM_GC_CONFIG(&cfg, 0),
658 - };
919 + if (aggressive) {
920 + strvec_push(&repack_args, "-f");
921 + if (cfg.aggressive_depth > 0)
922 + strvec_pushf(&repack_args, "--depth=%d", cfg.aggressive_depth);
923 + if (cfg.aggressive_window > 0)
924 + strvec_pushf(&repack_args, "--window=%d", cfg.aggressive_window);
925 + }
926 + if (opts.quiet)
927 + strvec_push(&repack_args, "-q");
659 928
929 + if (opts.auto_flag) {
660 930 if (cfg.detach_auto && opts.detach < 0)
661 931 opts.detach = 1;
662 932
663 933 /*
664 934 * Auto-gc should be least intrusive as possible.
665 935 */
666 - if (!odb_optimize_required(the_repository->objects, &optimize_opts) ||
667 - run_hooks(the_repository, "pre-auto-gc")) {
936 + if (!need_to_gc(&cfg, &repack_args)) {
668 937 ret = 0;
669 938 goto out;
670 939 }
@@ -676,6 +945,18 @@ int cmd_gc(int argc,
676 945 fprintf(stderr, _("Auto packing the repository for optimum performance.\n"));
677 946 fprintf(stderr, _("See \"git help gc\" for manual housekeeping.\n"));
678 947 }
948 + } else {
949 + struct string_list keep_pack = STRING_LIST_INIT_NODUP;
950 +
951 + if (keep_largest_pack != -1) {
952 + if (keep_largest_pack)
953 + find_base_packs(&keep_pack, 0);
954 + } else if (cfg.big_pack_threshold) {
955 + find_base_packs(&keep_pack, cfg.big_pack_threshold);
956 + }
957 +
958 + add_repack_all_option(&cfg, &keep_pack, &repack_args);
959 + string_list_clear(&keep_pack, 0);
679 960 }
680 961
681 962 if (opts.detach > 0) {
@@ -731,6 +1012,33 @@ int cmd_gc(int argc,
731 1012 if (opts.detach <= 0 && !skip_foreground_tasks)
732 1013 gc_foreground_tasks(&opts, &cfg);
733 1014
1015 + if (!the_repository->repository_format_precious_objects) {
1016 + struct child_process repack_cmd = CHILD_PROCESS_INIT;
1017 +
1018 + repack_cmd.git_cmd = 1;
1019 + repack_cmd.odb_to_close = the_repository->objects;
1020 + strvec_pushv(&repack_cmd.args, repack_args.v);
1021 + if (run_command(&repack_cmd))
1022 + die(FAILED_RUN, repack_args.v[0]);
1023 +
1024 + if (cfg.prune_expire) {
1025 + struct child_process prune_cmd = CHILD_PROCESS_INIT;
1026 +
1027 + strvec_pushl(&prune_cmd.args, "prune", "--expire", NULL);
1028 + /* run `git prune` even if using cruft packs */
1029 + strvec_push(&prune_cmd.args, cfg.prune_expire);
1030 + if (opts.quiet)
1031 + strvec_push(&prune_cmd.args, "--no-progress");
1032 + if (repo_has_promisor_remote(the_repository))
1033 + strvec_push(&prune_cmd.args,
1034 + "--exclude-promisor-objects");
1035 + prune_cmd.git_cmd = 1;
1036 +
1037 + if (run_command(&prune_cmd))
1038 + die(FAILED_RUN, prune_cmd.args.v[0]);
1039 + }
1040 + }
1041 +
734 1042 if (cfg.prune_worktrees_expire &&
735 1043 maintenance_task_worktree_prune(&opts, &cfg))
736 1044 die(FAILED_RUN, "worktree");
@@ -738,9 +1046,6 @@ int cmd_gc(int argc,
738 1046 if (maintenance_task_rerere_gc(&opts, &cfg))
739 1047 die(FAILED_RUN, "rerere");
740 1048
741 - if (maintenance_task_odb(&opts, &cfg, keep_largest_pack, aggressive))
742 - die(NULL);
743 -
744 1049 report_garbage = report_pack_garbage;
745 1050 odb_reprepare(the_repository->objects);
746 1051 if (pack_garbage.nr > 0) {
@@ -753,6 +1058,10 @@ int cmd_gc(int argc,
753 1058 !opts.quiet && !daemonized ? COMMIT_GRAPH_WRITE_PROGRESS : 0,
754 1059 NULL);
755 1060
1061 + if (opts.auto_flag && too_many_loose_objects(cfg.gc_auto_threshold))
1062 + warning(_("There are too many unreachable loose objects; "
1063 + "run 'git prune' to remove them."));
1064 +
756 1065 if (!daemonized) {
757 1066 char *path = repo_git_path(the_repository, "gc.log");
758 1067 unlink(path);
@@ -761,6 +1070,7 @@ int cmd_gc(int argc,
761 1070
762 1071 out:
763 1072 maintenance_run_opts_release(&opts);
1073 + strvec_clear(&repack_args);
764 1074 gc_config_release(&cfg);
765 1075 return 0;
766 1076 }
@@ -963,11 +1273,15 @@ static int maintenance_task_gc_background(struct maintenance_run_opts *opts,
963 1273
964 1274 static int gc_condition(struct gc_config *cfg)
965 1275 {
966 - struct odb_optimize_options opts = {
967 - .strategy = ODB_OPTIMIZE_INCREMENTAL,
968 - OPTIMIZE_FIELDS_FROM_GC_CONFIG(cfg, 0),
969 - };
970 - return odb_optimize_required(the_repository->objects, &opts);
1276 + /*
1277 + * Note that it's fine to drop the repack arguments here, as we execute
1278 + * git-gc(1) as a separate child process anyway. So it knows to compute
1279 + * these arguments again.
1280 + */
1281 + struct strvec repack_args = STRVEC_INIT;
1282 + int ret = need_to_gc(cfg, &repack_args);
1283 + strvec_clear(&repack_args);
1284 + return ret;
971 1285 }
972 1286
973 1287 static int prune_packed(struct maintenance_run_opts *opts)
@@ -1256,24 +1570,104 @@ static int maintenance_task_incremental_repack(struct maintenance_run_opts *opts
1256 1570 static int maintenance_task_geometric_repack(struct maintenance_run_opts *opts,
1257 1571 struct gc_config *cfg)
1258 1572 {
1259 - struct odb_optimize_options odb_opts = {
1260 - .strategy = ODB_OPTIMIZE_GEOMETRIC,
1261 - OPTIMIZE_FIELDS_FROM_GC_CONFIG(cfg, 0),
1573 + struct pack_geometry geometry = {
1574 + .split_factor = 2,
1262 1575 };
1576 + struct pack_objects_args po_args = {
1577 + .local = 1,
1578 + };
1579 + struct existing_packs existing_packs = EXISTING_PACKS_INIT;
1580 + struct string_list kept_packs = STRING_LIST_INIT_DUP;
1581 + struct child_process child = CHILD_PROCESS_INIT;
1582 + int ret;
1263 1583
1264 - if (!opts->quiet)
1265 - odb_opts.flags |= ODB_OPTIMIZE_VERBOSE;
1584 + repo_config_get_int(the_repository, "maintenance.geometric-repack.splitFactor",
1585 + &geometry.split_factor);
1266 1586
1267 - return odb_optimize(the_repository->objects, &odb_opts);
1587 + existing_packs.repo = the_repository;
1588 + existing_packs_collect(&existing_packs, &kept_packs);
1589 + pack_geometry_init(&geometry, &existing_packs, &po_args);
1590 + pack_geometry_split(&geometry);
1591 +
1592 + child.git_cmd = 1;
1593 + child.odb_to_close = the_repository->objects;
1594 +
1595 + strvec_pushl(&child.args, "repack", "-d", "-l", NULL);
1596 + if (geometry.split < geometry.pack_nr)
1597 + strvec_pushf(&child.args, "--geometric=%d",
1598 + geometry.split_factor);
1599 + else
1600 + add_repack_all_option(cfg, NULL, &child.args);
1601 + if (opts->quiet)
1602 + strvec_push(&child.args, "--quiet");
1603 + if (the_repository->settings.core_multi_pack_index)
1604 + strvec_push(&child.args, "--write-midx");
1605 +
1606 + if (run_command(&child)) {
1607 + ret = error(_("failed to perform geometric repack"));
1608 + goto out;
1609 + }
1610 +
1611 + ret = 0;
1612 +
1613 + out:
1614 + existing_packs_release(&existing_packs);
1615 + pack_geometry_release(&geometry);
1616 + return ret;
1268 1617 }
1269 1618
1270 - static int geometric_repack_auto_condition(struct gc_config *cfg)
1619 + static int geometric_repack_auto_condition(struct gc_config *cfg UNUSED)
1271 1620 {
1272 - struct odb_optimize_options opts = {
1273 - .strategy = ODB_OPTIMIZE_GEOMETRIC,
1274 - OPTIMIZE_FIELDS_FROM_GC_CONFIG(cfg, 0),
1621 + struct pack_geometry geometry = {
1622 + .split_factor = 2,
1623 + };
1624 + struct pack_objects_args po_args = {
1625 + .local = 1,
1275 1626 };
1276 - return odb_optimize_required(the_repository->objects, &opts);
1627 + struct existing_packs existing_packs = EXISTING_PACKS_INIT;
1628 + struct string_list kept_packs = STRING_LIST_INIT_DUP;
1629 + int auto_value = 100;
1630 + int ret;
1631 +
1632 + repo_config_get_int(the_repository, "maintenance.geometric-repack.auto",
1633 + &auto_value);
1634 + if (!auto_value)
1635 + return 0;
1636 + if (auto_value < 0)
1637 + return 1;
1638 +
1639 + repo_config_get_int(the_repository, "maintenance.geometric-repack.splitFactor",
1640 + &geometry.split_factor);
1641 +
1642 + existing_packs.repo = the_repository;
1643 + existing_packs_collect(&existing_packs, &kept_packs);
1644 + pack_geometry_init(&geometry, &existing_packs, &po_args);
1645 + pack_geometry_split(&geometry);
1646 +
1647 + /*
1648 + * When we'd merge at least two packs with one another we always
1649 + * perform the repack.
1650 + */
1651 + if (geometry.split) {
1652 + ret = 1;
1653 + goto out;
1654 + }
1655 +
1656 + /*
1657 + * Otherwise, we estimate the number of loose objects to determine
1658 + * whether we want to create a new packfile or not.
1659 + */
1660 + if (too_many_loose_objects(auto_value)) {
1661 + ret = 1;
1662 + goto out;
1663 + }
1664 +
1665 + ret = 0;
1666 +
1667 + out:
1668 + existing_packs_release(&existing_packs);
1669 + pack_geometry_release(&geometry);
1670 + return ret;
1277 1671 }
1278 1672
1279 1673 typedef int (*maintenance_task_fn)(struct maintenance_run_opts *opts,
@@ -1361,18 +1755,11 @@ enum task_phase {
1361 1755 TASK_PHASE_BACKGROUND,
1362 1756 };
1363 1757
1364 - enum auto_gc_hook_result {
1365 - AUTO_GC_HOOK_UNDECIDED = 0,
1366 - AUTO_GC_HOOK_RUN = 1,
1367 - AUTO_GC_HOOK_SKIP = 2,
1368 - };
1369 -
1370 1758 static int maybe_run_task(const struct maintenance_task *task,
1371 1759 struct repository *repo,
1372 1760 struct maintenance_run_opts *opts,
1373 1761 struct gc_config *cfg,
1374 - enum task_phase phase,
1375 - enum auto_gc_hook_result *auto_gc_hook_result)
1762 + enum task_phase phase)
1376 1763 {
1377 1764 int foreground = (phase == TASK_PHASE_FOREGROUND);
1378 1765 maintenance_task_fn fn = foreground ? task->foreground : task->background;
@@ -1381,19 +1768,9 @@ static int maybe_run_task(const struct maintenance_task *task,
1381 1768
1382 1769 if (!fn)
1383 1770 return 0;
1384 - if (opts->auto_flag) {
1385 - if (*auto_gc_hook_result == AUTO_GC_HOOK_SKIP)
1386 - return 0;
1387 -
1388 - if (!task->auto_condition || !task->auto_condition(cfg))
1389 - return 0;
1390 -
1391 - if (*auto_gc_hook_result == AUTO_GC_HOOK_UNDECIDED)
1392 - *auto_gc_hook_result = run_hooks(repo, "pre-auto-gc") ?
1393 - AUTO_GC_HOOK_SKIP : AUTO_GC_HOOK_RUN;
1394 - if (*auto_gc_hook_result == AUTO_GC_HOOK_SKIP)
1395 - return 0;
1396 - }
1771 + if (opts->auto_flag &&
1772 + (!task->auto_condition || !task->auto_condition(cfg)))
1773 + return 0;
1397 1774
1398 1775 trace2_region_enter(region, task->name, repo);
1399 1776 if (fn(opts, cfg)) {
@@ -1412,7 +1789,6 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
1412 1789 struct lock_file lk;
1413 1790 struct repository *r = the_repository;
1414 1791 char *lock_path = xstrfmt("%s/maintenance", r->objects->sources->path);
1415 - enum auto_gc_hook_result auto_gc_hook_result = AUTO_GC_HOOK_UNDECIDED;
1416 1792
1417 1793 if (repo_hold_lock_file_for_update(r, &lk, lock_path, LOCK_NO_DEREF) < 0) {
1418 1794 /*
@@ -1432,7 +1808,7 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
1432 1808
1433 1809 for (size_t i = 0; i < opts->tasks_nr; i++)
1434 1810 if (maybe_run_task(&tasks[opts->tasks[i]], r, opts, cfg,
1435 - TASK_PHASE_FOREGROUND, &auto_gc_hook_result))
1811 + TASK_PHASE_FOREGROUND))
1436 1812 result = 1;
1437 1813
1438 1814 /* Failure to daemonize is ok, we'll continue in foreground. */
@@ -1444,7 +1820,7 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
1444 1820
1445 1821 for (size_t i = 0; i < opts->tasks_nr; i++)
1446 1822 if (maybe_run_task(&tasks[opts->tasks[i]], r, opts, cfg,
1447 - TASK_PHASE_BACKGROUND, &auto_gc_hook_result))
1823 + TASK_PHASE_BACKGROUND))
1448 1824 result = 1;
1449 1825
1450 1826 rollback_lock_file(&lk);
modified builtin/merge.c
@@ -1373,7 +1373,7 @@ int cmd_merge(int argc,
1373 1373 struct commit_list *common = NULL;
1374 1374 const char *best_strategy = NULL, *wt_strategy = NULL;
1375 1375 struct commit_list *remoteheads = NULL, *p;
1376 - void *branch_to_free, *argv_to_free = NULL;
1376 + void *branch_to_free;
1377 1377 int orig_argc = argc;
1378 1378 int merge_log_config = -1;
1379 1379
@@ -1517,10 +1517,8 @@ int cmd_merge(int argc,
1517 1517 option_commit = 1;
1518 1518
1519 1519 if (!argc) {
1520 - if (default_to_upstream) {
1520 + if (default_to_upstream)
1521 1521 argc = setup_with_upstream(&argv);
1522 - argv_to_free = argv;
1523 - }
1524 1522 else
1525 1523 die(_("No commit specified and merge.defaultToUpstream not set."));
1526 1524 } else if (argc == 1 && !strcmp(argv[0], "-")) {
@@ -1882,7 +1880,6 @@ done:
1882 1880 }
1883 1881 strbuf_release(&buf);
1884 1882 free(branch_to_free);
1885 - free(argv_to_free);
1886 1883 free(pull_twohead);
1887 1884 free(pull_octopus);
1888 1885 discard_index(the_repository->index);
modified builtin/mv.c
@@ -22,7 +22,6 @@
22 22 #include "string-list.h"
23 23 #include "parse-options.h"
24 24 #include "read-cache-ll.h"
25 - #include "symlinks.h"
26 25
27 26 #include "setup.h"
28 27 #include "strvec.h"
@@ -49,12 +48,6 @@ enum update_mode {
49 48 MOVE_VIA_PARENT_DIR = (1 << 5),
50 49 };
51 50
52 - static int needs_worktree_rename(enum update_mode mode, enum update_mode dst_mode)
53 - {
54 - return !(mode & (INDEX | SPARSE | SKIP_WORKTREE_DIR)) &&
55 - !(dst_mode & (SKIP_WORKTREE_DIR | SPARSE));
56 - }
57 -
58 51 #define DUP_BASENAME 1
59 52 #define KEEP_TRAILING_SLASH 2
60 53
@@ -450,41 +443,6 @@ dir_check:
450 443 bad = _("destination directory does not exist");
451 444 goto act_on_entry;
452 445 }
453 - if (has_symlink_leading_path(dst, strlen(dst))) {
454 - bad = _("destination is beyond a symbolic link");
455 - goto act_on_entry;
456 - }
457 -
458 - /*
459 - * If we are going to move SRC to DST on disk, DST's leading
460 - * directories must already exist.
461 - */
462 - if (needs_worktree_rename(modes[i], dst_mode)) {
463 - const char *slash_ = strrchr(dst, '/');
464 -
465 - if (slash_) {
466 - struct stat dir_st;
467 - char *dst_dir = xstrdup(dst);
468 - char *slash = &dst_dir[slash_ - dst];
469 -
470 - *slash = '\0';
471 - if (lstat(dst_dir, &dir_st) < 0) {
472 - /*
473 - * other errors fall through to rename(),
474 - * which reports them
475 - */
476 - if (errno == ENOENT || errno == ENOTDIR)
477 - bad = _("destination directory does not exist");
478 - } else if (!S_ISDIR(dir_st.st_mode)) {
479 - bad = _("destination is not a directory");
480 - }
481 -
482 - free(dst_dir);
483 - }
484 -
485 - if (bad)
486 - goto act_on_entry;
487 - }
488 446
489 447 if (ignore_sparse &&
490 448 (dst_mode & (SKIP_WORKTREE_DIR | SPARSE)) &&
@@ -586,11 +544,12 @@ remove_entry:
586 544 printf(_("Renaming %s to %s\n"), src, dst);
587 545 if (show_only)
588 546 continue;
589 - if (needs_worktree_rename(mode, dst_mode) &&
547 + if (!(mode & (INDEX | SPARSE | SKIP_WORKTREE_DIR)) &&
548 + !(dst_mode & (SKIP_WORKTREE_DIR | SPARSE)) &&
590 549 rename(src, dst) < 0) {
591 550 if (ignore_errors)
592 551 continue;
593 - die_errno(_("renaming '%s' to '%s' failed"), src, dst);
552 + die_errno(_("renaming '%s' failed"), src);
594 553 }
595 554 if (submodule_gitfiles[i]) {
596 555 if (!update_path_in_gitmodules(src, dst))
modified compat/mingw.c
@@ -353,29 +353,6 @@ process_phantom_symlink(const wchar_t *wtarget, const wchar_t *wlink)
353 353 wchar_t relative[MAX_PATH];
354 354 const wchar_t *rel;
355 355
356 - /*
357 - * Do not follow symlinks to network shares, to avoid NTLM credential
358 - * leak from crafted repositories (e.g. \\attacker-server\share).
359 - * Since paths come in all kind of enterprising shapes and forms (in
360 - * addition to the canonical `\\host\share` form, there's also
361 - * `\??\UNC\host\share`, `\GLOBAL??\UNC\host\share` and also
362 - * `\Device\Mup\host\share`, just to name a few), we simply avoid
363 - * following every symlink target that starts with a slash.
364 - *
365 - * This also catches drive-less absolute paths, of course. These are
366 - * uncommon in practice (and also fragile because they are relative to
367 - * the current working directory's drive). The only "harm" this does
368 - * is that it now requires users to specify via the Git attributes if
369 - * they have such an uncommon symbolic link and need it to be a
370 - * directory type link.
371 - */
372 - if (is_wdir_sep(wtarget[0])) {
373 - warning("created file symlink '%ls' pointing to '%ls';\n"
374 - "set the `symlink` gitattribute to `dir` if a "
375 - "directory symlink is required", wlink, wtarget);
376 - return PHANTOM_SYMLINK_DONE;
377 - }
378 -
379 356 /* check that wlink is still a file symlink */
380 357 if ((GetFileAttributesW(wlink)
381 358 & (FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_DIRECTORY))
modified config.mak.uname
@@ -754,26 +754,16 @@ ifeq ($(uname_S),MINGW)
754 754 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
755 755 BASIC_LDFLAGS += -Wl,--dynamicbase
756 756 endif
757 - ifeq (MINGW32,$(MSYSTEM))
758 - prefix = /mingw32
759 - HOST_CPU = i686
760 - BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
761 - endif
762 - ifeq (MINGW64,$(MSYSTEM))
763 - prefix = /mingw64
764 - HOST_CPU = x86_64
765 - BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
766 - else ifeq (CLANGARM64,$(MSYSTEM))
767 - prefix = /clangarm64
768 - HOST_CPU = aarch64
769 - BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
770 - else
771 - COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
772 - BASIC_LDFLAGS += -Wl,--large-address-aware
757 + ifneq (,$(MSYSTEM))
758 + prefix = $(MINGW_PREFIX)
759 + HOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))
760 + BASIC_LDFLAGS += -Wl,--pic-executable
761 + COMPAT_CFLAGS += -DDETECT_MSYS_TTY
762 + ifeq (MINGW32,$(MSYSTEM))
763 + BASIC_LDFLAGS += -Wl,--large-address-aware
764 + endif
773 765 endif
774 - CC = gcc
775 - COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
776 - -fstack-protector-strong
766 + COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong
777 767 EXTLIBS += -lntdll
778 768 EXTRA_PROGRAMS += headless-git$X
779 769 INSTALL = /bin/install
@@ -781,6 +771,7 @@ ifeq ($(uname_S),MINGW)
781 771 HAVE_LIBCHARSET_H = YesPlease
782 772 USE_GETTEXT_SCHEME = fallthrough
783 773 USE_LIBPCRE = YesPlease
774 + NO_PYTHON =
784 775 ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
785 776 # Move system config into top-level /etc/
786 777 ETC_GITCONFIG = ../etc/gitconfig
modified diff-lib.c
@@ -467,7 +467,7 @@ static void do_oneway_diff(struct unpack_trees_options *o,
467 467 if (cached && idx && ce_stage(idx)) {
468 468 struct diff_filepair *pair;
469 469 pair = diff_unmerge(&revs->diffopt, idx->name);
470 - if (pair && tree)
470 + if (tree)
471 471 fill_filespec(pair->one, &tree->oid, 1,
472 472 tree->ce_mode);
473 473 return;
@@ -508,9 +508,11 @@ static void do_oneway_diff(struct unpack_trees_options *o,
508 508 * For diffing, the index is more important, and we only have a
509 509 * single tree.
510 510 *
511 + * We're supposed to advance o->pos to skip what we have already processed.
512 + *
511 513 * This wrapper makes it all more readable, and takes care of all
512 514 * the fairly complex unpack_trees() semantic requirements, including
513 - * the path matching, the type conflict cases etc.
515 + * the skipping, the path matching, the type conflict cases etc.
514 516 */
515 517 static int oneway_diff(const struct cache_entry * const *src,
516 518 struct unpack_trees_options *o)
@@ -528,21 +530,6 @@ static int oneway_diff(const struct cache_entry * const *src,
528 530 if (tree == o->df_conflict_entry)
529 531 tree = NULL;
530 532
531 - /*
532 - * We should only see a NULL idx when the entry was present in the tree
533 - * but deleted in the idx. In which case it should be impossible
534 - * that a NULL tree was passed in (there would have been no entry at
535 - * all) or that we got a df conflict above (you need a directory and a
536 - * file to get such a conflict, which implies both sides are present).
537 - */
538 - if (!idx && !tree)
539 - BUG("oneway_diff with neither idx nor tree");
540 -
541 - if (revs->diffopt.prefix &&
542 - strncmp((idx ? idx : tree)->name, revs->diffopt.prefix,
543 - revs->diffopt.prefix_length))
544 - return 0;
545 -
546 533 if (ce_path_match(revs->diffopt.repo->index,
547 534 idx ? idx : tree,
548 535 &revs->prune_data, NULL)) {
modified odb.c
@@ -1034,18 +1034,6 @@ int odb_write_object_stream(struct object_database *odb,
1034 1034 return odb_source_write_object_stream(odb->sources, stream, len, oid);
1035 1035 }
1036 1036
1037 - int odb_optimize(struct object_database *odb,
1038 - const struct odb_optimize_options *opts)
1039 - {
1040 - return odb_source_optimize(odb->sources, opts);
1041 - }
1042 -
1043 - bool odb_optimize_required(struct object_database *odb,
1044 - const struct odb_optimize_options *opts)
1045 - {
1046 - return odb_source_optimize_required(odb->sources, opts);
1047 - }
1048 -
1049 1037 struct object_database *odb_new(struct repository *repo,
1050 1038 const char *primary_source,
1051 1039 const char *secondary_sources)
modified odb.h
@@ -118,51 +118,6 @@ struct object_database *odb_new(struct repository *repo,
118 118 /* Free the object database and release all resources. */
119 119 void odb_free(struct object_database *o);
120 120
121 - enum odb_optimize_strategy {
122 - ODB_OPTIMIZE_INCREMENTAL,
123 - ODB_OPTIMIZE_GEOMETRIC,
124 - };
125 -
126 - enum odb_optimize_flags {
127 - /* Enable verbose logging and progress reporting. */
128 - ODB_OPTIMIZE_VERBOSE = (1 << 0),
129 -
130 - /* Perform auto-maintenance, only optimizing objects as required. */
131 - ODB_OPTIMIZE_AUTO = (1 << 1),
132 -
133 - /* Recompute existing deltas. */
134 - ODB_OPTIMIZE_NO_REUSE_DELTAS = (1 << 2),
135 - };
136 -
137 - struct odb_optimize_options {
138 - enum odb_optimize_strategy strategy;
139 - enum odb_optimize_flags flags;
140 - const char *prune_expire;
141 - const char *expire_to;
142 - int depth;
143 - int window;
144 -
145 - /* Backend-specific options. */
146 - int keep_largest_pack;
147 - int cruft_packs;
148 - unsigned long max_cruft_size;
149 - };
150 -
151 - /*
152 - * Optimize the object database. Returns 0 on success, a negative error code
153 - * otherwise.
154 - */
155 - int odb_optimize(struct object_database *odb,
156 - const struct odb_optimize_options *opts);
157 -
158 - /*
159 - * Check whether optimization of the object database is required given the
160 - * provided options. Returns true if optimization should be performed, false
161 - * otherwise.
162 - */
163 - bool odb_optimize_required(struct object_database *odb,
164 - const struct odb_optimize_options *opts);
165 -
166 121 /*
167 122 * Close the object database and all of its sources so that any held resources
168 123 * will be released. The database can still be used after closing it, in which
modified odb/source-files.c
@@ -1,8 +1,6 @@
1 1 #include "git-compat-util.h"
2 2 #include "abspath.h"
3 - #include "blob.h"
4 3 #include "chdir-notify.h"
5 - #include "config.h"
6 4 #include "gettext.h"
7 5 #include "lockfile.h"
8 6 #include "object-file.h"
@@ -10,16 +8,8 @@
10 8 #include "odb/source.h"
11 9 #include "odb/source-files.h"
12 10 #include "odb/source-loose.h"
13 - #include "pack-objects.h"
14 11 #include "packfile.h"
15 - #include "path.h"
16 - #include "promisor-remote.h"
17 - #include "repack.h"
18 - #include "run-command.h"
19 12 #include "strbuf.h"
20 - #include "string-list.h"
21 - #include "strvec.h"
22 - #include "tree.h"
23 13 #include "write-or-die.h"
24 14
25 15 static void odb_source_files_reparent(const char *name UNUSED,
@@ -271,464 +261,6 @@ out:
271 261 return ret;
272 262 }
273 263
274 - static int too_many_loose_objects(struct odb_source_files *files, int limit)
275 - {
276 - unsigned long loose_count;
277 -
278 - if (limit <= 0)
279 - return 0;
280 -
281 - if (odb_source_count_objects(&files->loose->base, ODB_COUNT_OBJECTS_APPROXIMATE,
282 - &loose_count) < 0)
283 - return 0;
284 -
285 - /*
286 - * This is weird, but stems from legacy behaviour: the GC auto
287 - * threshold was always essentially interpreted as if it was rounded up
288 - * to the next multiple 256 of, so we retain this behaviour for now.
289 - */
290 - return loose_count > (DIV_ROUND_UP(((unsigned long) limit), 256) * 256);
291 - }
292 -
293 - static struct packed_git *find_base_packs(struct odb_source_files *files,
294 - struct string_list *packs,
295 - unsigned long limit)
296 - {
297 - struct packfile_list_entry *e;
298 - struct packed_git *base = NULL;
299 -
300 - for (e = packfile_store_get_packs(files->packed); e; e = e->next) {
301 - if (e->pack->is_cruft)
302 - continue;
303 - if (limit) {
304 - if ((uintmax_t) e->pack->pack_size >= limit)
305 - string_list_append(packs, e->pack->pack_name);
306 - } else if (!base || base->pack_size < e->pack->pack_size) {
307 - base = e->pack;
308 - }
309 - }
310 -
311 - if (base)
312 - string_list_append(packs, base->pack_name);
313 -
314 - return base;
315 - }
316 -
317 - static int too_many_packs(struct odb_source_files *files, int gc_auto_pack_limit)
318 - {
319 - struct packfile_list_entry *e;
320 - int cnt = 0;
321 -
322 - if (gc_auto_pack_limit <= 0)
323 - return 0;
324 -
325 - for (e = packfile_store_get_packs(files->packed); e; e = e->next) {
326 - if (e->pack->pack_keep)
327 - continue;
328 - /*
329 - * Perhaps check the size of the pack and count only
330 - * very small ones here?
331 - */
332 - cnt++;
333 - }
334 - return gc_auto_pack_limit < cnt;
335 - }
336 -
337 - static uint64_t total_ram(void)
338 - {
339 - #if defined(HAVE_SYSINFO)
340 - struct sysinfo si;
341 -
342 - if (!sysinfo(&si)) {
343 - uint64_t total = si.totalram;
344 -
345 - if (si.mem_unit > 1)
346 - total *= (uint64_t)si.mem_unit;
347 - return total;
348 - }
349 - #elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM) || defined(HW_PHYSMEM64))
350 - uint64_t physical_memory;
351 - int mib[2];
352 - size_t length;
353 -
354 - mib[0] = CTL_HW;
355 - # if defined(HW_MEMSIZE)
356 - mib[1] = HW_MEMSIZE;
357 - # elif defined(HW_PHYSMEM64)
358 - mib[1] = HW_PHYSMEM64;
359 - # else
360 - mib[1] = HW_PHYSMEM;
361 - # endif
362 - length = sizeof(physical_memory);
363 - if (!sysctl(mib, 2, &physical_memory, &length, NULL, 0)) {
364 - if (length == 4) {
365 - uint32_t mem;
366 -
367 - if (!sysctl(mib, 2, &mem, &length, NULL, 0))
368 - physical_memory = mem;
369 - }
370 - return physical_memory;
371 - }
372 - #elif defined(GIT_WINDOWS_NATIVE)
373 - MEMORYSTATUSEX memInfo;
374 -
375 - memInfo.dwLength = sizeof(MEMORYSTATUSEX);
376 - if (GlobalMemoryStatusEx(&memInfo))
377 - return memInfo.ullTotalPhys;
378 - #endif
379 - return 0;
380 - }
381 -
382 - static uint64_t estimate_repack_memory(struct odb_source_files *files,
383 - struct packed_git *pack)
384 - {
385 - unsigned long max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE;
386 - unsigned long delta_base_cache_limit = DEFAULT_DELTA_BASE_CACHE_LIMIT;
387 - unsigned long nr_objects;
388 - size_t os_cache, heap;
389 -
390 - if (odb_source_count_objects(&files->base, ODB_COUNT_OBJECTS_APPROXIMATE,
391 - &nr_objects) < 0)
392 - return 0;
393 -
394 - if (!pack || !nr_objects)
395 - return 0;
396 -
397 - repo_config_get_ulong(files->base.odb->repo, "pack.deltacachesize",
398 - &max_delta_cache_size);
399 - repo_config_get_ulong(files->base.odb->repo, "core.deltabasecachelimit",
400 - &delta_base_cache_limit);
401 -
402 - /*
403 - * First we have to scan through at least one pack.
404 - * Assume enough room in OS file cache to keep the entire pack
405 - * or we may accidentally evict data of other processes from
406 - * the cache.
407 - */
408 - os_cache = pack->pack_size + pack->index_size;
409 - /* then pack-objects needs lots more for book keeping */
410 - heap = sizeof(struct object_entry) * nr_objects;
411 - /*
412 - * internal rev-list --all --objects takes up some memory too,
413 - * let's say half of it is for blobs
414 - */
415 - heap += sizeof(struct blob) * nr_objects / 2;
416 - /*
417 - * and the other half is for trees (commits and tags are
418 - * usually insignificant)
419 - */
420 - heap += sizeof(struct tree) * nr_objects / 2;
421 - /* and then obj_hash[], underestimated in fact */
422 - heap += sizeof(struct object *) * nr_objects;
423 - /* revindex is used also */
424 - heap += (sizeof(off_t) + sizeof(uint32_t)) * nr_objects;
425 - /*
426 - * read_sha1_file() (either at delta calculation phase, or
427 - * writing phase) also fills up the delta base cache
428 - */
429 - heap += delta_base_cache_limit;
430 - /* and of course pack-objects has its own delta cache */
431 - heap += max_delta_cache_size;
432 -
433 - return os_cache + heap;
434 - }
435 -
436 - static int keep_one_pack(struct string_list_item *item, void *data)
437 - {
438 - struct strvec *args = data;
439 - strvec_pushf(args, "--keep-pack=%s", basename(item->string));
440 - return 0;
441 - }
442 -
443 - static void add_repack_all_option(struct repository *repo,
444 - const struct odb_optimize_options *opts,
445 - struct string_list *keep_pack,
446 - struct strvec *args)
447 - {
448 - char *repack_filter = NULL;
449 - char *repack_filter_to = NULL;
450 -
451 - repo_config_get_string(repo, "gc.repackfilter", &repack_filter);
452 - repo_config_get_string(repo, "gc.repackfilterto", &repack_filter_to);
453 -
454 - if (opts->prune_expire && !strcmp(opts->prune_expire, "now") &&
455 - !(opts->cruft_packs && opts->expire_to))
456 - strvec_push(args, "-a");
457 - else if (opts->cruft_packs) {
458 - strvec_push(args, "--cruft");
459 - if (opts->prune_expire)
460 - strvec_pushf(args, "--cruft-expiration=%s", opts->prune_expire);
461 - if (opts->max_cruft_size)
462 - strvec_pushf(args, "--max-cruft-size=%lu",
463 - opts->max_cruft_size);
464 - if (opts->expire_to)
465 - strvec_pushf(args, "--expire-to=%s", opts->expire_to);
466 - } else {
467 - strvec_push(args, "-A");
468 - if (opts->prune_expire)
469 - strvec_pushf(args, "--unpack-unreachable=%s", opts->prune_expire);
470 - }
471 -
472 - if (keep_pack)
473 - for_each_string_list(keep_pack, keep_one_pack, args);
474 -
475 - if (repack_filter && *repack_filter)
476 - strvec_pushf(args, "--filter=%s", repack_filter);
477 - if (repack_filter_to && *repack_filter_to)
478 - strvec_pushf(args, "--filter-to=%s", repack_filter_to);
479 -
480 - free(repack_filter);
481 - free(repack_filter_to);
482 - }
483 -
484 - static void add_repack_incremental_option(struct strvec *args)
485 - {
486 - strvec_push(args, "--no-write-bitmap-index");
487 - }
488 -
489 - bool odb_source_files_optimize_required(struct odb_source *source,
490 - const struct odb_optimize_options *opts)
491 - {
492 - struct odb_source_files *files = odb_source_files_downcast(source);
493 - struct repository *repo = source->odb->repo;
494 -
495 - switch (opts->strategy) {
496 - case ODB_OPTIMIZE_INCREMENTAL: {
497 - int gc_auto_threshold = 6700;
498 - int gc_auto_pack_limit = 50;
499 -
500 - repo_config_get_int(repo, "gc.auto", &gc_auto_threshold);
501 - repo_config_get_int(repo, "gc.autopacklimit", &gc_auto_pack_limit);
502 -
503 - /*
504 - * Setting gc.auto to 0 or negative can disable the
505 - * automatic gc.
506 - */
507 - if (gc_auto_threshold <= 0)
508 - return false;
509 - if (!too_many_packs(files, gc_auto_pack_limit) &&
510 - !too_many_loose_objects(files, gc_auto_threshold))
511 - return false;
512 -
513 - return true;
514 - }
515 - case ODB_OPTIMIZE_GEOMETRIC: {
516 - struct pack_geometry geometry = {
517 - .split_factor = 2,
518 - };
519 - struct pack_objects_args po_args = {
520 - .local = 1,
521 - };
522 - struct existing_packs existing_packs = EXISTING_PACKS_INIT;
523 - struct string_list kept_packs = STRING_LIST_INIT_DUP;
524 - int auto_value = 100;
525 - bool ret;
526 -
527 - repo_config_get_int(repo, "maintenance.geometric-repack.auto",
528 - &auto_value);
529 - if (!auto_value)
530 - return false;
531 - if (auto_value < 0)
532 - return true;
533 -
534 - repo_config_get_int(repo, "maintenance.geometric-repack.splitFactor",
535 - &geometry.split_factor);
536 -
537 - existing_packs.repo = repo;
538 - existing_packs_collect(&existing_packs, &kept_packs);
539 - pack_geometry_init(&geometry, &existing_packs, &po_args);
540 - pack_geometry_split(&geometry);
541 -
542 - /*
543 - * When we'd merge at least two packs with one another we always
544 - * perform the repack.
545 - */
546 - if (geometry.split) {
547 - ret = true;
548 - goto out;
549 - }
550 -
551 - /*
552 - * Otherwise, we estimate the number of loose objects to determine
553 - * whether we want to create a new packfile or not.
554 - */
555 - if (too_many_loose_objects(files, auto_value)) {
556 - ret = true;
557 - goto out;
558 - }
559 -
560 - ret = false;
561 -
562 - out:
563 - existing_packs_release(&existing_packs);
564 - pack_geometry_release(&geometry);
565 - return ret;
566 - }
567 - default:
568 - BUG("unknown maintenance strategy '%d'", opts->strategy);
569 - }
570 - }
571 -
572 - int odb_source_files_optimize(struct odb_source *source,
573 - const struct odb_optimize_options *opts)
574 - {
575 - struct odb_source_files *files = odb_source_files_downcast(source);
576 - struct repository *repo = source->odb->repo;
577 - struct child_process repack_cmd = CHILD_PROCESS_INIT;
578 - unsigned long big_pack_threshold = 0;
579 - int gc_auto_threshold = 6700;
580 - int gc_auto_pack_limit = 50;
581 - int ret;
582 -
583 - repo_config_get_int(repo, "gc.auto", &gc_auto_threshold);
584 - repo_config_get_int(repo, "gc.autopacklimit", &gc_auto_pack_limit);
585 - repo_config_get_ulong(repo, "gc.bigpackthreshold", &big_pack_threshold);
586 -
587 - if (repo->repository_format_precious_objects)
588 - return 0;
589 -
590 - repack_cmd.git_cmd = 1;
591 - repack_cmd.odb_to_close = repo->objects;
592 -
593 - strvec_pushl(&repack_cmd.args, "repack", "-d", "-l", NULL);
594 - if (opts->flags & ODB_OPTIMIZE_NO_REUSE_DELTAS)
595 - strvec_push(&repack_cmd.args, "-f");
596 - if (opts->depth > 0)
597 - strvec_pushf(&repack_cmd.args, "--depth=%d", opts->depth);
598 - if (opts->window > 0)
599 - strvec_pushf(&repack_cmd.args, "--window=%d", opts->window);
600 - if (!(opts->flags & ODB_OPTIMIZE_VERBOSE))
601 - strvec_push(&repack_cmd.args, "-q");
602 -
603 - /*
604 - * There's three cases we need to consider:
605 - *
606 - * - If we're invoked without `--auto` we'll need to perform a full
607 - * repack.
608 - *
609 - * - If we're invoked with `--auto` and there's too many packs, then
610 - * we perform a full repack, as well.
611 - *
612 - * - Otherwise we perform an incremental repack.
613 - */
614 - switch (opts->strategy) {
615 - case ODB_OPTIMIZE_INCREMENTAL:
616 - if (!(opts->flags & ODB_OPTIMIZE_AUTO)) {
617 - struct string_list keep_pack = STRING_LIST_INIT_NODUP;
618 -
619 - if (opts->keep_largest_pack != -1) {
620 - if (opts->keep_largest_pack)
621 - find_base_packs(files, &keep_pack, 0);
622 - } else if (big_pack_threshold) {
623 - find_base_packs(files, &keep_pack, big_pack_threshold);
624 - }
625 -
626 - add_repack_all_option(repo, opts, &keep_pack, &repack_cmd.args);
627 - string_list_clear(&keep_pack, 0);
628 - } else {
629 - if (too_many_packs(files, gc_auto_pack_limit)) {
630 - struct string_list keep_pack = STRING_LIST_INIT_NODUP;
631 -
632 - if (big_pack_threshold) {
633 - find_base_packs(files, &keep_pack, big_pack_threshold);
634 - if (keep_pack.nr >= (unsigned long) gc_auto_pack_limit) {
635 - string_list_clear(&keep_pack, 0);
636 - find_base_packs(files, &keep_pack, 0);
637 - }
638 - } else {
639 - struct packed_git *p = find_base_packs(files, &keep_pack, 0);
640 - uint64_t mem_have, mem_want;
641 -
642 - mem_have = total_ram();
643 - mem_want = estimate_repack_memory(files, p);
644 -
645 - /*
646 - * Only allow 1/2 of memory for pack-objects, leave
647 - * the rest for the OS and other processes in the
648 - * system.
649 - */
650 - if (!mem_have || mem_want < mem_have / 2)
651 - string_list_clear(&keep_pack, 0);
652 - }
653 -
654 - add_repack_all_option(repo, opts, &keep_pack, &repack_cmd.args);
655 - string_list_clear(&keep_pack, 0);
656 - } else {
657 - add_repack_incremental_option(&repack_cmd.args);
658 - }
659 - }
660 -
661 - break;
662 - case ODB_OPTIMIZE_GEOMETRIC: {
663 - struct pack_geometry geometry = {
664 - .split_factor = 2,
665 - };
666 - struct pack_objects_args po_args = {
667 - .local = 1,
668 - };
669 - struct existing_packs existing_packs = EXISTING_PACKS_INIT;
670 - struct string_list kept_packs = STRING_LIST_INIT_DUP;
671 -
672 - repo_config_get_int(repo, "maintenance.geometric-repack.splitFactor",
673 - &geometry.split_factor);
674 -
675 - existing_packs.repo = repo;
676 - existing_packs_collect(&existing_packs, &kept_packs);
677 - pack_geometry_init(&geometry, &existing_packs, &po_args);
678 - pack_geometry_split(&geometry);
679 -
680 - if (geometry.split < geometry.pack_nr) {
681 - strvec_pushf(&repack_cmd.args, "--geometric=%d",
682 - geometry.split_factor);
683 - } else {
684 - add_repack_all_option(repo, opts, NULL, &repack_cmd.args);
685 - }
686 - if (repo->settings.core_multi_pack_index)
687 - strvec_push(&repack_cmd.args, "--write-midx");
688 -
689 - existing_packs_release(&existing_packs);
690 - pack_geometry_release(&geometry);
691 - break;
692 - }
693 - default:
694 - die("unknown maintenance strategy '%d'", opts->strategy);
695 - }
696 -
697 - if (run_command(&repack_cmd)) {
698 - ret = error("failed to run %s", repack_cmd.args.v[0]);
699 - goto out;
700 - }
701 -
702 - /* Geometric repacking uses cruft packs, so we don't have to prune separately. */
703 - if (opts->strategy != ODB_OPTIMIZE_GEOMETRIC && opts->prune_expire) {
704 - struct child_process prune_cmd = CHILD_PROCESS_INIT;
705 -
706 - strvec_pushl(&prune_cmd.args, "prune", "--expire", NULL);
707 - /* run `git prune` even if using cruft packs */
708 - strvec_push(&prune_cmd.args, opts->prune_expire);
709 - if (!(opts->flags & ODB_OPTIMIZE_VERBOSE))
710 - strvec_push(&prune_cmd.args, "--no-progress");
711 - if (repo_has_promisor_remote(repo))
712 - strvec_push(&prune_cmd.args,
713 - "--exclude-promisor-objects");
714 - prune_cmd.git_cmd = 1;
715 -
716 - if (run_command(&prune_cmd)) {
717 - ret = error("failed to run %s", prune_cmd.args.v[0]);
718 - goto out;
719 - }
720 - }
721 -
722 - if (opts->flags & ODB_OPTIMIZE_AUTO && too_many_loose_objects(files, gc_auto_threshold))
723 - warning(_("There are too many unreachable loose objects; "
724 - "run 'git prune' to remove them."));
725 -
726 - ret = 0;
727 -
728 - out:
729 - return ret;
730 - }
731 -
732 264 struct odb_source_files *odb_source_files_new(struct object_database *odb,
733 265 const char *path,
734 266 bool local)
@@ -754,8 +286,6 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb,
754 286 files->base.begin_transaction = odb_source_files_begin_transaction;
755 287 files->base.read_alternates = odb_source_files_read_alternates;
756 288 files->base.write_alternate = odb_source_files_write_alternate;
757 - files->base.optimize = odb_source_files_optimize;
758 - files->base.optimize_required = odb_source_files_optimize_required;
759 289
760 290 /*
761 291 * Ideally, we would only ever store absolute paths in the source. This
modified odb/source-files.h
@@ -21,21 +21,6 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb,
21 21 const char *path,
22 22 bool local);
23 23
24 - /*
25 - * Optimize the files object database source by repacking loose objects and
26 - * packfiles as needed. Returns 0 on success, a negative error code otherwise.
27 - */
28 - int odb_source_files_optimize(struct odb_source *source,
29 - const struct odb_optimize_options *opts);
30 -
31 - /*
32 - * Check whether optimization of the files object database source is required
33 - * given the provided options. Returns true if optimization should be
34 - * performed, false otherwise.
35 - */
36 - bool odb_source_files_optimize_required(struct odb_source *source,
37 - const struct odb_optimize_options *opts);
38 -
39 24 /*
40 25 * Cast the given object database source to the files backend. This will cause
41 26 * a BUG in case the source doesn't use this backend.
modified odb/source.h
@@ -263,21 +263,6 @@ struct odb_source {
263 263 */
264 264 int (*write_alternate)(struct odb_source *source,
265 265 const char *alternate);
266 -
267 - /*
268 - * This callback is expected to optimize the object database source.
269 - * Returns 0 on success, a negative error code otherwise.
270 - */
271 - int (*optimize)(struct odb_source *source,
272 - const struct odb_optimize_options *opts);
273 -
274 - /*
275 - * This callback is expected to check whether optimization of the
276 - * object database source is required given the provided options.
277 - * Returns true if optimization should be performed, false otherwise.
278 - */
279 - bool (*optimize_required)(struct odb_source *source,
280 - const struct odb_optimize_options *opts);
281 266 };
282 267
283 268 /*
@@ -499,25 +484,4 @@ static inline int odb_source_begin_transaction(struct odb_source *source,
499 484 return source->begin_transaction(source, out, flags);
500 485 }
501 486
502 - /*
503 - * Optimize the object database source. Returns 0 on success, a negative error
504 - * code otherwise.
505 - */
506 - static inline int odb_source_optimize(struct odb_source *source,
507 - const struct odb_optimize_options *opts)
508 - {
509 - return source->optimize(source, opts);
510 - }
511 -
512 - /*
513 - * Check whether optimization of the object database source is required given
514 - * the provided options. Returns true if optimization should be performed,
515 - * false otherwise.
516 - */
517 - static inline bool odb_source_optimize_required(struct odb_source *source,
518 - const struct odb_optimize_options *opts)
519 - {
520 - return source->optimize_required(source, opts);
521 - }
522 -
523 487 #endif
modified pack-bitmap.c
@@ -1569,7 +1569,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
1569 1569
1570 1570 if (base) {
1571 1571 int pos = bitmap_position(bitmap_git, &object->oid);
1572 - if (pos >= 0 && bitmap_get(base, pos)) {
1572 + if (pos > 0 && bitmap_get(base, pos)) {
1573 1573 object->flags |= SEEN;
1574 1574 continue;
1575 1575 }
modified revision.c
@@ -4196,39 +4196,37 @@ static timestamp_t comparison_date(const struct rev_info *revs,
4196 4196 commit->date;
4197 4197 }
4198 4198
4199 - /*
4200 - * Whether the commit is ignored by the cheap checks that read only its
4201 - * traversal flags and pack membership (e.g. already shown, or marked
4202 - * uninteresting), before any check that examines the commit's date,
4203 - * parents, message, or diff.
4204 - */
4205 - static int commit_early_ignore(struct rev_info *revs, struct commit *commit)
4199 + enum commit_action get_commit_action(struct rev_info *revs, struct commit *commit)
4206 4200 {
4207 4201 if (commit->object.flags & SHOWN)
4208 - return 1;
4202 + return commit_ignore;
4209 4203 if (revs->maximal_only && (commit->object.flags & CHILD_VISITED))
4210 - return 1;
4204 + return commit_ignore;
4211 4205 if (revs->unpacked && has_object_pack(revs->repo, &commit->object.oid))
4212 - return 1;
4213 - if (revs->no_kept_objects &&
4214 - has_object_kept_pack(revs->repo, &commit->object.oid,
4215 - revs->keep_pack_cache_flags))
4216 - return 1;
4206 + return commit_ignore;
4207 + if (revs->no_kept_objects) {
4208 + if (has_object_kept_pack(revs->repo, &commit->object.oid,
4209 + revs->keep_pack_cache_flags))
4210 + return commit_ignore;
4211 + }
4217 4212 if (commit->object.flags & UNINTERESTING)
4218 - return 1;
4219 - return 0;
4220 - }
4221 -
4222 - /*
4223 - * Decide whether this commit is shown or ignored. Keep it a pure
4224 - * predicate: callers such as the commit graph depend on it having no
4225 - * side effects, so per-commit mutations (such as -L range tracking)
4226 - * belong in the caller, simplify_commit(), not here.
4227 - */
4228 - enum commit_action get_commit_action(struct rev_info *revs, struct commit *commit)
4229 - {
4230 - if (commit_early_ignore(revs, commit))
4231 4213 return commit_ignore;
4214 + if (revs->line_level_traverse && !want_ancestry(revs)) {
4215 + /*
4216 + * In case of line-level log with parent rewriting
4217 + * prepare_revision_walk() already took care of all line-level
4218 + * log filtering, and there is nothing left to do here.
4219 + *
4220 + * If parent rewriting was not requested, then this is the
4221 + * place to perform the line-level log filtering. Notably,
4222 + * this check, though expensive, must come before the other,
4223 + * cheaper filtering conditions, because the tracked line
4224 + * ranges must be adjusted even when the commit will end up
4225 + * being ignored based on other conditions.
4226 + */
4227 + if (!line_log_process_ranges_arbitrary_commit(revs, commit))
4228 + return commit_ignore;
4229 + }
4232 4230 if (revs->min_age != -1 &&
4233 4231 comparison_date(revs, commit) > revs->min_age)
4234 4232 return commit_ignore;
@@ -4337,23 +4335,7 @@ struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit
4337 4335
4338 4336 enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
4339 4337 {
4340 - enum commit_action action;
4341 -
4342 - /*
4343 - * For a line-level log without parent rewriting, fold each commit's
4344 - * ranges as the walk reaches it (parent rewriting does this eagerly in
4345 - * prepare_revision_walk()). Fold before get_commit_action() so the
4346 - * ranges carry across a commit that a later, cheaper check ignores;
4347 - * the commit_early_ignore() guard skips a commit get_commit_action()
4348 - * would ignore outright.
4349 - */
4350 - if (revs->line_level_traverse && !want_ancestry(revs) &&
4351 - !commit_early_ignore(revs, commit)) {
4352 - if (!line_log_process_ranges_arbitrary_commit(revs, commit))
4353 - return commit_ignore;
4354 - }
4355 -
4356 - action = get_commit_action(revs, commit);
4338 + enum commit_action action = get_commit_action(revs, commit);
4357 4339
4358 4340 if (action == commit_show &&
4359 4341 revs->prune && revs->dense && want_ancestry(revs)) {
modified sequencer.c
@@ -1926,13 +1926,6 @@ static int seen_squash(struct replay_ctx *ctx)
1926 1926 strstr(ctx->current_fixups.buf, "\nsquash");
1927 1927 }
1928 1928
1929 - /* Does the current fixup chain contain a "fixup -c" command? */
1930 - static int seen_fixup_edit_msg(struct replay_ctx *ctx)
1931 - {
1932 - return starts_with(ctx->current_fixups.buf, "fixup -c") ||
1933 - strstr(ctx->current_fixups.buf, "\nfixup -c");
1934 - }
1935 -
1936 1929 static void update_comment_bufs(struct strbuf *buf1, struct strbuf *buf2, int n)
1937 1930 {
1938 1931 strbuf_setlen(buf1, strlen(comment_line_str) + 1);
@@ -2155,14 +2148,9 @@ static int update_squash_messages(struct repository *r,
2155 2148 strbuf_release(&buf);
2156 2149
2157 2150 if (!res) {
2158 - const char *fixup_flag = "";
2159 -
2160 - if (is_fixup_flag(command, flag) && (flag & TODO_EDIT_FIXUP_MSG))
2161 - fixup_flag = " -c";
2162 -
2163 - strbuf_addf(&ctx->current_fixups, "%s%s%s %s",
2151 + strbuf_addf(&ctx->current_fixups, "%s%s %s",
2164 2152 ctx->current_fixups.len ? "\n" : "",
2165 - command_to_string(command), fixup_flag,
2153 + command_to_string(command),
2166 2154 oid_to_hex(&commit->object.oid));
2167 2155 res = write_message(ctx->current_fixups.buf,
2168 2156 ctx->current_fixups.len,
@@ -3323,13 +3311,7 @@ static int read_populate_opts(struct replay_opts *opts)
3323 3311 const char *p = ctx->current_fixups.buf;
3324 3312 ctx->current_fixup_count = 1;
3325 3313 while ((p = strchr(p, '\n'))) {
3326 - /*
3327 - * Older versions of git accidentally
3328 - * inserted blank lines when a fixup
3329 - * was skipped.
3330 - */
3331 - if (p[1] && p[1] != '\n')
3332 - ctx->current_fixup_count++;
3314 + ctx->current_fixup_count++;
3333 3315 p++;
3334 3316 }
3335 3317 }
@@ -5424,9 +5406,6 @@ static int commit_staged_changes(struct repository *r,
5424 5406 BUG("Incorrect current_fixups:\n%s", p);
5425 5407 while (len && p[len - 1] != '\n')
5426 5408 len--;
5427 - /* Remove trailing newline */
5428 - if (len)
5429 - len--;
5430 5409 strbuf_setlen(&ctx->current_fixups, len);
5431 5410 if (write_message(p, len, rebase_path_current_fixups(),
5432 5411 0) < 0) {
@@ -5455,8 +5434,8 @@ static int commit_staged_changes(struct repository *r,
5455 5434 * message, no need to bother the user with
5456 5435 * opening the commit message in the editor.
5457 5436 */
5458 - if (!seen_squash(ctx) &&
5459 - !seen_fixup_edit_msg(ctx))
5437 + if (!starts_with(p, "squash ") &&
5438 + !strstr(p, "\nsquash "))
5460 5439 flags = (flags & ~EDIT_MSG) | CLEANUP_MSG;
5461 5440 } else if (is_fixup(peek_command(todo_list, 0))) {
5462 5441 /*
modified sparse-index.c
@@ -113,17 +113,10 @@ static int convert_to_sparse_rec(struct index_state *istate,
113 113 continue;
114 114 }
115 115
116 - span = ct->down[pos]->cache_tree->entry_count;
117 - if (span < 0) {
118 - /* cache-tree entry is invalidated, cannot collapse. */
119 - istate->cache[num_converted++] = ce;
120 - i++;
121 - continue;
122 - }
123 -
124 116 strbuf_setlen(&child_path, 0);
125 117 strbuf_add(&child_path, ce->name, slash - ce->name + 1);
126 118
119 + span = ct->down[pos]->cache_tree->entry_count;
127 120 count = convert_to_sparse_rec(istate,
128 121 num_converted, i, i + span,
129 122 child_path.buf, child_path.len,
modified t/README
@@ -945,17 +945,6 @@ see test-lib-functions.sh for the full list and their options.
945 945 Merges the given rev using the given message. Like test_commit,
946 946 creates a tag and calls test_tick before committing.
947 947
948 - - commit_body <rev>
949 -
950 - Print the message body of <rev>, i.e. the contents of its commit
951 - object with the header removed. Use this instead of piping
952 - "git cat-file commit" into "sed", which would hide a failure of
953 - the git command.
954 -
955 - Example:
956 -
957 - commit_body HEAD >actual
958 -
959 948 - test_set_prereq <prereq>
960 949
961 950 Set a test prerequisite to be used later with test_have_prereq. The
modified t/helper/test-revision-walking.c
@@ -13,12 +13,9 @@
13 13 #include "test-tool.h"
14 14 #include "commit.h"
15 15 #include "diff.h"
16 - #include "line-log.h"
17 - #include "object-name.h"
18 16 #include "repository.h"
19 17 #include "revision.h"
20 18 #include "setup.h"
21 - #include "string-list.h"
22 19
23 20 static void print_commit(struct commit *commit)
24 21 {
@@ -54,60 +51,6 @@ static int run_revision_walk(void)
54 51 return got_revision;
55 52 }
56 53
57 - /*
58 - * Check that get_commit_action() is a pure predicate by evaluating it on a
59 - * commit the walk has not reached yet. No git command makes that out-of-order
60 - * call, so this probe does it deliberately, and reports whether the call
61 - * mutated the peeked commit: a pure get_commit_action() leaves it untouched.
62 - * We compare the commit's flags rather than the emitted commit list because
63 - * range merges are idempotent, so a side effect would not change which commits
64 - * are shown. Only meaningful for a plain "-L" walk with no parent rewriting.
65 - */
66 - static int line_log_peek(const char **argv)
67 - {
68 - struct repository *repo = the_repository;
69 - struct rev_info rev;
70 - struct string_list range_args = STRING_LIST_INIT_DUP;
71 - struct object_id oid;
72 - struct commit *peek;
73 - const char *rev_argv[3];
74 - unsigned before, after;
75 -
76 - if (repo_get_oid(repo, argv[0], &oid))
77 - die("bad peek commit: %s", argv[0]);
78 - peek = lookup_commit_reference(repo, &oid);
79 - if (!peek || repo_parse_commit(repo, peek))
80 - die("cannot parse peek commit: %s", argv[0]);
81 -
82 - repo_init_revisions(repo, &rev, NULL);
83 - rev.diffopt.flags.recursive = 1;
84 - rev.line_level_traverse = 1;
85 - string_list_append(&range_args, argv[1]);
86 -
87 - rev_argv[0] = "line-log-peek";
88 - rev_argv[1] = argv[2];
89 - rev_argv[2] = NULL;
90 - setup_revisions(2, rev_argv, &rev, NULL);
91 -
92 - line_log_init(&rev, NULL, &range_args);
93 -
94 - if (rev.rewrite_parents || rev.children.name)
95 - die("line-log-peek requires a non-ancestry (-L, no --graph) walk");
96 -
97 - if (prepare_revision_walk(&rev))
98 - die("prepare_revision_walk failed");
99 -
100 - before = peek->object.flags;
101 - get_commit_action(&rev, peek);
102 - after = peek->object.flags;
103 -
104 - printf("mutated %d\n", before != after);
105 -
106 - release_revisions(&rev);
107 - string_list_clear(&range_args, 0);
108 - return 0;
109 - }
110 -
111 54 int cmd__revision_walking(int argc, const char **argv)
112 55 {
113 56 if (argc < 2)
@@ -126,12 +69,6 @@ int cmd__revision_walking(int argc, const char **argv)
126 69 return 0;
127 70 }
128 71
129 - if (!strcmp(argv[1], "line-log-peek")) {
130 - if (argc != 5)
131 - die("usage: test-tool revision-walking line-log-peek <peek-commit> <start,end:file> <rev>");
132 - return line_log_peek(argv + 2);
133 - }
134 -
135 72 fprintf(stderr, "check usage\n");
136 73 return 1;
137 74 }
modified t/t0014-alias.sh
@@ -27,25 +27,17 @@ test_expect_success 'looping aliases - internal execution' '
27 27 test_grep "^fatal: alias loop detected: expansion of" output
28 28 '
29 29
30 - test_expect_success 'detect deprecated commands' '
31 - git --list-cmds=deprecated >deprecated &&
32 - if read deprecated1 && read deprecated2
33 - then
34 - test_set_prereq HAVE_DEPRECATED
35 - fi <deprecated
36 - '
37 -
38 - test_expect_success HAVE_DEPRECATED 'looping aliases - deprecated builtins' '
39 - test_config alias.$deprecated1 $deprecated2 &&
40 - test_config alias.$deprecated2 $deprecated1 &&
30 + test_expect_success 'looping aliases - deprecated builtins' '
31 + test_config alias.whatchanged pack-redundant &&
32 + test_config alias.pack-redundant whatchanged &&
41 33 cat >expect <<-EOF &&
42 - ${SQ}$deprecated1${SQ} is aliased to ${SQ}$deprecated2${SQ}
43 - ${SQ}$deprecated2${SQ} is aliased to ${SQ}$deprecated1${SQ}
44 - fatal: alias loop detected: expansion of ${SQ}$deprecated1${SQ} does not terminate:
45 - $deprecated1 <==
46 - $deprecated2 ==>
34 + ${SQ}whatchanged${SQ} is aliased to ${SQ}pack-redundant${SQ}
35 + ${SQ}pack-redundant${SQ} is aliased to ${SQ}whatchanged${SQ}
36 + fatal: alias loop detected: expansion of ${SQ}whatchanged${SQ} does not terminate:
37 + whatchanged <==
38 + pack-redundant ==>
47 39 EOF
48 - test_must_fail git $deprecated1 -h 2>actual &&
40 + test_must_fail git whatchanged -h 2>actual &&
49 41 test_cmp expect actual
50 42 '
51 43
@@ -94,12 +86,12 @@ test_expect_success 'can alias-shadow deprecated builtins' '
94 86 done
95 87 '
96 88
97 - test_expect_success HAVE_DEPRECATED 'can alias-shadow via two deprecated builtins' '
89 + test_expect_success 'can alias-shadow via two deprecated builtins' '
98 90 # some git(1) commands will fail... (see above)
99 91 test_might_fail git status -h >expect &&
100 92 test_file_not_empty expect &&
101 - test_might_fail git -c alias.$deprecated1=$deprecated2 \
102 - -c alias.$deprecated2=status $deprecated1 -h >actual &&
93 + test_might_fail git -c alias.whatchanged=pack-redundant \
94 + -c alias.pack-redundant=status whatchanged -h >actual &&
103 95 test_cmp expect actual
104 96 '
105 97
modified t/t1006-cat-file.sh
@@ -1340,14 +1340,6 @@ test_expect_success 'batch-command flush without --buffer' '
1340 1340 test_grep "^fatal:.*flush is only for --buffer mode.*" err
1341 1341 '
1342 1342
1343 - test_expect_success 'batch-command contents auto-handles type' '
1344 - echo "HEAD" |
1345 - git cat-file --batch="%(objectname)" >expect &&
1346 - echo "contents HEAD" |
1347 - git cat-file --batch-command="%(objectname)" >actual &&
1348 - test_cmp expect actual
1349 - '
1350 -
1351 1343 perl_script='
1352 1344 use warnings;
1353 1345 use strict;
modified t/t1092-sparse-checkout-compatibility.sh
@@ -384,54 +384,6 @@ test_expect_success 'add, commit, checkout' '
384 384 test_all_match git checkout -
385 385 '
386 386
387 - test_expect_success 'intent-to-add entries outside sparse-checkout' '
388 - init_repos &&
389 -
390 - write_script edit-contents <<-\EOF &&
391 - echo text >>$1
392 - EOF
393 -
394 - test_sparse_match git sparse-checkout set deep folder1 &&
395 - run_on_sparse mkdir -p folder1 &&
396 - run_on_all ../edit-contents folder1/newita &&
397 - test_sparse_match git add -N folder1/newita &&
398 -
399 - test_sparse_match git sparse-checkout set deep &&
400 - test_sparse_match git status --porcelain=v2 &&
401 - test_sparse_match git ls-files --stage
402 - '
403 -
404 - test_expect_success 'intent-to-add with --sparse outside sparse-checkout' '
405 - init_repos &&
406 -
407 - write_script edit-contents <<-\EOF &&
408 - echo text >>$1
409 - EOF
410 -
411 - run_on_all mkdir -p folder1 &&
412 - run_on_all ../edit-contents folder1/newita &&
413 - test_all_match git add --sparse --intent-to-add folder1/newita &&
414 -
415 - test_all_match git status --porcelain=v2 &&
416 - test_all_match git ls-files --stage &&
417 - test_all_match git diff --cached --stat &&
418 -
419 - # Ensure sparse index stores correct sparse directories and
420 - # intent-to-add path.
421 - git -C sparse-index ls-files --format="%(path)" --sparse >out &&
422 -
423 - # These paths should be present in index as-is.
424 - test_grep "^before/\$" out &&
425 - test_grep "^folder1/newita\$" out &&
426 - test_grep "^folder2/\$" out &&
427 - test_grep "^x/\$" out &&
428 -
429 - # folder/0/ could theoretically be collapsed to a sparse
430 - # directory entry, but the current implementation avoids the
431 - # reduction because of folder1/newita
432 - test_grep "^folder1/0/0/0\$" out
433 - '
434 -
435 387 test_expect_success 'git add, checkout, and reset with -p' '
436 388 init_repos &&
437 389
modified t/t1401-symbolic-ref.sh
@@ -38,18 +38,6 @@ test_expect_success 'symbolic-ref refuses bare sha1' '
38 38
39 39 reset_to_sane
40 40
41 - test_expect_success 'symbolic-ref reports a non-symbolic ref' '
42 - test_must_fail git symbolic-ref refs/heads/foo >out 2>err &&
43 - test_must_be_empty out &&
44 - test_grep "is not a symbolic ref" err
45 - '
46 -
47 - test_expect_success 'symbolic-ref -q is silent on a non-symbolic ref' '
48 - test_must_fail git symbolic-ref -q refs/heads/foo >out 2>err &&
49 - test_must_be_empty out &&
50 - test_must_be_empty err
51 - '
52 -
53 41 test_expect_success 'HEAD cannot be removed' '
54 42 test_must_fail git symbolic-ref -d HEAD
55 43 '
modified t/t1402-check-ref-format.sh
@@ -49,19 +49,16 @@ invalid_ref 'foo/./bar'
49 49 invalid_ref 'foo/bar/.'
50 50 invalid_ref '.refs/foo'
51 51 invalid_ref 'refs/heads/foo.'
52 - for c in '?' '~' '^' ':' '*' '[' ' ' '\' '..'
53 - do
54 - invalid_ref "heads/foo${c}bar"
55 - done
52 + invalid_ref 'heads/foo..bar'
53 + invalid_ref 'heads/foo?bar'
56 54 valid_ref 'foo./bar'
57 55 invalid_ref 'heads/foo.lock'
58 56 invalid_ref 'heads///foo.lock'
59 57 invalid_ref 'foo.lock/bar'
60 58 invalid_ref 'foo.lock///bar'
61 59 valid_ref 'heads/foo@bar'
62 - valid_ref 'refs/@'
63 - invalid_ref '@' --allow-onelevel
64 60 invalid_ref 'heads/v@{ation'
61 + invalid_ref 'heads/foo\bar'
65 62 invalid_ref "$(printf 'heads/foo\t')"
66 63 invalid_ref "$(printf 'heads/foo\177')"
67 64 valid_ref "$(printf 'heads/fu\303\237')"
modified t/t3200-branch.sh
@@ -930,7 +930,7 @@ test_expect_success 'deleting currently checked out branch fails' '
930 930 git worktree add -b my7 my7 &&
931 931 test_must_fail git -C my7 branch -d my7 &&
932 932 test_must_fail git branch -d my7 2>actual &&
933 - test_grep "^error: cannot delete branch '"'"'my7'"'"' used by worktree at '"'.*'\$"'" actual &&
933 + test_grep "^error: cannot delete branch .my7. used by worktree at " actual &&
934 934 rm -r my7 &&
935 935 git worktree prune
936 936 '
@@ -941,7 +941,7 @@ test_expect_success 'deleting in-use branch fails' '
941 941 git -C my7 bisect start HEAD HEAD~2 &&
942 942 test_must_fail git -C my7 branch -d my7 &&
943 943 test_must_fail git branch -d my7 2>actual &&
944 - test_grep "^error: cannot delete branch '"'"'my7'"'"' used by worktree at '"'.*' for bisect\$"'" actual &&
944 + test_grep "^error: cannot delete branch .my7. used by worktree at " actual &&
945 945 rm -r my7 &&
946 946 git worktree prune
947 947 '
modified t/t3404-rebase-interactive.sh
@@ -484,7 +484,7 @@ test_expect_success 'squash and fixup generate correct log messages' '
484 484 EXPECT_HEADER_COUNT=4 \
485 485 git rebase -i $base
486 486 ) &&
487 - commit_body HEAD >actual-squash-fixup &&
487 + git cat-file commit HEAD | sed -e 1,/^\$/d > actual-squash-fixup &&
488 488 test_cmp expect-squash-fixup actual-squash-fixup &&
489 489 git cat-file commit HEAD@{2} >actual &&
490 490 test_grep "^# This is a combination of 3 commits\." actual &&
modified t/t3405-rebase-malformed.sh
@@ -37,7 +37,7 @@ test_expect_success setup '
37 37 test_tick &&
38 38 git commit -F F &&
39 39
40 - commit_body HEAD >F0 &&
40 + git cat-file commit HEAD | sed -e "1,/^\$/d" >F0 &&
41 41
42 42 git checkout diff-in-message &&
43 43 echo "commit log message containing a diff" >G &&
@@ -48,7 +48,7 @@ test_expect_success setup '
48 48 test_tick &&
49 49 git commit -F G &&
50 50
51 - commit_body HEAD >G0 &&
51 + git cat-file commit HEAD | sed -e "1,/^\$/d" >G0 &&
52 52
53 53 git checkout empty-message-merge &&
54 54 echo file3 >file3 &&
@@ -66,7 +66,7 @@ test_expect_success setup '
66 66 test_expect_success 'rebase commit with multi-line subject' '
67 67
68 68 git rebase main multi-line-subject &&
69 - commit_body HEAD >F1 &&
69 + git cat-file commit HEAD | sed -e "1,/^\$/d" >F1 &&
70 70
71 71 test_cmp F0 F1 &&
72 72 test_cmp F F0
@@ -74,7 +74,7 @@ test_expect_success 'rebase commit with multi-line subject' '
74 74
75 75 test_expect_success 'rebase commit with diff in message' '
76 76 git rebase main diff-in-message &&
77 - commit_body HEAD >G1 &&
77 + git cat-file commit HEAD | sed -e "1,/^$/d" >G1 &&
78 78 test_cmp G0 G1 &&
79 79 test_cmp G G0
80 80 '
modified t/t3408-rebase-multi-line.sh
@@ -50,8 +50,8 @@ test_expect_success rebase '
50 50
51 51 git checkout side &&
52 52 git rebase main &&
53 - commit_body HEAD >actual &&
54 - commit_body side@{1} >expect &&
53 + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
54 + git cat-file commit side@{1} | sed -e "1,/^\$/d" >expect &&
55 55 test_cmp expect actual
56 56
57 57 '
modified t/t3418-rebase-continue.sh
@@ -134,7 +134,6 @@ test_expect_success '--skip after failed fixup cleans commit message' '
134 134 EOF
135 135
136 136 : skip and continue &&
137 - test_config commit.status false &&
138 137 echo "cp \"\$1\" .git/copy.txt" | write_script copy-editor.sh &&
139 138 (test_set_editor "$PWD/copy-editor.sh" && git rebase --skip) &&
140 139
@@ -146,8 +145,7 @@ test_expect_success '--skip after failed fixup cleans commit message' '
146 145
147 146 : now, let us ensure that "squash" is handled correctly &&
148 147 git reset --hard wants-fixup-3 &&
149 - test_must_fail env \
150 - FAKE_LINES="1 squash 2 squash 1 squash 3 squash 1 squash 4 squash 1" \
148 + test_must_fail env FAKE_LINES="1 squash 2 squash 1 squash 3 squash 1" \
151 149 git rebase -i HEAD~4 &&
152 150
153 151 : the second squash failed, but there are two more in the chain &&
@@ -173,32 +171,6 @@ test_expect_success '--skip after failed fixup cleans commit message' '
173 171 fixup 2
174 172 EOF
175 173
176 - (test_set_editor "$PWD/copy-editor.sh" &&
177 - test_must_fail git rebase --skip) &&
178 - : not the final squash, no need to edit the commit message &&
179 - test_path_is_missing .git/copy.txt &&
180 -
181 - : The first, third and fifth squashes succeeded, therefore: &&
182 - cat >expect <<-\EOF &&
183 - # This is a combination of 4 commits.
184 - # This is the 1st commit message:
185 -
186 - wants-fixup
187 -
188 - # This is the commit message #2:
189 -
190 - fixup 1
191 -
192 - # This is the commit message #3:
193 -
194 - fixup 2
195 -
196 - # This is the commit message #4:
197 -
198 - fixup 3
199 - EOF
200 - test_commit_message HEAD expect &&
201 -
202 174 (test_set_editor "$PWD/copy-editor.sh" && git rebase --skip) &&
203 175 test_commit_message HEAD <<-\EOF &&
204 176 wants-fixup
@@ -206,12 +178,12 @@ test_expect_success '--skip after failed fixup cleans commit message' '
206 178 fixup 1
207 179
208 180 fixup 2
209 -
210 - fixup 3
211 181 EOF
212 182
213 183 : Final squash failed, but there was still a squash &&
214 - test_cmp expect .git/copy.txt
184 + head -n1 .git/copy.txt >first-line &&
185 + test_grep "# This is a combination of 3 commits" first-line &&
186 + test_grep "# This is the commit message #3:" .git/copy.txt
215 187 '
216 188
217 189 test_expect_success 'setup rerere database' '
modified t/t3434-rebase-i18n.sh
@@ -27,7 +27,8 @@ fi
27 27
28 28 compare_msg () {
29 29 iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect &&
30 - commit_body HEAD >actual &&
30 + git cat-file commit HEAD >raw &&
31 + sed "1,/^$/d" raw >actual &&
31 32 test_cmp expect actual
32 33 }
33 34
modified t/t3437-rebase-fixup-options.sh
@@ -186,53 +186,6 @@ test_expect_success 'multiple fixup -c opens editor once' '
186 186 test_commit_message HEAD expected-message
187 187 '
188 188
189 - test_expect_success 'fixup -c is remembered after skipping final fixup' '
190 - test_when_finished "test_might_fail git rebase --abort" &&
191 - cat >todo <<-\EOF &&
192 - pick B
193 - fixup -c A1
194 - fixup A3
195 - EOF
196 - (
197 - set_fake_editor &&
198 - set_replace_editor todo &&
199 - test_must_fail git rebase -i A A &&
200 - git show && cat .git/rebase-merge/message-squash &&
201 - FAKE_COMMIT_AMEND=edited git rebase --skip
202 - ) &&
203 - test_commit_message HEAD <<-\EOF
204 - new subject
205 -
206 - new
207 - body
208 -
209 - edited
210 - EOF
211 - '
212 - test_expect_success 'fixup -c is remembered after skipping later fixup' '
213 - test_when_finished "test_might_fail git rebase --abort" &&
214 - cat >todo <<-\EOF &&
215 - pick B
216 - fixup -c A1
217 - fixup A3
218 - fixup A2
219 - EOF
220 - (
221 - set_fake_editor &&
222 - set_replace_editor todo &&
223 - test_must_fail git rebase -i A A &&
224 - FAKE_COMMIT_AMEND=edited git rebase --skip
225 - ) &&
226 - test_commit_message HEAD <<-\EOF
227 - new subject
228 -
229 - new
230 - body
231 -
232 - edited
233 - EOF
234 - '
235 -
236 189 test_expect_success 'sequence squash, fixup & fixup -c gives combined message' '
237 190 test_when_finished "test_might_fail git rebase --abort" &&
238 191 git checkout --detach A3 &&
modified t/t3705-add-sparse-checkout.sh
@@ -233,30 +233,4 @@ test_expect_success 'refuse to add non-skip-worktree file from sparse dir' '
233 233 test_cmp expect stderr
234 234 '
235 235
236 - test_expect_success 'intent-to-add entry and sparse index' '
237 - test_when_finished "git sparse-checkout disable" &&
238 - test_when_finished "git reset --hard" &&
239 -
240 - git sparse-checkout disable &&
241 - mkdir -p in out &&
242 - echo base >in/file &&
243 - echo base >out/file &&
244 - git add in/file out/file &&
245 - git commit -m "in and out directories" &&
246 -
247 - # enable sparse-checkout, but with all child directories.
248 - git config index.sparse true &&
249 - git sparse-checkout set in out &&
250 -
251 - # create a new path and set intent-to-add bit
252 - echo new >out/newita &&
253 - git add -N out/newita &&
254 -
255 - # collapse sparse-checkout, and make sure that the sparse index
256 - # maintains the intent-to-add bit.
257 - git sparse-checkout set in &&
258 - git ls-files --error-unmatch out/newita &&
259 - git status --porcelain
260 - '
261 -
262 236 test_done
modified t/t3900-i18n-commit.sh
@@ -232,8 +232,8 @@ test_commit_autosquash_multi_encoding () {
232 232 git rev-list HEAD >actual &&
233 233 test_line_count = 3 actual &&
234 234 iconv -f $old -t UTF-8 "$TEST_DIRECTORY"/t3900/$msg >expect &&
235 - commit_body HEAD^ >raw &&
236 - iconv -f $new -t utf-8 <raw >actual &&
235 + git cat-file commit HEAD^ >raw &&
236 + (sed "1,/^$/d" raw | iconv -f $new -t utf-8) >actual &&
237 237 test_cmp expect actual
238 238 '
239 239 }
modified t/t4045-diff-relative.sh
@@ -245,13 +245,4 @@ test_expect_failure 'diff --relative with change in subdir' '
245 245 test_cmp expected out
246 246 '
247 247
248 - test_expect_success 'diff --relative --cached with change in subdir' '
249 - git switch br3 &&
250 - test_when_finished "git merge --abort" &&
251 - test_must_fail git merge sub1 &&
252 - echo file0 >expected &&
253 - git -C subdir diff --relative --name-only --cached >out &&
254 - test_cmp expected out
255 - '
256 -
257 248 test_done
modified t/t4150-am.sh
@@ -1018,7 +1018,7 @@ test_expect_success 'am -s unexpected trailer block' '
1018 1018 Signed-off-by: J C H <j@c.h>
1019 1019 EOF
1020 1020 git commit -F msg &&
1021 - commit_body HEAD >original &&
1021 + git cat-file commit HEAD | sed -e "1,/^$/d" >original &&
1022 1022 git format-patch --stdout -1 >patch &&
1023 1023
1024 1024 git reset --hard HEAD^ &&
@@ -1027,7 +1027,7 @@ test_expect_success 'am -s unexpected trailer block' '
1027 1027 cat original &&
1028 1028 echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
1029 1029 ) >expect &&
1030 - commit_body HEAD >actual &&
1030 + git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
1031 1031 test_cmp expect actual &&
1032 1032
1033 1033 cat >msg <<-\EOF &&
@@ -1038,7 +1038,7 @@ test_expect_success 'am -s unexpected trailer block' '
1038 1038 EOF
1039 1039 git reset HEAD^ &&
1040 1040 git commit -F msg file &&
1041 - commit_body HEAD >original &&
1041 + git cat-file commit HEAD | sed -e "1,/^$/d" >original &&
1042 1042 git format-patch --stdout -1 >patch &&
1043 1043
1044 1044 git reset --hard HEAD^ &&
@@ -1049,7 +1049,7 @@ test_expect_success 'am -s unexpected trailer block' '
1049 1049 echo &&
1050 1050 echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
1051 1051 ) >expect &&
1052 - commit_body HEAD >actual &&
1052 + git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
1053 1053 test_cmp expect actual
1054 1054 '
1055 1055
modified t/t4211-line-log.sh
@@ -781,24 +781,4 @@ test_expect_success '--summary shows new file on root commit' '
781 781 test_grep "create mode 100644 file.c" actual
782 782 '
783 783
784 - test_expect_success 'get_commit_action() does not mutate a not-yet-walked commit' '
785 - git init peek &&
786 - (
787 - cd peek &&
788 - test_write_lines 1 2 3 4 5 >f.c &&
789 - git add f.c && test_tick && git commit -m base &&
790 - test_write_lines 1 two 3 4 5 >f.c &&
791 - test_tick && git commit -am change &&
792 -
793 - # Peek HEAD^, which the walk has not reached (the out-of-order
794 - # call a lookahead makes), and confirm get_commit_action() leaves
795 - # it untouched. A side effect is invisible in the commit list
796 - # (range merges are idempotent), so the helper reports whether the
797 - # call mutated the peeked commit at all.
798 - echo "mutated 0" >expect &&
799 - test-tool revision-walking line-log-peek HEAD^ 1,3:f.c HEAD >actual &&
800 - test_cmp expect actual
801 - )
802 - '
803 -
804 784 test_done
modified t/t5333-pseudo-merge-bitmaps.sh
@@ -50,15 +50,7 @@ test_expect_success 'bitmap traversal without pseudo-merges' '
50 50 test_pseudo_merges_cascades 0 <trace2.txt &&
51 51 test_pseudo_merges >merges &&
52 52 test_must_be_empty merges &&
53 - test_cmp expect actual &&
54 -
55 - : >trace2.txt &&
56 - GIT_TRACE2_EVENT=$PWD/trace2.txt \
57 - git rev-list --objects --use-bitmap-index HEAD HEAD >/dev/null &&
58 -
59 - # The first HEAD initializes base from its position-zero bitmap. The
60 - # duplicate root should not count as another bitmap hit.
61 - test_trace2_data bitmap bitmap/hits 1 <trace2.txt
53 + test_cmp expect actual
62 54 '
63 55
64 56 test_expect_success 'pseudo-merges accurately represent their objects' '
@@ -93,10 +85,6 @@ test_expect_success 'bitmap traversal with pseudo-merges' '
93 85
94 86 test_pseudo_merges_satisfied 8 <trace2.txt &&
95 87 test_pseudo_merges_cascades 1 <trace2.txt &&
96 -
97 - # Position zero is named by HEAD, its branch, and its tag, but it
98 - # should count as only one bitmap hit.
99 - test_trace2_data bitmap bitmap/hits 1 <trace2.txt &&
100 88 test_cmp expect actual
101 89 '
102 90
modified t/t6010-merge-base.sh
@@ -305,35 +305,4 @@ test_expect_success 'merge-base --octopus --all for complex tree' '
305 305 test_cmp expected actual
306 306 '
307 307
308 - test_expect_success '--is-ancestor with an ancestor and a descendant' '
309 - git merge-base --is-ancestor $E $A &&
310 - test_expect_code 1 git merge-base --is-ancestor $A $E
311 - '
312 -
313 - test_expect_success '--is-ancestor treats a commit as its own ancestor' '
314 - git merge-base --is-ancestor $A $A
315 - '
316 -
317 - test_expect_success '--is-ancestor with diverged commits' '
318 - test_expect_code 1 git merge-base --is-ancestor $G $H &&
319 - test_expect_code 1 git merge-base --is-ancestor $H $G
320 - '
321 -
322 - test_expect_success '--is-ancestor exits 128 on a bad commit' '
323 - test_expect_code 128 git merge-base --is-ancestor $A no-such-commit &&
324 - test_expect_code 128 git merge-base --is-ancestor no-such-commit $A
325 - '
326 -
327 - test_expect_success '--is-ancestor requires exactly two commits' '
328 - test_expect_code 129 git merge-base --is-ancestor &&
329 - test_expect_code 129 git merge-base --is-ancestor $A &&
330 - test_expect_code 128 git merge-base --is-ancestor $E $A $B 2>err &&
331 - test_grep ".--is-ancestor takes exactly two commits" err
332 - '
333 -
334 - test_expect_success '--is-ancestor and --all cannot be used together' '
335 - test_expect_code 128 git merge-base --is-ancestor --all $E $A 2>err &&
336 - test_grep "options .--is-ancestor. and .--all. cannot be used together" err
337 - '
338 -
339 308 test_done
modified t/t7001-mv.sh
@@ -114,108 +114,6 @@ test_expect_success 'clean up' '
114 114 git reset --hard
115 115 '
116 116
117 - test_expect_success 'moving file to directory without trailing slash' '
118 - git reset --hard HEAD &&
119 - rm -rf file.txt target && mkdir target &&
120 - echo content > file.txt &&
121 - git add file.txt &&
122 - git mv file.txt target &&
123 - test_path_is_file target/file.txt
124 - '
125 -
126 - test_expect_success 'moving file to a bare filename in the cwd' '
127 - git reset --hard &&
128 - rm -rf from dest.txt &&
129 - mkdir from &&
130 - echo content >from/file &&
131 - git add from/file &&
132 - git mv from/file dest.txt &&
133 - test_path_is_file dest.txt
134 - '
135 -
136 - test_expect_success 'moving to a non-existent directory' '
137 - git reset --hard &&
138 - rm -rf from && mkdir from &&
139 - echo content >from/file &&
140 - git add from/file &&
141 - test_must_fail git mv from/file no-such-dir/file 2>actual &&
142 - test_grep "destination directory does not exist" actual
143 - '
144 -
145 - test_expect_success 'moving to a destination with a file as a leading path component' '
146 - git reset --hard &&
147 - rm -rf from && mkdir from &&
148 - echo contents >from/file &&
149 - echo blocker >not-dir &&
150 - git add from/file &&
151 - test_must_fail git mv from/file not-dir/file 2>actual &&
152 - test_grep "destination is not a directory" actual
153 - '
154 -
155 - test_expect_success SYMLINKS 'moving to a destination beyond a symlink' '
156 - git reset --hard &&
157 - rm -rf from regular-dir link-to-dir &&
158 - mkdir from regular-dir &&
159 - echo contents >from/file &&
160 - ln -s regular-dir link-to-dir &&
161 - git add from/file &&
162 - test_must_fail git mv from/file link-to-dir/file 2>actual &&
163 - test_grep "destination is beyond a symbolic link" actual
164 - '
165 -
166 - test_expect_success SYMLINKS 'moving to a destination with a symlink as an intermediate component' '
167 - git reset --hard &&
168 - rm -rf from && mkdir -p from/real/inner &&
169 - echo contents >from/file &&
170 - ln -s real from/link &&
171 - git add from/file from/link &&
172 - test_must_fail git mv from/file from/link/inner/dst 2>actual &&
173 - test_grep "destination is beyond a symbolic link" actual
174 - '
175 -
176 - test_expect_success SYMLINKS 'refuses to overwrite a symlink at the destination' '
177 - git reset --hard &&
178 - rm -rf from && mkdir from &&
179 - echo contents >from/file &&
180 - ln -s target from/link &&
181 - git add from/file from/link &&
182 - test_must_fail git mv from/file from/link 2>actual &&
183 - test_grep "destination exists" actual
184 - '
185 -
186 - test_expect_success SYMLINKS 'mv through a symlinked leading path does not touch the index' '
187 - git reset --hard &&
188 - rm -rf from && mkdir from &&
189 - echo contents >from/src &&
190 - ln -s . from/link &&
191 - git add from/src from/link &&
192 - git commit -m "setup symlink case" &&
193 - git ls-files --stage >expect.index &&
194 - test_must_fail git mv from/src from/link/real/dst 2>actual &&
195 - test_grep "destination is beyond a symbolic link" actual &&
196 - git ls-files --stage >actual.index &&
197 - test_cmp expect.index actual.index
198 - '
199 -
200 - test_expect_success SYMLINKS 'mv -f does not follow a symlinked leading path' '
201 - git reset --hard &&
202 - rm -rf from && mkdir from &&
203 - echo contents >from/src &&
204 - ln -s file from/link &&
205 - git add from/src from/link &&
206 - test_must_fail git mv -f from/src from/link/dst 2>actual &&
207 - test_grep "destination is beyond a symbolic link" actual
208 - '
209 -
210 - test_expect_success 'mv --dry-run detects non-existent destination parent directory' '
211 - git reset --hard &&
212 - rm -rf from && mkdir from &&
213 - echo contents >from/file &&
214 - git add from/file &&
215 - test_must_fail git mv -n from/file no-such-dir/file 2>actual &&
216 - test_grep "destination directory does not exist" actual
217 - '
218 -
219 117 test_expect_success 'moving to existing untracked target with trailing slash' '
220 118 mkdir path1 &&
221 119 git mv path0/ path1/ &&
modified t/t7500-commit-template-squash-signoff.sh
@@ -59,7 +59,7 @@ test_expect_success 'nonexistent template file in config should return error' '
59 59 test_expect_success 'nonexistent optional template file in config' '
60 60 test_config commit.template ":(optional)$(pwd)"/notexist &&
61 61 GIT_EDITOR="echo hello >" git commit --allow-empty &&
62 - commit_body HEAD >actual &&
62 + git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
63 63 echo hello >expect &&
64 64 test_cmp expect actual
65 65 '
@@ -204,7 +204,7 @@ EOF
204 204 test_expect_success '--signoff' '
205 205 echo "yet another content *narf*" >> foo &&
206 206 echo "zort" | git commit -s -F - foo &&
207 - commit_body HEAD >output &&
207 + git cat-file commit HEAD | sed "1,/^\$/d" > output &&
208 208 test_cmp expect output
209 209 '
210 210
modified t/t7501-commit-basic-functionality.sh
@@ -491,7 +491,8 @@ test_expect_success 'sign off (1)' '
491 491 echo 1 >positive &&
492 492 git add positive &&
493 493 git commit -s -m "thank you" &&
494 - commit_body HEAD >actual &&
494 + git cat-file commit HEAD >commit &&
495 + sed -e "1,/^\$/d" commit >actual &&
495 496 (
496 497 echo thank you &&
497 498 echo &&
@@ -510,7 +511,8 @@ test_expect_success 'sign off (2)' '
510 511 git commit -s -m "thank you
511 512
512 513 $existing" &&
513 - commit_body HEAD >actual &&
514 + git cat-file commit HEAD >commit &&
515 + sed -e "1,/^\$/d" commit >actual &&
514 516 (
515 517 echo thank you &&
516 518 echo &&
@@ -530,7 +532,8 @@ test_expect_success 'signoff gap' '
530 532 git commit -s -m "welcome
531 533
532 534 $alt" &&
533 - commit_body HEAD >actual &&
535 + git cat-file commit HEAD >commit &&
536 + sed -e "1,/^\$/d" commit >actual &&
534 537 (
535 538 echo welcome &&
536 539 echo &&
@@ -550,7 +553,8 @@ test_expect_success 'signoff gap 2' '
550 553
551 554 We have now
552 555 $alt" &&
553 - commit_body HEAD >actual &&
556 + git cat-file commit HEAD >commit &&
557 + sed -e "1,/^\$/d" commit >actual &&
554 558 (
555 559 echo welcome &&
556 560 echo &&
@@ -571,7 +575,8 @@ test_expect_success 'signoff respects trailer config' '
571 575
572 576 non-trailer line
573 577 Myfooter: x" &&
574 - commit_body HEAD >actual &&
578 + git cat-file commit HEAD >commit &&
579 + sed -e "1,/^\$/d" commit >actual &&
575 580 (
576 581 echo subject &&
577 582 echo &&
@@ -588,7 +593,8 @@ Myfooter: x" &&
588 593
589 594 non-trailer line
590 595 Myfooter: x" &&
591 - commit_body HEAD >actual &&
596 + git cat-file commit HEAD >commit &&
597 + sed -e "1,/^\$/d" commit >actual &&
592 598 (
593 599 echo subject &&
594 600 echo &&
@@ -620,7 +626,8 @@ test_expect_success 'multiple -m' '
620 626 >negative &&
621 627 git add negative &&
622 628 git commit -m "one" -m "two" -m "three" &&
623 - commit_body HEAD >actual &&
629 + git cat-file commit HEAD >commit &&
630 + sed -e "1,/^\$/d" commit >actual &&
624 631 (
625 632 echo one &&
626 633 echo &&
modified t/t7502-commit-porcelain.sh
@@ -175,7 +175,8 @@ test_expect_success 'commit --trailer with "="' '
175 175 Reported-by: C3 E3
176 176 Mentored-by: C4 E4
177 177 EOF
178 - commit_body HEAD >actual &&
178 + git cat-file commit HEAD >commit.msg &&
179 + sed -e "1,/^\$/d" commit.msg >actual &&
179 180 test_cmp expected actual
180 181 '
181 182
@@ -194,7 +195,8 @@ test_expect_success 'commit --trailer with -c and "replace" as ifexists' '
194 195 commit --trailer "Mentored-by: C4 E4" \
195 196 --trailer "Helped-by: C3 E3" \
196 197 --amend &&
197 - commit_body HEAD >actual &&
198 + git cat-file commit HEAD >commit.msg &&
199 + sed -e "1,/^\$/d" commit.msg >actual &&
198 200 test_cmp expected actual
199 201 '
200 202
@@ -215,7 +217,8 @@ test_expect_success 'commit --trailer with -c and "add" as ifexists' '
215 217 commit --trailer "Reported-by: C3 E3" \
216 218 --trailer "Mentored-by: C4 E4" \
217 219 --amend &&
218 - commit_body HEAD >actual &&
220 + git cat-file commit HEAD >commit.msg &&
221 + sed -e "1,/^\$/d" commit.msg >actual &&
219 222 test_cmp expected actual
220 223 '
221 224
@@ -235,7 +238,8 @@ test_expect_success 'commit --trailer with -c and "donothing" as ifexists' '
235 238 commit --trailer "Mentored-by: C5 E5" \
236 239 --trailer "Reviewed-by: C6 E6" \
237 240 --amend &&
238 - commit_body HEAD >actual &&
241 + git cat-file commit HEAD >commit.msg &&
242 + sed -e "1,/^\$/d" commit.msg >actual &&
239 243 test_cmp expected actual
240 244 '
241 245
@@ -255,7 +259,8 @@ test_expect_success 'commit --trailer with -c and "addIfDifferent" as ifexists'
255 259 commit --trailer "Reported-by: C3 E3" \
256 260 --trailer "Mentored-by: C5 E5" \
257 261 --amend &&
258 - commit_body HEAD >actual &&
262 + git cat-file commit HEAD >commit.msg &&
263 + sed -e "1,/^\$/d" commit.msg >actual &&
259 264 test_cmp expected actual
260 265 '
261 266
@@ -275,7 +280,8 @@ test_expect_success 'commit --trailer with -c and "addIfDifferentNeighbor" as if
275 280 commit --trailer "Mentored-by: C4 E4" \
276 281 --trailer "Reported-by: C3 E3" \
277 282 --amend &&
278 - commit_body HEAD >actual &&
283 + git cat-file commit HEAD >commit.msg &&
284 + sed -e "1,/^\$/d" commit.msg >actual &&
279 285 test_cmp expected actual
280 286 '
281 287
@@ -296,7 +302,8 @@ test_expect_success 'commit --trailer with -c and "end" as where' '
296 302 commit --trailer "Reported-by: C3 E3" \
297 303 --trailer "Mentored-by: C4 E4" \
298 304 --amend &&
299 - commit_body HEAD >actual &&
305 + git cat-file commit HEAD >commit.msg &&
306 + sed -e "1,/^\$/d" commit.msg >actual &&
300 307 test_cmp expected actual
301 308 '
302 309
@@ -316,7 +323,8 @@ test_expect_success 'commit --trailer with -c and "start" as where' '
316 323 commit --trailer "Signed-off-by: C O Mitter <committer@example.com>" \
317 324 --trailer "Signed-off-by: C1 E1" \
318 325 --amend &&
319 - commit_body HEAD >actual &&
326 + git cat-file commit HEAD >commit.msg &&
327 + sed -e "1,/^\$/d" commit.msg >actual &&
320 328 test_cmp expected actual
321 329 '
322 330
@@ -336,7 +344,8 @@ test_expect_success 'commit --trailer with -c and "after" as where' '
336 344 commit --trailer "Mentored-by: C4 E4" \
337 345 --trailer "Mentored-by: C5 E5" \
338 346 --amend &&
339 - commit_body HEAD >actual &&
347 + git cat-file commit HEAD >commit.msg &&
348 + sed -e "1,/^\$/d" commit.msg >actual &&
340 349 test_cmp expected actual
341 350 '
342 351
@@ -357,7 +366,8 @@ test_expect_success 'commit --trailer with -c and "before" as where' '
357 366 commit --trailer "Mentored-by: C3 E3" \
358 367 --trailer "Mentored-by: C2 E2" \
359 368 --amend &&
360 - commit_body HEAD >actual &&
369 + git cat-file commit HEAD >commit.msg &&
370 + sed -e "1,/^\$/d" commit.msg >actual &&
361 371 test_cmp expected actual
362 372 '
363 373
@@ -377,7 +387,8 @@ test_expect_success 'commit --trailer with -c and "donothing" as ifmissing' '
377 387 commit --trailer "Helped-by: C5 E5" \
378 388 --trailer "Based-by: C6 E6" \
379 389 --amend &&
380 - commit_body HEAD >actual &&
390 + git cat-file commit HEAD >commit.msg &&
391 + sed -e "1,/^\$/d" commit.msg >actual &&
381 392 test_cmp expected actual
382 393 '
383 394
@@ -398,7 +409,8 @@ test_expect_success 'commit --trailer with -c and "add" as ifmissing' '
398 409 commit --trailer "Helped-by: C5 E5" \
399 410 --trailer "Based-by: C6 E6" \
400 411 --amend &&
401 - commit_body HEAD >actual &&
412 + git cat-file commit HEAD >commit.msg &&
413 + sed -e "1,/^\$/d" commit.msg >actual &&
402 414 test_cmp expected actual
403 415 '
404 416
@@ -412,7 +424,8 @@ test_expect_success 'commit --trailer with -c ack.key ' '
412 424 EOF
413 425 git -c trailer.ack.key="Acked-by" \
414 426 commit --trailer "ack = Peff" -m "hello" &&
415 - commit_body HEAD >actual &&
427 + git cat-file commit HEAD >commit.msg &&
428 + sed -e "1,/^\$/d" commit.msg >actual &&
416 429 test_cmp expected actual
417 430 '
418 431
@@ -427,7 +440,8 @@ test_expect_success 'commit --trailer with -c and ":=#" as separators' '
427 440 git -c trailer.separators=":=#" \
428 441 -c trailer.bug.key="Bug #" \
429 442 commit --trailer "bug = 42" -m "I hate bug" &&
430 - commit_body HEAD >actual &&
443 + git cat-file commit HEAD >commit.msg &&
444 + sed -e "1,/^\$/d" commit.msg >actual &&
431 445 test_cmp expected actual
432 446 '
433 447
@@ -447,7 +461,8 @@ test_expect_success 'commit --trailer with -c and command' '
447 461 -c trailer.report.command="NAME=\"\$ARG\"; test -n \"\$NAME\" && \
448 462 git log --author=\"\$NAME\" -1 --format=\"format:%aN <%aE>\" || true" \
449 463 commit --trailer "report = author" --amend &&
450 - commit_body HEAD >actual &&
464 + git cat-file commit HEAD >commit.msg &&
465 + sed -e "1,/^\$/d" commit.msg >actual &&
451 466 test_cmp expected actual
452 467 '
453 468
@@ -465,7 +480,8 @@ test_expect_success 'commit --trailer not confused by --- separator' '
465 480 echo &&
466 481 echo "my-trailer: value"
467 482 } >expected &&
468 - commit_body HEAD >actual &&
483 + git cat-file commit HEAD >commit.msg &&
484 + sed -e "1,/^\$/d" commit.msg >actual &&
469 485 test_cmp expected actual
470 486 '
471 487
@@ -482,7 +498,8 @@ test_expect_success 'commit --trailer with --verbose' '
482 498 echo &&
483 499 echo "my-trailer: value"
484 500 } >expected &&
485 - commit_body HEAD >actual &&
501 + git cat-file commit HEAD >commit.msg &&
502 + sed -e "1,/^\$/d" commit.msg >actual &&
486 503 test_cmp expected actual
487 504 '
488 505
@@ -491,7 +508,7 @@ test_expect_success 'multiple -m' '
491 508 >negative &&
492 509 git add negative &&
493 510 git commit -m "one" -m "two" -m "three" &&
494 - actual=$(commit_body HEAD) &&
511 + actual=$(git cat-file commit HEAD >tmp && sed -e "1,/^\$/d" tmp && rm tmp) &&
495 512 expected=$(test_write_lines "one" "" "two" "" "three") &&
496 513 test "z$actual" = "z$expected"
497 514
@@ -528,7 +545,8 @@ test_expect_success 'cleanup commit messages (verbatim option,-t)' '
528 545
529 546 echo >>negative &&
530 547 git commit --cleanup=verbatim --no-status -t expect -a &&
531 - commit_body HEAD >actual &&
548 + git cat-file -p HEAD >raw &&
549 + sed -e "1,/^\$/d" raw >actual &&
532 550 test_cmp expect actual
533 551
534 552 '
@@ -537,7 +555,8 @@ test_expect_success 'cleanup commit messages (verbatim option,-F)' '
537 555
538 556 echo >>negative &&
539 557 git commit --cleanup=verbatim -F expect -a &&
540 - commit_body HEAD >actual &&
558 + git cat-file -p HEAD >raw &&
559 + sed -e "1,/^\$/d" raw >actual &&
541 560 test_cmp expect actual
542 561
543 562 '
@@ -546,7 +565,8 @@ test_expect_success 'cleanup commit messages (verbatim option,-m)' '
546 565
547 566 echo >>negative &&
548 567 git commit --cleanup=verbatim -m "$mesg_with_comment_and_newlines" -a &&
549 - commit_body HEAD >actual &&
568 + git cat-file -p HEAD >raw &&
569 + sed -e "1,/^\$/d" raw >actual &&
550 570 test_cmp expect actual
551 571
552 572 '
@@ -557,7 +577,8 @@ test_expect_success 'cleanup commit messages (whitespace option,-F)' '
557 577 test_write_lines "" "# text" "" >text &&
558 578 echo "# text" >expect &&
559 579 git commit --cleanup=whitespace -F text -a &&
560 - commit_body HEAD >actual &&
580 + git cat-file -p HEAD >raw &&
581 + sed -e "1,/^\$/d" raw >actual &&
561 582 test_cmp expect actual
562 583
563 584 '
@@ -584,7 +605,8 @@ test_expect_success 'cleanup commit messages (scissors option,-F,-e)' '
584 605 # to be kept, too
585 606 EOF
586 607 git commit --cleanup=scissors -e -F text -a &&
587 - commit_body HEAD >actual &&
608 + git cat-file -p HEAD >raw &&
609 + sed -e "1,/^\$/d" raw >actual &&
588 610 test_cmp expect actual
589 611 '
590 612
@@ -596,7 +618,8 @@ test_expect_success 'cleanup commit messages (scissors option,-F,-e, scissors on
596 618 to be removed
597 619 EOF
598 620 git commit --cleanup=scissors -e -F text -a --allow-empty-message &&
599 - commit_body HEAD >actual &&
621 + git cat-file -p HEAD >raw &&
622 + sed -e "1,/^\$/d" raw >actual &&
600 623 test_must_be_empty actual
601 624 '
602 625
@@ -606,7 +629,8 @@ test_expect_success 'cleanup commit messages (strip option,-F)' '
606 629 test_write_lines "" "# text" "sample" "" >text &&
607 630 echo sample >expect &&
608 631 git commit --cleanup=strip -F text -a &&
609 - commit_body HEAD >actual &&
632 + git cat-file -p HEAD >raw &&
633 + sed -e "1,/^\$/d" raw >actual &&
610 634 test_cmp expect actual
611 635
612 636 '
@@ -825,7 +849,8 @@ test_expect_success 'A single-liner subject with a token plus colon is not a foo
825 849
826 850 git reset --hard &&
827 851 git commit -s -m "hello: kitty" --allow-empty &&
828 - commit_body HEAD >actual &&
852 + git cat-file commit HEAD >raw &&
853 + sed -e "1,/^$/d" raw >actual &&
829 854 test_line_count = 3 actual
830 855
831 856 '
modified t/t7509-commit-authorship.sh
@@ -12,6 +12,11 @@ author_header () {
12 12 sed -n -e '/^$/q' -e '/^author /p'
13 13 }
14 14
15 + message_body () {
16 + git cat-file commit "$1" |
17 + sed -e '1,/^$/d'
18 + }
19 +
15 20 test_expect_success '-C option copies authorship and message' '
16 21 test_commit --author Frigate\ \<flying@over.world\> \
17 22 "Initial Commit" foo Initial Initial &&
@@ -22,8 +27,8 @@ test_expect_success '-C option copies authorship and message' '
22 27 author_header HEAD >actual &&
23 28 test_cmp expect actual &&
24 29
25 - commit_body Initial >expect &&
26 - commit_body HEAD >actual &&
30 + message_body Initial >expect &&
31 + message_body HEAD >actual &&
27 32 test_cmp expect actual
28 33 '
29 34
@@ -35,8 +40,8 @@ test_expect_success '-C option copies only the message with --reset-author' '
35 40 author_header HEAD >actual &&
36 41 test_cmp expect actual &&
37 42
38 - commit_body Initial >expect &&
39 - commit_body HEAD >actual &&
43 + message_body Initial >expect &&
44 + message_body HEAD >actual &&
40 45 test_cmp expect actual
41 46 '
42 47
@@ -57,8 +62,8 @@ test_expect_success '-c option copies only the message with --reset-author' '
57 62 author_header HEAD >actual &&
58 63 test_cmp expect actual &&
59 64
60 - commit_body Initial >expect &&
61 - commit_body HEAD >actual &&
65 + message_body Initial >expect &&
66 + message_body HEAD >actual &&
62 67 test_cmp expect actual
63 68 '
64 69
@@ -72,7 +77,7 @@ test_expect_success '--amend option copies authorship' '
72 77 test_cmp expect actual &&
73 78
74 79 echo "amend test" >expect &&
75 - commit_body HEAD >actual &&
80 + message_body HEAD >actual &&
76 81 test_cmp expect actual
77 82 '
78 83
@@ -119,7 +124,7 @@ test_expect_success '--reset-author makes the commit ours even with --amend opti
119 124 test_cmp expect actual &&
120 125
121 126 echo "Changed again" >expect &&
122 - commit_body HEAD >actual &&
127 + message_body HEAD >actual &&
123 128 test_cmp expect actual
124 129 '
125 130
@@ -152,7 +157,7 @@ test_expect_success 'commit respects CHERRY_PICK_HEAD and MERGE_MSG' '
152 157 test_cmp expect actual &&
153 158
154 159 echo "This is a MERGE_MSG" >expect &&
155 - commit_body HEAD >actual &&
160 + message_body HEAD >actual &&
156 161 test_cmp expect actual
157 162 '
158 163
modified t/t7600-merge.sh
@@ -332,7 +332,8 @@ test_expect_success 'merge --squash c3 with c7' '
332 332 # Conflicts:
333 333 # file
334 334 EOF
335 - commit_body HEAD >actual &&
335 + git cat-file commit HEAD >raw &&
336 + sed -e "1,/^$/d" raw >actual &&
336 337 test_cmp expect actual
337 338 '
338 339
@@ -362,7 +363,8 @@ test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
362 363 # Conflicts:
363 364 # file
364 365 EOF
365 - commit_body HEAD >actual &&
366 + git cat-file commit HEAD >raw &&
367 + sed -e "1,/^$/d" raw >actual &&
366 368 test_cmp expect actual
367 369 '
368 370
@@ -385,7 +387,8 @@ test_expect_success 'merge c3 with c7 with --squash commit.cleanup = scissors' '
385 387 # Conflicts:
386 388 # file
387 389 EOF
388 - commit_body HEAD >actual &&
390 + git cat-file commit HEAD >raw &&
391 + sed -e "1,/^$/d" raw >actual &&
389 392 test_cmp expect actual
390 393 '
391 394
@@ -986,8 +989,9 @@ test_expect_success 'merge --no-ff --edit' '
986 989 git reset --hard c0 &&
987 990 EDITOR=./editor git merge --no-ff --edit c1 &&
988 991 verify_parents $c0 $c1 &&
989 - commit_body HEAD >actual &&
990 - test_grep "work done on the side branch" actual &&
992 + git cat-file commit HEAD >raw &&
993 + test_grep "work done on the side branch" raw &&
994 + sed "1,/^$/d" >actual raw &&
991 995 test_cmp expected actual
992 996 '
993 997
@@ -1162,21 +1166,4 @@ test_expect_success 'suggested names are not ambiguous' '
1162 1166 test_grep remotes/origin/not-local stderr
1163 1167 '
1164 1168
1165 - test_expect_success 'merge with no argument defaults to upstream' '
1166 - test_when_finished "rm -rf upstream downstream" &&
1167 - git init upstream &&
1168 - (
1169 - cd upstream &&
1170 - test_commit one &&
1171 - test_commit two
1172 - ) &&
1173 - git clone upstream downstream &&
1174 - (
1175 - cd downstream &&
1176 - git reset --hard HEAD^ &&
1177 - git merge &&
1178 - test_cmp_rev origin/main HEAD
1179 - )
1180 - '
1181 -
1182 1169 test_done
modified t/t7604-merge-custom-message.sh
@@ -36,14 +36,16 @@ test_expect_success 'setup' '
36 36 test_expect_success 'merge c2 with a custom message' '
37 37 git reset --hard c1 &&
38 38 git merge -m "$(cat exp.subject)" c2 &&
39 - commit_body HEAD >actual &&
39 + git cat-file commit HEAD >raw &&
40 + sed -e "1,/^$/d" raw >actual &&
40 41 test_cmp exp.subject actual
41 42 '
42 43
43 44 test_expect_success 'merge --log appends to custom message' '
44 45 git reset --hard c1 &&
45 46 git merge --log -m "$(cat exp.subject)" c2 &&
46 - commit_body HEAD >actual &&
47 + git cat-file commit HEAD >raw &&
48 + sed -e "1,/^$/d" raw >actual &&
47 49 test_cmp exp.log actual
48 50 '
49 51
@@ -59,7 +61,8 @@ test_expect_success 'prepare file with comment line and trailing newlines' '
59 61 test_expect_success 'cleanup commit messages (verbatim option)' '
60 62 git reset --hard c1 &&
61 63 git merge --cleanup=verbatim -F expect c2 &&
62 - commit_body HEAD >actual &&
64 + git cat-file commit HEAD >raw &&
65 + sed -e "1,/^$/d" raw >actual &&
63 66 test_cmp expect actual
64 67 '
65 68
@@ -68,7 +71,8 @@ test_expect_success 'cleanup commit messages (whitespace option)' '
68 71 test_write_lines "" "# text" "" >text &&
69 72 echo "# text" >expect &&
70 73 git merge --cleanup=whitespace -F text c2 &&
71 - commit_body HEAD >actual &&
74 + git cat-file commit HEAD >raw &&
75 + sed -e "1,/^$/d" raw >actual &&
72 76 test_cmp expect actual
73 77 '
74 78
@@ -93,7 +97,8 @@ test_expect_success 'cleanup merge messages (scissors option)' '
93 97 # to be kept, too
94 98 EOF
95 99 git merge --cleanup=scissors -e -F text c2 &&
96 - commit_body HEAD >actual &&
100 + git cat-file commit HEAD >raw &&
101 + sed -e "1,/^$/d" raw >actual &&
97 102 test_cmp expect actual
98 103 '
99 104
@@ -102,7 +107,8 @@ test_expect_success 'cleanup commit messages (strip option)' '
102 107 test_write_lines "" "# text" "sample" "" >text &&
103 108 echo sample >expect &&
104 109 git merge --cleanup=strip -F text c2 &&
105 - commit_body HEAD >actual &&
110 + git cat-file commit HEAD >raw &&
111 + sed -e "1,/^$/d" raw >actual &&
106 112 test_cmp expect actual
107 113 '
108 114
modified t/t7614-merge-signoff.sh
@@ -45,7 +45,8 @@ test_expect_success 'git merge --signoff adds a sign-off line' '
45 45 test_commit main-branch-2 file2 2 &&
46 46 git checkout other-branch &&
47 47 git merge main --signoff --no-edit &&
48 - commit_body HEAD >actual &&
48 + git cat-file commit HEAD >commit &&
49 + sed -e "1,/^\$/d" commit >actual &&
49 50 test_cmp expected-signed actual
50 51 '
51 52
@@ -55,7 +56,8 @@ test_expect_success 'git merge does not add a sign-off line' '
55 56 test_commit main-branch-3 file3 3 &&
56 57 git checkout other-branch &&
57 58 git merge main --no-edit &&
58 - commit_body HEAD >actual &&
59 + git cat-file commit HEAD >commit &&
60 + sed -e "1,/^\$/d" commit >actual &&
59 61 test_cmp expected-unsigned actual
60 62 '
61 63
@@ -65,7 +67,8 @@ test_expect_success 'git merge --no-signoff flag cancels --signoff flag' '
65 67 test_commit main-branch-4 file4 4 &&
66 68 git checkout other-branch &&
67 69 git merge main --no-edit --signoff --no-signoff &&
68 - commit_body HEAD >actual &&
70 + git cat-file commit HEAD >commit &&
71 + sed -e "1,/^\$/d" commit >actual &&
69 72 test_cmp expected-unsigned actual
70 73 '
71 74
modified t/t7900-maintenance.sh
@@ -23,12 +23,6 @@ test_xmllint () {
23 23 fi
24 24 }
25 25
26 - test_maintenance_tasks () {
27 - cat >expect &&
28 - sed -ne "s/.*\"region_enter\".*\"category\":\"maintenance\([^\"]*\)\".*\"label\":\"\([^\"][^\"]*\)\".*/\2\1/p" "$1" >actual &&
29 - test_cmp expect actual
30 - }
31 -
32 26 test_lazy_prereq SYSTEMD_ANALYZE '
33 27 systemd-analyze verify /lib/systemd/system/basic.target
34 28 '
@@ -186,9 +180,8 @@ test_expect_success 'maintenance.<task>.enabled' '
186 180 git config maintenance.gc.enabled false &&
187 181 git config maintenance.commit-graph.enabled true &&
188 182 GIT_TRACE2_EVENT="$(pwd)/run-config.txt" git maintenance run 2>err &&
189 - test_maintenance_tasks run-config.txt <<-\EOF
190 - commit-graph
191 - EOF
183 + test_subcommand ! git gc --quiet <run-config.txt &&
184 + test_subcommand git commit-graph write --split --reachable --no-progress <run-config.txt
192 185 '
193 186
194 187 test_expect_success 'run --task=<task>' '
@@ -196,20 +189,16 @@ test_expect_success 'run --task=<task>' '
196 189 git maintenance run --task=commit-graph 2>/dev/null &&
197 190 GIT_TRACE2_EVENT="$(pwd)/run-gc.txt" \
198 191 git maintenance run --task=gc 2>/dev/null &&
192 + GIT_TRACE2_EVENT="$(pwd)/run-commit-graph.txt" \
193 + git maintenance run --task=commit-graph 2>/dev/null &&
199 194 GIT_TRACE2_EVENT="$(pwd)/run-both.txt" \
200 195 git maintenance run --task=commit-graph --task=gc 2>/dev/null &&
201 - test_maintenance_tasks run-commit-graph.txt <<-\EOF &&
202 - commit-graph
203 - EOF
204 - test_maintenance_tasks run-gc.txt <<-\EOF &&
205 - gc foreground
206 - gc
207 - EOF
208 - test_maintenance_tasks run-both.txt <<-\EOF
209 - gc foreground
210 - commit-graph
211 - gc
212 - EOF
196 + test_subcommand ! git gc --quiet --no-detach --skip-foreground-tasks <run-commit-graph.txt &&
197 + test_subcommand git gc --quiet --no-detach --skip-foreground-tasks <run-gc.txt &&
198 + test_subcommand git gc --quiet --no-detach --skip-foreground-tasks <run-both.txt &&
199 + test_subcommand git commit-graph write --split --reachable --no-progress <run-commit-graph.txt &&
200 + test_subcommand ! git commit-graph write --split --reachable --no-progress <run-gc.txt &&
201 + test_subcommand git commit-graph write --split --reachable --no-progress <run-both.txt
213 202 '
214 203
215 204 test_expect_success 'core.commitGraph=false prevents write process' '
@@ -246,19 +235,12 @@ test_expect_success 'commit-graph auto condition' '
246 235 GIT_TRACE2_EVENT="$(pwd)/cg-two-satisfied.txt" \
247 236 git -c maintenance.commit-graph.auto=2 $COMMAND &&
248 237
249 - test_maintenance_tasks cg-no.txt <<-\EOF &&
250 - EOF
251 - test_maintenance_tasks cg-negative-means-yes.txt <<-\EOF &&
252 - commit-graph
253 - EOF
254 - test_maintenance_tasks cg-zero-means-no.txt <<-\EOF &&
255 - EOF
256 - test_maintenance_tasks cg-one-satisfied.txt <<-\EOF &&
257 - commit-graph
258 - EOF
259 - test_maintenance_tasks cg-two-satisfied.txt <<-\EOF
260 - commit-graph
261 - EOF
238 + COMMIT_GRAPH_WRITE="git commit-graph write --split --reachable --no-progress" &&
239 + test_subcommand ! $COMMIT_GRAPH_WRITE <cg-no.txt &&
240 + test_subcommand $COMMIT_GRAPH_WRITE <cg-negative-means-yes.txt &&
241 + test_subcommand ! $COMMIT_GRAPH_WRITE <cg-zero-means-no.txt &&
242 + test_subcommand $COMMIT_GRAPH_WRITE <cg-one-satisfied.txt &&
243 + test_subcommand $COMMIT_GRAPH_WRITE <cg-two-satisfied.txt
262 244 '
263 245
264 246 test_expect_success 'commit-graph auto condition with merges' '
@@ -580,8 +562,8 @@ run_and_verify_geometric_pack () {
580 562 rm -f "trace2.txt" &&
581 563 GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
582 564 git maintenance run --task=geometric-repack 2>/dev/null &&
583 - test_subcommand git repack -d -l -q --geometric=2 \
584 - --write-midx <trace2.txt &&
565 + test_subcommand git repack -d -l --geometric=2 \
566 + --quiet --write-midx <trace2.txt &&
585 567
586 568 # Verify that the number of packfiles matches our expectation.
587 569 ls -l .git/objects/pack/*.pack >packfiles &&
@@ -612,8 +594,8 @@ test_expect_success 'geometric repacking task' '
612 594 # The initial repack causes an all-into-one repack.
613 595 GIT_TRACE2_EVENT="$(pwd)/initial-repack.txt" \
614 596 git maintenance run --task=geometric-repack 2>/dev/null &&
615 - test_subcommand git repack -d -l -q --cruft --cruft-expiration=2.weeks.ago \
616 - --write-midx <initial-repack.txt &&
597 + test_subcommand git repack -d -l --cruft --cruft-expiration=2.weeks.ago \
598 + --quiet --write-midx <initial-repack.txt &&
617 599
618 600 # Repacking should now cause a no-op geometric repack because
619 601 # no packfiles need to be combined.
@@ -633,8 +615,8 @@ test_expect_success 'geometric repacking task' '
633 615 # an all-into-one-repack.
634 616 GIT_TRACE2_EVENT="$(pwd)/all-into-one-repack.txt" \
635 617 git maintenance run --task=geometric-repack 2>/dev/null &&
636 - test_subcommand git repack -d -l -q --cruft --cruft-expiration=2.weeks.ago \
637 - --write-midx <all-into-one-repack.txt &&
618 + test_subcommand git repack -d -l --cruft --cruft-expiration=2.weeks.ago \
619 + --quiet --write-midx <all-into-one-repack.txt &&
638 620
639 621 # The geometric repack soaks up unreachable objects.
640 622 echo blob-1 | git hash-object -w --stdin -t blob &&
@@ -668,8 +650,8 @@ test_expect_success 'geometric repacking task' '
668 650 run_and_verify_geometric_pack 3 &&
669 651 GIT_TRACE2_EVENT="$(pwd)/cruft-repack.txt" \
670 652 git maintenance run --task=geometric-repack 2>/dev/null &&
671 - test_subcommand git repack -d -l -q --cruft --cruft-expiration=2.weeks.ago \
672 - --write-midx <cruft-repack.txt &&
653 + test_subcommand git repack -d -l --cruft --cruft-expiration=2.weeks.ago \
654 + --quiet --write-midx <cruft-repack.txt &&
673 655 ls .git/objects/pack/*.pack >packs &&
674 656 test_line_count = 2 packs &&
675 657 ls .git/objects/pack/*.mtimes >cruft &&
@@ -760,133 +742,7 @@ test_expect_success 'geometric repacking honors configured split factor' '
760 742
761 743 test_geometric_repack_needed false splitFactor=2 &&
762 744 test_geometric_repack_needed true splitFactor=3 &&
763 - test_subcommand git repack -d -l -q --geometric=3 --write-midx <trace2.txt
764 - )
765 - '
766 -
767 - test_expect_success 'pre-auto-gc hook runs exactly once' '
768 - test_when_finished "rm -rf repo" &&
769 - git init repo &&
770 - (
771 - cd repo &&
772 - write_script .git/hooks/pre-auto-gc <<-\EOF &&
773 - echo hook >>hook.log
774 - EOF
775 -
776 - # Satisfy the auto condition for multiple tasks, both in the
777 - # foreground and in the background phase.
778 - git config set maintenance.reflog-expire.auto -1 &&
779 - git config set maintenance.geometric-repack.auto -1 &&
780 - git config set maintenance.rerere-gc.auto -1 &&
781 -
782 - GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
783 - git maintenance run --auto 2>/dev/null &&
784 -
785 - # The successful hook does not inhibit any of the tasks...
786 - test_maintenance_tasks trace2.txt <<-\EOF &&
787 - reflog-expire foreground
788 - geometric-repack
789 - rerere-gc
790 - EOF
791 - # ... but it must only have been executed a single time.
792 - test_line_count = 1 hook.log
793 - )
794 - '
795 -
796 - test_expect_success 'pre-auto-gc hook can inhibit geometric strategy' '
797 - test_when_finished "rm -rf repo" &&
798 - git init repo &&
799 - (
800 - cd repo &&
801 - write_script .git/hooks/pre-auto-gc <<-\EOF &&
802 - echo hook >>hook.log
803 - exit 1
804 - EOF
805 -
806 - git config set maintenance.reflog-expire.auto -1 &&
807 - git config set maintenance.geometric-repack.auto -1 &&
808 - git config set maintenance.rerere-gc.auto -1 &&
809 -
810 - # Maintenance would be required...
811 - git maintenance is-needed --auto &&
812 -
813 - GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
814 - git maintenance run --auto 2>/dev/null &&
815 -
816 - # ... but the failing hook inhibits all tasks. The hook itself
817 - # is expected to be the only child process being spawned, and
818 - # it must only run a single time.
819 - test_grep "child_start.*pre-auto-gc" trace2.txt &&
820 - test_maintenance_tasks trace2.txt <<-\EOF &&
821 - EOF
822 - test_line_count = 1 hook.log
823 - )
824 - '
825 -
826 - test_expect_success 'pre-auto-gc hook can inhibit gc strategy' '
827 - test_when_finished "rm -rf repo" &&
828 - git init repo &&
829 - (
830 - cd repo &&
831 - write_script .git/hooks/pre-auto-gc <<-\EOF &&
832 - echo hook >>hook.log
833 - exit 1
834 - EOF
835 -
836 - git config set maintenance.strategy gc &&
837 - git config set maintenance.auto false &&
838 - git config set gc.auto 3 &&
839 -
840 - test_oid_init &&
841 -
842 - # We need to create two objects whose hashes start with 17
843 - # since this is what the gc task counts.
844 - test_commit "$(test_oid blob17_1)" &&
845 - test_commit "$(test_oid blob17_2)" &&
846 -
847 - # Maintenance would be required...
848 - git maintenance is-needed --auto &&
849 -
850 - GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
851 - git maintenance run --auto 2>/dev/null &&
852 -
853 - # ... but the failing hook inhibits all tasks. The hook itself
854 - # is expected to be the only child process being spawned, and
855 - # it must only run a single time.
856 - test_grep "child_start.*pre-auto-gc" trace2.txt &&
857 - test_maintenance_tasks trace2.txt <<-\EOF &&
858 - EOF
859 - test_subcommand_flex ! git trace2 &&
860 - test_line_count = 1 hook.log
861 - )
862 - '
863 -
864 - test_expect_success 'pre-auto-gc hook does not run when no maintenance is needed' '
865 - test_when_finished "rm -rf repo" &&
866 - git init repo &&
867 - (
868 - cd repo &&
869 - write_script .git/hooks/pre-auto-gc <<-\EOF &&
870 - echo hook >>hook.log
871 - EOF
872 - test_must_fail git maintenance is-needed --auto &&
873 - git maintenance run --auto 2>/dev/null &&
874 - test_path_is_missing hook.log
875 - )
876 - '
877 -
878 - test_expect_success 'pre-auto-gc hook does not run without --auto' '
879 - test_when_finished "rm -rf repo" &&
880 - git init repo &&
881 - test_hook -C repo pre-auto-gc <<-\EOF &&
882 - echo hook >>hook.log
883 - EOF
884 - (
885 - cd repo &&
886 - GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
887 - git maintenance run 2>/dev/null &&
888 - test_grep "\[\"git\",\"repack\"," trace2.txt &&
889 - test_path_is_missing hook.log
745 + test_subcommand git repack -d -l --geometric=3 --quiet --write-midx <trace2.txt
890 746 )
891 747 '
892 748
@@ -1060,28 +916,24 @@ test_expect_success '--schedule inheritance weekly -> daily -> hourly' '
1060 916
1061 917 GIT_TRACE2_EVENT="$(pwd)/hourly.txt" \
1062 918 git maintenance run --schedule=hourly 2>/dev/null &&
1063 - test_maintenance_tasks hourly.txt <<-\EOF &&
1064 - prefetch
1065 - loose-objects
1066 - EOF
919 + test_subcommand git prune-packed --quiet <hourly.txt &&
920 + test_subcommand ! git commit-graph write --split --reachable \
921 + --no-progress <hourly.txt &&
922 + test_subcommand ! git multi-pack-index write --no-progress <hourly.txt &&
1067 923
1068 924 GIT_TRACE2_EVENT="$(pwd)/daily.txt" \
1069 925 git maintenance run --schedule=daily 2>/dev/null &&
1070 - test_maintenance_tasks daily.txt <<-\EOF &&
1071 - prefetch
1072 - loose-objects
1073 - commit-graph
1074 - EOF
926 + test_subcommand git prune-packed --quiet <daily.txt &&
927 + test_subcommand git commit-graph write --split --reachable \
928 + --no-progress <daily.txt &&
929 + test_subcommand ! git multi-pack-index write --no-progress <daily.txt &&
1075 930
1076 931 GIT_TRACE2_EVENT="$(pwd)/weekly.txt" \
1077 932 git maintenance run --schedule=weekly 2>/dev/null &&
1078 - test_maintenance_tasks weekly.txt <<-\EOF
1079 - pack-refs foreground
1080 - prefetch
1081 - loose-objects
1082 - incremental-repack
1083 - commit-graph
1084 - EOF
933 + test_subcommand git prune-packed --quiet <weekly.txt &&
934 + test_subcommand git commit-graph write --split --reachable \
935 + --no-progress <weekly.txt &&
936 + test_subcommand git multi-pack-index write --no-progress <weekly.txt
1085 937 '
1086 938
1087 939 test_expect_success 'maintenance.strategy inheritance' '
@@ -1100,25 +952,29 @@ test_expect_success 'maintenance.strategy inheritance' '
1100 952 GIT_TRACE2_EVENT="$(pwd)/incremental-weekly.txt" \
1101 953 git maintenance run --schedule=weekly --quiet &&
1102 954
1103 - test_maintenance_tasks incremental-hourly.txt <<-\EOF &&
1104 - prefetch
1105 - commit-graph
1106 - EOF
1107 -
1108 - test_maintenance_tasks incremental-daily.txt <<-\EOF &&
1109 - prefetch
1110 - loose-objects
1111 - incremental-repack
1112 - commit-graph
1113 - EOF
1114 -
1115 - test_maintenance_tasks incremental-weekly.txt <<-\EOF &&
1116 - pack-refs foreground
1117 - prefetch
1118 - loose-objects
1119 - incremental-repack
1120 - commit-graph
1121 - EOF
955 + test_subcommand git commit-graph write --split --reachable \
956 + --no-progress <incremental-hourly.txt &&
957 + test_subcommand ! git prune-packed --quiet <incremental-hourly.txt &&
958 + test_subcommand ! git multi-pack-index write --no-progress \
959 + <incremental-hourly.txt &&
960 + test_subcommand ! git pack-refs --all --prune \
961 + <incremental-hourly.txt &&
962 +
963 + test_subcommand git commit-graph write --split --reachable \
964 + --no-progress <incremental-daily.txt &&
965 + test_subcommand git prune-packed --quiet <incremental-daily.txt &&
966 + test_subcommand git multi-pack-index write --no-progress \
967 + <incremental-daily.txt &&
968 + test_subcommand ! git pack-refs --all --prune \
969 + <incremental-daily.txt &&
970 +
971 + test_subcommand git commit-graph write --split --reachable \
972 + --no-progress <incremental-weekly.txt &&
973 + test_subcommand git prune-packed --quiet <incremental-weekly.txt &&
974 + test_subcommand git multi-pack-index write --no-progress \
975 + <incremental-weekly.txt &&
976 + test_subcommand git pack-refs --all --prune \
977 + <incremental-weekly.txt &&
1122 978
1123 979 # Modify defaults
1124 980 git config maintenance.commit-graph.schedule daily &&
@@ -1130,26 +986,30 @@ test_expect_success 'maintenance.strategy inheritance' '
1130 986 GIT_TRACE2_EVENT="$(pwd)/modified-daily.txt" \
1131 987 git maintenance run --schedule=daily --quiet &&
1132 988
1133 - test_maintenance_tasks modified-hourly.txt <<-\EOF &&
1134 - prefetch
1135 - loose-objects
1136 - EOF
989 + test_subcommand ! git commit-graph write --split --reachable \
990 + --no-progress <modified-hourly.txt &&
991 + test_subcommand git prune-packed --quiet <modified-hourly.txt &&
992 + test_subcommand ! git multi-pack-index write --no-progress \
993 + <modified-hourly.txt &&
1137 994
1138 - test_maintenance_tasks modified-daily.txt <<-\EOF
1139 - prefetch
1140 - loose-objects
1141 - commit-graph
1142 - EOF
995 + test_subcommand git commit-graph write --split --reachable \
996 + --no-progress <modified-daily.txt &&
997 + test_subcommand git prune-packed --quiet <modified-daily.txt &&
998 + test_subcommand ! git multi-pack-index write --no-progress \
999 + <modified-daily.txt
1143 1000 '
1144 1001
1145 1002 test_strategy () {
1146 1003 STRATEGY="$1"
1147 1004 shift
1148 1005
1006 + cat >expect &&
1149 1007 rm -f trace2.txt &&
1150 1008 GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
1151 1009 git -c maintenance.strategy=$STRATEGY maintenance run --quiet "$@" &&
1152 - test_maintenance_tasks trace2.txt
1010 + sed -n 's/{"event":"child_start","sid":"[^/"]*",.*,"argv":\["\(.*\)\"]}/\1/p' <trace2.txt |
1011 + sed 's/","/ /g' >actual
1012 + test_cmp expect actual
1153 1013 }
1154 1014
1155 1015 test_expect_success 'maintenance.strategy is respected' '
@@ -1163,44 +1023,48 @@ test_expect_success 'maintenance.strategy is respected' '
1163 1023 test_grep "unknown maintenance strategy: .unknown." err &&
1164 1024
1165 1025 test_strategy incremental <<-\EOF &&
1166 - gc foreground
1167 - gc
1026 + git pack-refs --all --prune
1027 + git reflog expire --all
1028 + git gc --quiet --no-detach --skip-foreground-tasks
1168 1029 EOF
1169 1030
1170 1031 test_strategy incremental --schedule=weekly <<-\EOF &&
1171 - pack-refs foreground
1172 - prefetch
1173 - loose-objects
1174 - incremental-repack
1175 - commit-graph
1032 + git pack-refs --all --prune
1033 + git prune-packed --quiet
1034 + git multi-pack-index write --no-progress
1035 + git multi-pack-index expire --no-progress
1036 + git multi-pack-index repack --no-progress --batch-size=1
1037 + git commit-graph write --split --reachable --no-progress
1176 1038 EOF
1177 1039
1178 1040 test_strategy gc <<-\EOF &&
1179 - gc foreground
1180 - gc
1041 + git pack-refs --all --prune
1042 + git reflog expire --all
1043 + git gc --quiet --no-detach --skip-foreground-tasks
1181 1044 EOF
1182 1045
1183 1046 test_strategy gc --schedule=weekly <<-\EOF &&
1184 - gc foreground
1185 - gc
1047 + git pack-refs --all --prune
1048 + git reflog expire --all
1049 + git gc --quiet --no-detach --skip-foreground-tasks
1186 1050 EOF
1187 1051
1188 1052 test_strategy geometric <<-\EOF &&
1189 - pack-refs foreground
1190 - reflog-expire foreground
1191 - geometric-repack
1192 - commit-graph
1193 - worktree-prune
1194 - rerere-gc
1053 + git pack-refs --all --prune
1054 + git reflog expire --all
1055 + git repack -d -l --geometric=2 --quiet --write-midx
1056 + git commit-graph write --split --reachable --no-progress
1057 + git worktree prune --expire 3.months.ago
1058 + git rerere gc
1195 1059 EOF
1196 1060
1197 1061 test_strategy geometric --schedule=weekly <<-\EOF
1198 - pack-refs foreground
1199 - reflog-expire foreground
1200 - geometric-repack
1201 - commit-graph
1202 - worktree-prune
1203 - rerere-gc
1062 + git pack-refs --all --prune
1063 + git reflog expire --all
1064 + git repack -d -l --geometric=2 --quiet --write-midx
1065 + git commit-graph write --split --reachable --no-progress
1066 + git worktree prune --expire 3.months.ago
1067 + git rerere gc
1204 1068 EOF
1205 1069 )
1206 1070 '
modified t/test-lib-functions.sh
@@ -1433,14 +1433,6 @@ test_commit_message () {
1433 1433 test_cmp "$msg_file" actual.msg
1434 1434 }
1435 1435
1436 - # Print the message body of a commit
1437 - # Usage: commit_body <rev>
1438 - commit_body () {
1439 - git cat-file commit "$1" >.commit &&
1440 - sed -e "1,/^$/d" .commit &&
1441 - rm -f .commit
1442 - }
1443 -
1444 1436 # Compare paths respecting core.ignoreCase
1445 1437 test_cmp_fspath () {
1446 1438 if test "x$1" = "x$2"