Skip to content

Commit 14746d4

Browse files
authored
Prepare for v2.51.0(2) (#799)
This merges git-for-windows#5840, which I released on Monday, September 29th 2025, as Git for Windows v2.51.0(2). There have been quite a couple of merge conflicts, essentially because we picked up early versions of patches that were sent to the Git mailing list, and which had to undergo the usual process of mutations before being accepted. The only merge conflict that is in another category is that Git for Windows dropped monitoring the GnuPG versions in the `monitor-components` workflow, and `microsoft/git` still wants to delete that workflow lest it runs on a schedule and opens non-actionable work items.
2 parents 4b7e17a + 347996d commit 14746d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2059
-467
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
echo "skip_concurrent=$skip_concurrent" >>$GITHUB_OUTPUT
6464
- name: skip if the commit or tree was already tested
6565
id: skip-if-redundant
66-
uses: actions/github-script@v7
66+
uses: actions/github-script@v8
6767
if: steps.check-ref.outputs.enabled == 'yes'
6868
with:
6969
github-token: ${{secrets.GITHUB_TOKEN}}
@@ -262,7 +262,7 @@ jobs:
262262
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
263263
steps:
264264
- uses: actions/checkout@v5
265-
- uses: actions/setup-python@v5
265+
- uses: actions/setup-python@v6
266266
- name: Set up dependencies
267267
shell: pwsh
268268
run: pip install meson ninja
@@ -290,7 +290,7 @@ jobs:
290290
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
291291
steps:
292292
- uses: actions/checkout@v5
293-
- uses: actions/setup-python@v5
293+
- uses: actions/setup-python@v6
294294
- name: Set up dependencies
295295
shell: pwsh
296296
run: pip install meson ninja

Documentation/git-reflog.adoc

Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ git-reflog - Manage reflog information
88

99
SYNOPSIS
1010
--------
11-
[verse]
12-
'git reflog' [show] [<log-options>] [<ref>]
13-
'git reflog list'
14-
'git reflog expire' [--expire=<time>] [--expire-unreachable=<time>]
11+
[synopsis]
12+
git reflog [show] [<log-options>] [<ref>]
13+
git reflog list
14+
git reflog exists <ref>
15+
git reflog write <ref> <old-oid> <new-oid> <message>
16+
git reflog delete [--rewrite] [--updateref]
17+
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
18+
git reflog drop [--all [--single-worktree] | <refs>...]
19+
git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
1520
[--rewrite] [--updateref] [--stale-fix]
1621
[--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
17-
'git reflog delete' [--rewrite] [--updateref]
18-
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
19-
'git reflog drop' [--all [--single-worktree] | <refs>...]
20-
'git reflog exists' <ref>
2122

2223
DESCRIPTION
2324
-----------
@@ -43,11 +44,15 @@ actions, and in addition the `HEAD` reflog records branch switching.
4344

4445
The "list" subcommand lists all refs which have a corresponding reflog.
4546

46-
The "expire" subcommand prunes older reflog entries. Entries older
47-
than `expire` time, or entries older than `expire-unreachable` time
48-
and not reachable from the current tip, are removed from the reflog.
49-
This is typically not used directly by end users -- instead, see
50-
linkgit:git-gc[1].
47+
The "exists" subcommand checks whether a ref has a reflog. It exits
48+
with zero status if the reflog exists, and non-zero status if it does
49+
not.
50+
51+
The "write" subcommand writes a single entry to the reflog of a given
52+
reference. This new entry is appended to the reflog and will thus become
53+
the most recent entry. The reference name must be fully qualified. Both the old
54+
and new object IDs must not be abbreviated and must point to existing objects.
55+
The reflog message gets normalized.
5156

5257
The "delete" subcommand deletes single entries from the reflog, but
5358
not the reflog itself. Its argument must be an _exact_ entry (e.g. "`git
@@ -58,9 +63,11 @@ The "drop" subcommand completely removes the reflog for the specified
5863
references. This is in contrast to "expire" and "delete", both of which
5964
can be used to delete reflog entries, but not the reflog itself.
6065

61-
The "exists" subcommand checks whether a ref has a reflog. It exits
62-
with zero status if the reflog exists, and non-zero status if it does
63-
not.
66+
The "expire" subcommand prunes older reflog entries. Entries older
67+
than `expire` time, or entries older than `expire-unreachable` time
68+
and not reachable from the current tip, are removed from the reflog.
69+
This is typically not used directly by end users -- instead, see
70+
linkgit:git-gc[1].
6471

6572
OPTIONS
6673
-------
@@ -71,26 +78,45 @@ Options for `show`
7178
`git reflog show` accepts any of the options accepted by `git log`.
7279

7380

81+
Options for `delete`
82+
~~~~~~~~~~~~~~~~~~~~
83+
84+
`git reflog delete` accepts options `--updateref`, `--rewrite`, `-n`,
85+
`--dry-run`, and `--verbose`, with the same meanings as when they are
86+
used with `expire`.
87+
88+
Options for `drop`
89+
~~~~~~~~~~~~~~~~~~
90+
91+
`--all`::
92+
Drop the reflogs of all references from all worktrees.
93+
94+
`--single-worktree`::
95+
By default when `--all` is specified, reflogs from all working
96+
trees are dropped. This option limits the processing to reflogs
97+
from the current working tree only.
98+
99+
74100
Options for `expire`
75101
~~~~~~~~~~~~~~~~~~~~
76102

77-
--all::
103+
`--all`::
78104
Process the reflogs of all references.
79105

80-
--single-worktree::
106+
`--single-worktree`::
81107
By default when `--all` is specified, reflogs from all working
82108
trees are processed. This option limits the processing to reflogs
83109
from the current working tree only.
84110

85-
--expire=<time>::
111+
`--expire=<time>`::
86112
Prune entries older than the specified time. If this option is
87113
not specified, the expiration time is taken from the
88114
configuration setting `gc.reflogExpire`, which in turn
89115
defaults to 90 days. `--expire=all` prunes entries regardless
90116
of their age; `--expire=never` turns off pruning of reachable
91117
entries (but see `--expire-unreachable`).
92118

93-
--expire-unreachable=<time>::
119+
`--expire-unreachable=<time>`::
94120
Prune entries older than `<time>` that are not reachable from
95121
the current tip of the branch. If this option is not
96122
specified, the expiration time is taken from the configuration
@@ -100,17 +126,17 @@ Options for `expire`
100126
turns off early pruning of unreachable entries (but see
101127
`--expire`).
102128

103-
--updateref::
129+
`--updateref`::
104130
Update the reference to the value of the top reflog entry (i.e.
105131
<ref>@\{0\}) if the previous top entry was pruned. (This
106132
option is ignored for symbolic references.)
107133

108-
--rewrite::
134+
`--rewrite`::
109135
If a reflog entry's predecessor is pruned, adjust its "old"
110136
SHA-1 to be equal to the "new" SHA-1 field of the entry that
111137
now precedes it.
112138

113-
--stale-fix::
139+
`--stale-fix`::
114140
Prune any reflog entries that point to "broken commits". A
115141
broken commit is a commit that is not reachable from any of
116142
the reference tips and that refers, directly or indirectly, to
@@ -121,33 +147,15 @@ has the same cost as 'git prune'. It is primarily intended to fix
121147
corruption caused by garbage collecting using older versions of Git,
122148
which didn't protect objects referred to by reflogs.
123149

124-
-n::
125-
--dry-run::
150+
`-n`::
151+
`--dry-run`::
126152
Do not actually prune any entries; just show what would have
127153
been pruned.
128154

129-
--verbose::
155+
`--verbose`::
130156
Print extra information on screen.
131157

132158

133-
Options for `delete`
134-
~~~~~~~~~~~~~~~~~~~~
135-
136-
`git reflog delete` accepts options `--updateref`, `--rewrite`, `-n`,
137-
`--dry-run`, and `--verbose`, with the same meanings as when they are
138-
used with `expire`.
139-
140-
Options for `drop`
141-
~~~~~~~~~~~~~~~~~~
142-
143-
--all::
144-
Drop the reflogs of all references from all worktrees.
145-
146-
--single-worktree::
147-
By default when `--all` is specified, reflogs from all working
148-
trees are dropped. This option limits the processing to reflogs
149-
from the current working tree only.
150-
151159
GIT
152160
---
153161
Part of the linkgit:git[1] suite

Documentation/git-sparse-checkout.adoc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,21 @@ to change which sparsity mode you are using without needing to also respecify
112112
all sparsity paths.
113113

114114
'clean'::
115-
Remove all files in tracked directories that are outside of the
116-
sparse-checkout definition. This subcommand requires cone-mode
117-
sparse-checkout to be sure that we know which directories are
118-
both tracked and all contained paths are not in the sparse-checkout.
119-
This command can be used to be sure the sparse index works
120-
efficiently, though it does not require enabling the sparse index
121-
feature via the `index.sparse=true` configuration.
115+
Opportunistically remove files outside of the sparse-checkout
116+
definition. This command requires cone mode to use recursive
117+
directory matches to determine which files should be removed. A
118+
file is considered for removal if it is contained within a tracked
119+
directory that is outside of the sparse-checkout definition.
120+
+
121+
Some special cases, such as merge conflicts or modified files outside of
122+
the sparse-checkout definition could lead to keeping files that would
123+
otherwise be removed. Resolve conflicts, stage modifications, and use
124+
`git sparse-checkout reapply` in conjunction with `git sparse-checkout
125+
clean` to resolve these cases.
126+
+
127+
This command can be used to be sure the sparse index works efficiently,
128+
though it does not require enabling the sparse index feature via the
129+
`index.sparse=true` configuration.
122130
+
123131
To prevent accidental deletion of worktree files, the `clean` subcommand
124132
will not delete any files without the `-f` or `--force` option, unless

add-interactive.c

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
#include "prompt.h"
2121
#include "tree.h"
2222

23-
static void init_color(struct repository *r, struct add_i_state *s,
23+
static void init_color(struct repository *r, int use_color,
2424
const char *section_and_slot, char *dst,
2525
const char *default_color)
2626
{
2727
char *key = xstrfmt("color.%s", section_and_slot);
2828
const char *value;
2929

30-
if (!s->use_color)
30+
if (!use_color)
3131
dst[0] = '\0';
3232
else if (repo_config_get_value(r, key, &value) ||
3333
color_parse(value, dst))
@@ -36,42 +36,63 @@ static void init_color(struct repository *r, struct add_i_state *s,
3636
free(key);
3737
}
3838

39-
void init_add_i_state(struct add_i_state *s, struct repository *r,
40-
struct add_p_opt *add_p_opt)
39+
static int check_color_config(struct repository *r, const char *var)
4140
{
4241
const char *value;
42+
int ret;
43+
44+
if (repo_config_get_value(r, var, &value))
45+
ret = -1;
46+
else
47+
ret = git_config_colorbool(var, value);
48+
49+
/*
50+
* Do not rely on want_color() to fall back to color.ui for us. It uses
51+
* the value parsed by git_color_config(), which may not have been
52+
* called by the main command.
53+
*/
54+
if (ret < 0 && !repo_config_get_value(r, "color.ui", &value))
55+
ret = git_config_colorbool("color.ui", value);
4356

57+
return want_color(ret);
58+
}
59+
60+
void init_add_i_state(struct add_i_state *s, struct repository *r,
61+
struct add_p_opt *add_p_opt)
62+
{
4463
s->r = r;
4564
s->context = -1;
4665
s->interhunkcontext = -1;
4766

48-
if (repo_config_get_value(r, "color.interactive", &value))
49-
s->use_color = -1;
50-
else
51-
s->use_color =
52-
git_config_colorbool("color.interactive", value);
53-
s->use_color = want_color(s->use_color);
54-
55-
init_color(r, s, "interactive.header", s->header_color, GIT_COLOR_BOLD);
56-
init_color(r, s, "interactive.help", s->help_color, GIT_COLOR_BOLD_RED);
57-
init_color(r, s, "interactive.prompt", s->prompt_color,
58-
GIT_COLOR_BOLD_BLUE);
59-
init_color(r, s, "interactive.error", s->error_color,
60-
GIT_COLOR_BOLD_RED);
61-
62-
init_color(r, s, "diff.frag", s->fraginfo_color,
63-
diff_get_color(s->use_color, DIFF_FRAGINFO));
64-
init_color(r, s, "diff.context", s->context_color, "fall back");
67+
s->use_color_interactive = check_color_config(r, "color.interactive");
68+
69+
init_color(r, s->use_color_interactive, "interactive.header",
70+
s->header_color, GIT_COLOR_BOLD);
71+
init_color(r, s->use_color_interactive, "interactive.help",
72+
s->help_color, GIT_COLOR_BOLD_RED);
73+
init_color(r, s->use_color_interactive, "interactive.prompt",
74+
s->prompt_color, GIT_COLOR_BOLD_BLUE);
75+
init_color(r, s->use_color_interactive, "interactive.error",
76+
s->error_color, GIT_COLOR_BOLD_RED);
77+
strlcpy(s->reset_color_interactive,
78+
s->use_color_interactive ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
79+
80+
s->use_color_diff = check_color_config(r, "color.diff");
81+
82+
init_color(r, s->use_color_diff, "diff.frag", s->fraginfo_color,
83+
diff_get_color(s->use_color_diff, DIFF_FRAGINFO));
84+
init_color(r, s->use_color_diff, "diff.context", s->context_color,
85+
"fall back");
6586
if (!strcmp(s->context_color, "fall back"))
66-
init_color(r, s, "diff.plain", s->context_color,
67-
diff_get_color(s->use_color, DIFF_CONTEXT));
68-
init_color(r, s, "diff.old", s->file_old_color,
69-
diff_get_color(s->use_color, DIFF_FILE_OLD));
70-
init_color(r, s, "diff.new", s->file_new_color,
71-
diff_get_color(s->use_color, DIFF_FILE_NEW));
72-
73-
strlcpy(s->reset_color,
74-
s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
87+
init_color(r, s->use_color_diff, "diff.plain",
88+
s->context_color,
89+
diff_get_color(s->use_color_diff, DIFF_CONTEXT));
90+
init_color(r, s->use_color_diff, "diff.old", s->file_old_color,
91+
diff_get_color(s->use_color_diff, DIFF_FILE_OLD));
92+
init_color(r, s->use_color_diff, "diff.new", s->file_new_color,
93+
diff_get_color(s->use_color_diff, DIFF_FILE_NEW));
94+
strlcpy(s->reset_color_diff,
95+
s->use_color_diff ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
7596

7697
FREE_AND_NULL(s->interactive_diff_filter);
7798
repo_config_get_string(r, "interactive.difffilter",
@@ -109,7 +130,8 @@ void clear_add_i_state(struct add_i_state *s)
109130
FREE_AND_NULL(s->interactive_diff_filter);
110131
FREE_AND_NULL(s->interactive_diff_algorithm);
111132
memset(s, 0, sizeof(*s));
112-
s->use_color = -1;
133+
s->use_color_interactive = -1;
134+
s->use_color_diff = -1;
113135
}
114136

115137
/*
@@ -1188,9 +1210,9 @@ int run_add_i(struct repository *r, const struct pathspec *ps,
11881210
* When color was asked for, use the prompt color for
11891211
* highlighting, otherwise use square brackets.
11901212
*/
1191-
if (s.use_color) {
1213+
if (s.use_color_interactive) {
11921214
data.color = s.prompt_color;
1193-
data.reset = s.reset_color;
1215+
data.reset = s.reset_color_interactive;
11941216
}
11951217
print_file_item_data.color = data.color;
11961218
print_file_item_data.reset = data.reset;

add-interactive.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ struct add_p_opt {
1212

1313
struct add_i_state {
1414
struct repository *r;
15-
int use_color;
15+
int use_color_interactive;
16+
int use_color_diff;
1617
char header_color[COLOR_MAXLEN];
1718
char help_color[COLOR_MAXLEN];
1819
char prompt_color[COLOR_MAXLEN];
1920
char error_color[COLOR_MAXLEN];
20-
char reset_color[COLOR_MAXLEN];
21+
char reset_color_interactive[COLOR_MAXLEN];
22+
2123
char fraginfo_color[COLOR_MAXLEN];
2224
char context_color[COLOR_MAXLEN];
2325
char file_old_color[COLOR_MAXLEN];
2426
char file_new_color[COLOR_MAXLEN];
27+
char reset_color_diff[COLOR_MAXLEN];
2528

2629
int use_single_key;
2730
char *interactive_diff_filter, *interactive_diff_algorithm;

0 commit comments

Comments
 (0)