Skip to content

Commit fc2a674

Browse files
committed
Merge branch 'master' of https://github.com/git/git
Upstream adds 18 new translatable messages. * 'master' of https://github.com/git/git: (41 commits) A bit more on top of 2.54-rc0 ... Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 parents 82747b0 + 8de2f1b commit fc2a674

38 files changed

Lines changed: 1368 additions & 389 deletions

Documentation/RelNotes/2.54.0.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ UI, Workflows & Features
109109
* "git repo info -h" and "git repo structure -h" limit their help output
110110
to the part that is specific to the subcommand.
111111

112+
* "git format-patch --cover-letter" learns to use a simpler format
113+
instead of the traditional shortlog format to list its commits with
114+
a new --commit-list-format option and format.commitListFormat
115+
configuration variable.
116+
117+
* `git backfill` learned to accept revision and pathspec arguments.
118+
119+
* "git replay" (experimental) learns, in addition to "pick" and
120+
"replay", a new operating mode "revert".
121+
112122

113123
Performance, Internal Implementation, Development Support etc.
114124
--------------------------------------------------------------
@@ -495,3 +505,4 @@ Fixes since v2.53
495505
(merge fc8a4f15e7 gi/doc-boolean-config-typofix later to maint).
496506
(merge 37182267a0 kh/doc-interpret-trailers-1 later to maint).
497507
(merge f64c50e768 jc/rerere-modern-strbuf-handling later to maint).
508+
(merge 699248d89e th/t8003-unhide-git-failures later to maint).

Documentation/config/format.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ format.coverLetter::
101101
generate a cover-letter only when there's more than one patch.
102102
Default is false.
103103

104+
format.commitListFormat::
105+
When the `--cover-letter-format` option is not given, `format-patch`
106+
uses the value of this variable to decide how to format the entry of
107+
each commit. Defaults to `shortlog`.
108+
104109
format.outputDirectory::
105110
Set a custom directory to store the resulting files instead of the
106111
current working directory. All directory components will be created.

Documentation/config/hook.adoc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
hook.<name>.command::
2-
The command to execute for `hook.<name>`. `<name>` is a unique
3-
"friendly" name that identifies this hook. (The hook events that
4-
trigger the command are configured with `hook.<name>.event`.) The
5-
value can be an executable path or a shell oneliner. If more than
6-
one value is specified for the same `<name>`, only the last value
7-
parsed is used. See linkgit:git-hook[1].
1+
hook.<friendly-name>.command::
2+
The command to execute for `hook.<friendly-name>`. `<friendly-name>`
3+
is a unique name that identifies this hook. The hook events that
4+
trigger the command are configured with `hook.<friendly-name>.event`.
5+
The value can be an executable path or a shell oneliner. If more than
6+
one value is specified for the same `<friendly-name>`, only the last
7+
value parsed is used. See linkgit:git-hook[1].
88

9-
hook.<name>.event::
10-
The hook events that trigger `hook.<name>`. The value is the name
11-
of a hook event, like "pre-commit" or "update". (See
9+
hook.<friendly-name>.event::
10+
The hook events that trigger `hook.<friendly-name>`. The value is the
11+
name of a hook event, like "pre-commit" or "update". (See
1212
linkgit:githooks[5] for a complete list of hook events.) On the
13-
specified event, the associated `hook.<name>.command` is executed.
14-
This is a multi-valued key. To run `hook.<name>` on multiple
13+
specified event, the associated `hook.<friendly-name>.command` is executed.
14+
This is a multi-valued key. To run `hook.<friendly-name>` on multiple
1515
events, specify the key more than once. An empty value resets
1616
the list of events, clearing any previously defined events for
17-
`hook.<name>`. See linkgit:git-hook[1].
17+
`hook.<friendly-name>`. See linkgit:git-hook[1].
1818

19-
hook.<name>.enabled::
20-
Whether the hook `hook.<name>` is enabled. Defaults to `true`.
19+
hook.<friendly-name>.enabled::
20+
Whether the hook `hook.<friendly-name>` is enabled. Defaults to `true`.
2121
Set to `false` to disable the hook without removing its
2222
configuration. This is particularly useful when a hook is defined
2323
in a system or global config file and needs to be disabled for a

Documentation/git-backfill.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,12 @@ OPTIONS
6363
current sparse-checkout. If the sparse-checkout feature is enabled,
6464
then `--sparse` is assumed and can be disabled with `--no-sparse`.
6565

66+
You may also specify the commit limiting options from linkgit:git-rev-list[1].
67+
6668
SEE ALSO
6769
--------
68-
linkgit:git-clone[1].
70+
linkgit:git-clone[1],
71+
linkgit:git-rev-list[1]
6972

7073
GIT
7174
---

Documentation/git-format-patch.adoc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ SYNOPSIS
2424
[(--reroll-count|-v) <n>]
2525
[--to=<email>] [--cc=<email>]
2626
[--[no-]cover-letter] [--quiet]
27+
[--commit-list-format=<format-spec>]
2728
[--[no-]encode-email-headers]
2829
[--no-notes | --notes[=<ref>]]
2930
[--interdiff=<previous>]
@@ -318,9 +319,21 @@ feeding the result to `git send-email`.
318319
319320
--cover-letter::
320321
--no-cover-letter::
321-
In addition to the patches, generate a cover letter file
322-
containing the branch description, shortlog and the overall diffstat. You can
323-
fill in a description in the file before sending it out.
322+
In addition to the patches, generate a cover letter file containing the
323+
branch description, commit list and the overall diffstat. You can fill
324+
in a description in the file before sending it out.
325+
326+
--commit-list-format=<format-spec>::
327+
Specify the format in which to generate the commit list of the patch
328+
series. The accepted values for format-spec are `shortlog`, `modern` or
329+
a format-string prefixed with `log:`. E.g. `log: %s (%an)`.
330+
`modern` is the same as `log:%w(72)[%(count)/%(total)] %s`.
331+
The `log:` prefix can be omitted if the format-string has a `%` in it
332+
(expecting that it is part of `%<placeholder>`).
333+
Defaults to the `format.commitListFormat` configuration variable, if
334+
set, or `shortlog`.
335+
This option given from the command-line implies the use of
336+
`--cover-letter` unless `--no-cover-letter` is given.
324337
325338
--encode-email-headers::
326339
--no-encode-email-headers::
@@ -453,6 +466,7 @@ with configuration variables.
453466
signOff = true
454467
outputDirectory = <directory>
455468
coverLetter = auto
469+
commitListFormat = shortlog
456470
coverFromDescription = auto
457471
------------
458472

Documentation/git-hook.adoc

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ git-hook - Run git hooks
88
SYNOPSIS
99
--------
1010
[verse]
11-
'git hook' run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-args>]
12-
'git hook' list [-z] <hook-name>
11+
'git hook' run [--allow-unknown-hook-name] [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-args>]
12+
'git hook' list [--allow-unknown-hook-name] [-z] [--show-scope] <hook-name>
1313

1414
DESCRIPTION
1515
-----------
@@ -44,7 +44,7 @@ event`), and then `~/bin/spellchecker` will have a chance to check your commit
4444
message (during the `commit-msg` hook event).
4545

4646
Commands are run in the order Git encounters their associated
47-
`hook.<name>.event` configs during the configuration parse (see
47+
`hook.<friendly-name>.event` configs during the configuration parse (see
4848
linkgit:git-config[1]). Although multiple `hook.linter.event` configs can be
4949
added, only one `hook.linter.command` event is valid - Git uses "last-one-wins"
5050
to determine which command to run.
@@ -76,10 +76,10 @@ first start `~/bin/linter --cpp20` and second start `~/bin/leak-detector`. It
7676
would evaluate the output of each when deciding whether to proceed with the
7777
commit.
7878

79-
For a full list of hook events which you can set your `hook.<name>.event` to,
79+
For a full list of hook events which you can set your `hook.<friendly-name>.event` to,
8080
and how hooks are invoked during those events, see linkgit:githooks[5].
8181

82-
Git will ignore any `hook.<name>.event` that specifies an event it doesn't
82+
Git will ignore any `hook.<friendly-name>.event` that specifies an event it doesn't
8383
recognize. This is intended so that tools which wrap Git can use the hook
8484
infrastructure to run their own hooks; see "WRAPPERS" for more guidance.
8585

@@ -113,14 +113,21 @@ Any positional arguments to the hook should be passed after a
113113
mandatory `--` (or `--end-of-options`, see linkgit:gitcli[7]). See
114114
linkgit:githooks[5] for arguments hooks might expect (if any).
115115
116-
list [-z]::
116+
list [-z] [--show-scope]::
117117
Print a list of hooks which will be run on `<hook-name>` event. If no
118118
hooks are configured for that event, print a warning and return 1.
119119
Use `-z` to terminate output lines with NUL instead of newlines.
120120
121121
OPTIONS
122122
-------
123123

124+
--allow-unknown-hook-name::
125+
By default `git hook run` and `git hook list` will bail out when
126+
`<hook-name>` is not a hook event known to Git (see linkgit:githooks[5]
127+
for the list of known hooks). This is meant to help catch typos
128+
such as `prereceive` when `pre-receive` was intended. Pass this
129+
flag to allow unknown hook names.
130+
124131
--to-stdin::
125132
For "run"; specify a file which will be streamed into the
126133
hook's stdin. The hook will receive the entire file from
@@ -134,6 +141,12 @@ OPTIONS
134141
-z::
135142
Terminate "list" output lines with NUL instead of newlines.
136143

144+
--show-scope::
145+
For "list"; prefix each configured hook's friendly name with a
146+
tab-separated config scope (e.g. `local`, `global`, `system`),
147+
mirroring the output style of `git config --show-scope`. Traditional
148+
hooks from the hookdir are unaffected.
149+
137150
WRAPPERS
138151
--------
139152
@@ -153,7 +166,7 @@ Then, in your 'mywrapper' tool, you can invoke any users' configured hooks by
153166
running:
154167
155168
----
156-
git hook run mywrapper-start-tests \
169+
git hook run --allow-unknown-hook-name mywrapper-start-tests \
157170
# providing something to stdin
158171
--stdin some-tempfile-123 \
159172
# execute hooks in serial

Documentation/git-replay.adoc

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ git-replay - EXPERIMENTAL: Replay commits on a new base, works with bare repos t
99
SYNOPSIS
1010
--------
1111
[verse]
12-
(EXPERIMENTAL!) 'git replay' ([--contained] --onto <newbase> | --advance <branch>) [--ref-action[=<mode>]] <revision-range>
12+
(EXPERIMENTAL!) 'git replay' ([--contained] --onto <newbase> | --advance <branch> | --revert <branch>) [--ref-action[=<mode>]] <revision-range>
1313

1414
DESCRIPTION
1515
-----------
@@ -42,6 +42,25 @@ The history is replayed on top of the <branch> and <branch> is updated to
4242
point at the tip of the resulting history. This is different from `--onto`,
4343
which uses the target only as a starting point without updating it.
4444

45+
--revert <branch>::
46+
Starting point at which to create the reverted commits; must be a
47+
branch name.
48+
+
49+
When `--revert` is specified, the commits in the revision range are reverted
50+
(their changes are undone) and the reverted commits are created on top of
51+
<branch>. The <branch> is then updated to point at the new commits. This is
52+
the same as running `git revert <revision-range>` but does not update the
53+
working tree.
54+
+
55+
The commit messages follow `git revert` conventions: they are prefixed with
56+
"Revert" and include "This reverts commit <hash>." When reverting a commit
57+
whose message starts with "Revert", the new message uses "Reapply" instead.
58+
Unlike cherry-pick which preserves the original author, revert commits use
59+
the current user as the author, matching the behavior of `git revert`.
60+
+
61+
This option is mutually exclusive with `--onto` and `--advance`. It is also
62+
incompatible with `--contained` (which is a modifier for `--onto` only).
63+
4564
--contained::
4665
Update all branches that point at commits in
4766
<revision-range>. Requires `--onto`.
@@ -60,10 +79,11 @@ The default mode can be configured via the `replay.refAction` configuration vari
6079

6180
<revision-range>::
6281
Range of commits to replay; see "Specifying Ranges" in
63-
linkgit:git-rev-parse[1]. In `--advance <branch>` mode, the
64-
range should have a single tip, so that it's clear to which tip the
65-
advanced <branch> should point. Any commits in the range whose
66-
changes are already present in the branch the commits are being
82+
linkgit:git-rev-parse[1]. In `--advance <branch>` or
83+
`--revert <branch>` mode, the range should have a single tip,
84+
so that it's clear to which tip the advanced or reverted
85+
<branch> should point. Any commits in the range whose changes
86+
are already present in the branch the commits are being
6787
replayed onto will be dropped.
6888

6989
:git-replay: 1
@@ -84,9 +104,10 @@ When using `--ref-action=print`, the output is usable as input to
84104
update refs/heads/branch3 ${NEW_branch3_HASH} ${OLD_branch3_HASH}
85105

86106
where the number of refs updated depends on the arguments passed and
87-
the shape of the history being replayed. When using `--advance`, the
88-
number of refs updated is always one, but for `--onto`, it can be one
89-
or more (rebasing multiple branches simultaneously is supported).
107+
the shape of the history being replayed. When using `--advance` or
108+
`--revert`, the number of refs updated is always one, but for `--onto`,
109+
it can be one or more (rebasing multiple branches simultaneously is
110+
supported).
90111

91112
There is no stderr output on conflicts; see the <<exit-status,EXIT
92113
STATUS>> section below.
@@ -152,6 +173,21 @@ all commits they have since `base`, playing them on top of
152173
`origin/main`. These three branches may have commits on top of `base`
153174
that they have in common, but that does not need to be the case.
154175

176+
To revert commits on a branch:
177+
178+
------------
179+
$ git replay --revert main topic~2..topic
180+
------------
181+
182+
This reverts the last two commits from `topic`, creating revert commits on
183+
top of `main`, and updates `main` to point at the result. This is useful when
184+
commits from `topic` were previously merged or cherry-picked into `main` and
185+
need to be undone.
186+
187+
NOTE: For reverting an entire merge request as a single commit (rather than
188+
commit-by-commit), consider using `git merge-tree --merge-base $TIP HEAD $BASE`
189+
which can avoid unnecessary merge conflicts.
190+
155191
GIT
156192
---
157193
Part of the linkgit:git[1] suite

Documentation/pretty-formats.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ The placeholders are:
253253
linkgit:git-rev-list[1])
254254
+%d+:: ref names, like the --decorate option of linkgit:git-log[1]
255255
+%D+:: ref names without the " (", ")" wrapping.
256+
+%(count)+:: the number of a patch within a patch series. Used only in
257+
`--commit-list-format` in `format-patch`
258+
+%(total)+:: the total number of patches in a patch series. Used only in
259+
`--commit-list-format` in `format-patch`
256260
++%(decorate++`[:<option>,...]`++)++::
257261
ref names with custom decorations. The `decorate` string may be followed by a
258262
colon and zero or more comma-separated options. Option values may contain

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,6 +2675,7 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
26752675

26762676
help.sp help.s help.o: command-list.h
26772677
builtin/bugreport.sp builtin/bugreport.s builtin/bugreport.o: hook-list.h
2678+
builtin/hook.sp builtin/hook.s builtin/hook.o: hook-list.h
26782679

26792680
builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
26802681
builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \

builtin/backfill.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct backfill_context {
3535
struct oid_array current_batch;
3636
size_t min_batch_size;
3737
int sparse;
38+
struct rev_info revs;
3839
};
3940

4041
static void backfill_context_clear(struct backfill_context *ctx)
@@ -79,7 +80,6 @@ static int fill_missing_blobs(const char *path UNUSED,
7980

8081
static int do_backfill(struct backfill_context *ctx)
8182
{
82-
struct rev_info revs;
8383
struct path_walk_info info = PATH_WALK_INFO_INIT;
8484
int ret;
8585

@@ -91,13 +91,14 @@ static int do_backfill(struct backfill_context *ctx)
9191
}
9292
}
9393

94-
repo_init_revisions(ctx->repo, &revs, "");
95-
handle_revision_arg("HEAD", &revs, 0, 0);
94+
/* Walk from HEAD if otherwise unspecified. */
95+
if (!ctx->revs.pending.nr)
96+
add_head_to_pending(&ctx->revs);
9697

9798
info.blobs = 1;
9899
info.tags = info.commits = info.trees = 0;
99100

100-
info.revs = &revs;
101+
info.revs = &ctx->revs;
101102
info.path_fn = fill_missing_blobs;
102103
info.path_fn_data = ctx;
103104

@@ -108,7 +109,6 @@ static int do_backfill(struct backfill_context *ctx)
108109
download_batch(ctx);
109110

110111
path_walk_info_clear(&info);
111-
release_revisions(&revs);
112112
return ret;
113113
}
114114

@@ -120,6 +120,7 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
120120
.current_batch = OID_ARRAY_INIT,
121121
.min_batch_size = 50000,
122122
.sparse = 0,
123+
.revs = REV_INFO_INIT,
123124
};
124125
struct option options[] = {
125126
OPT_UNSIGNED(0, "min-batch-size", &ctx.min_batch_size,
@@ -134,7 +135,15 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
134135
builtin_backfill_usage, options);
135136

136137
argc = parse_options(argc, argv, prefix, options, builtin_backfill_usage,
137-
0);
138+
PARSE_OPT_KEEP_UNKNOWN_OPT |
139+
PARSE_OPT_KEEP_ARGV0 |
140+
PARSE_OPT_KEEP_DASHDASH);
141+
142+
repo_init_revisions(repo, &ctx.revs, prefix);
143+
argc = setup_revisions(argc, argv, &ctx.revs, NULL);
144+
145+
if (argc > 1)
146+
die(_("unrecognized argument: %s"), argv[1]);
138147

139148
repo_config(repo, git_default_config, NULL);
140149

@@ -143,5 +152,6 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
143152

144153
result = do_backfill(&ctx);
145154
backfill_context_clear(&ctx);
155+
release_revisions(&ctx.revs);
146156
return result;
147157
}

0 commit comments

Comments
 (0)