Skip to content

Commit 161a503

Browse files
authored
Merge branch 'git:master' into master
2 parents 22c090f + a97fcc3 commit 161a503

151 files changed

Lines changed: 4257 additions & 1169 deletions

File tree

Some content is hidden

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

Documentation/RelNotes/2.56.0.adoc

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ UI, Workflows & Features
5656
standardized to make them consistent with each other and with other
5757
commands.
5858

59+
* 'git log --graph' has been modified to visually distinguish parentless
60+
'root' commits (and commits that become roots due to history
61+
simplification) by indenting them, preventing them from appearing
62+
falsely related to unrelated commits rendered immediately above them.
63+
64+
* Userdiff patterns for Swift have been added, with support for
65+
Swift-specific constructs such as attributes, modifiers, failable
66+
initializers, and generics.
67+
68+
* Configuration file locking has been updated to retry for a short
69+
period, avoiding failures when multiple processes attempt to update
70+
the configuration simultaneously.
71+
72+
* The 'remote-object-info' command has been added to 'git cat-file
73+
--batch-command', allowing clients to request object metadata
74+
(currently size) from a remote server via protocol v2 without
75+
downloading the entire object. Format placeholders are dynamically
76+
filtered on the client based on server-advertised capabilities,
77+
returning empty strings for inapplicable or unsupported fields.
78+
5979

6080
Performance, Internal Implementation, Development Support etc.
6181
--------------------------------------------------------------
@@ -206,6 +226,60 @@ Performance, Internal Implementation, Development Support etc.
206226
pathspec filtering, which was lost when the streaming walk was
207227
refactored.
208228
229+
* The ref subsystem and the worktree API have been refactored to pass a
230+
repository pointer down the call chain, allowing them to drop
231+
references to the global 'the_repository' variable. As part of this,
232+
the handling of the 'core.packedRefsTimeout' configuration has been
233+
moved into the per-repository ref store structure.
234+
235+
* 'git branch --contains' and 'git for-each-ref --contains' have been
236+
optimized to use the memoized commit traversal previously used only by
237+
'git tag --contains', significantly speeding up connectivity checks
238+
across many candidate refs with shared history.
239+
240+
* The passing of push destination specifications in the 'remote-curl'
241+
helper has been simplified by removing the explicit 'count' parameter
242+
and relying on the NULL-termination of the array.
243+
244+
* The dependency on the global 'the_repository' variable in the
245+
'refspec.c' API has been removed by passing the hash algorithm
246+
explicitly to refspec-parsing functions and storing it in 'struct
247+
refspec'.
248+
249+
* The enumeration of untracked and ignored files in 'git status' has
250+
been optimized by avoiding quadratic complexity when inserting into
251+
string lists, reducing the construction cost from O(n^2) to O(n log
252+
n).
253+
254+
* The copy_file() and copy_file_with_time() functions have been
255+
refactored to take a repository parameter, allowing the removal of the
256+
implicit dependency on the global 'the_repository' variable in
257+
'copy.c'.
258+
259+
* The tempfile and lockfile APIs have been refactored to stop depending
260+
on the 'the_repository' global variable, and their callers have been
261+
updated to use the repository-aware variants.
262+
263+
* The 'trust_executable_bit' (coming from the 'core.filemode'
264+
configuration) has been migrated into 'struct repo_config_values' to
265+
tie it to a specific repository instance.
266+
267+
* The 'excludes_file' and various other global configuration variables
268+
(including 'editor_program', 'pager_program', 'askpass_program', and
269+
'push_default') have been migrated into the per-repository structure.
270+
271+
* The 'git stash push' command has been optimized to avoid unnecessary
272+
sparse index expansion when pathspecs are wholly inside the
273+
sparse-checkout cone. Also, a potential out-of-bounds read in the
274+
sparse-index expansion check helper pathspec_needs_expanded_index()
275+
has been fixed by consistently using the parsed, prefixed path.
276+
277+
* The logic to write loose objects has been refactored and moved from
278+
'object-file.c' to the loose backend source file 'odb/source-loose.c',
279+
making the loose backend more self-contained. This is achieved by
280+
first refactoring force_object_loose() to use generic ODB write
281+
interfaces instead of loose-backend internals.
282+
209283
210284
Fixes since v2.55
211285
-----------------
@@ -350,3 +424,24 @@ Fixes since v2.55
350424
'git submodule update' command until it was broken in a modernization
351425
of the option-parsing code, has been restored.
352426
(merge ff1da37f58 dm/submodule-update-i-shorthand later to maint).
427+
428+
* An accidental use of the '%zu' format specifier in 'git
429+
submodule--helper' has been corrected to use 'PRIuMAX' and cast the
430+
value to 'uintmax_t' to avoid portability issues.
431+
(merge 3279c13c00 jc/submodule-helper-avoid-zu later to maint).
432+
433+
* The rebase post-rewrite notes-copying logic has been corrected. When
434+
a commit is dropped during rebase (e.g., because its changes are
435+
already upstream), it is no longer recorded as rewritten, preventing
436+
its notes from being copied to an unrelated commit.
437+
(merge 42554b78fd pw/rebase-drop-notes-with-commit later to maint).
438+
439+
* A few memory problems in the Rust interface to C hash functions have
440+
been corrected. The 'Clone' implementation of 'CryptoHasher' now
441+
properly initializes the context before cloning, and its 'Drop'
442+
implementation now discards the context to prevent leaks.
443+
444+
* The object ID shortening and linking in the 'commitdiff' view of
445+
'gitweb' has been corrected to work even when the index line carries
446+
a trailing file mode.
447+
(merge fda513d6fe tl/gitweb-shorten-hashes-with-modes later to maint).

Documentation/config/core.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,14 @@ core.packedRefsTimeout::
589589
all; -1 means to try indefinitely. Default is 1000 (i.e.,
590590
retry for 1 second).
591591

592+
core.configLockTimeout::
593+
The length of time, in milliseconds, to retry when trying to
594+
lock a configuration file for writing. Value 0 means not to
595+
retry at all; -1 means to try indefinitely. Default is 1000
596+
(i.e., retry for 1 second). This is read from the configuration
597+
that is already on disk before the lock is taken, so it can be
598+
set persistently like any other option.
599+
592600
core.pager::
593601
Text viewer for use by Git commands (e.g., 'less'). The value
594602
is meant to be interpreted by the shell. The order of preference

Documentation/config/log.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ This is the same as the `--decorate` option of the `git log`.
5959
A list of colors, separated by commas, that can be used to draw
6060
history lines in `git log --graph`.
6161

62+
`log.graphIndent`::
63+
If `true`, indent visual roots when rendering the graphs with `--graph`.
64+
Set true by default. It can be overriden with `--[no-]graph-indent`.
65+
6266
`log.showRoot`::
6367
If true, the initial commit will be shown as a big creation event.
6468
This is equivalent to a diff against an empty tree.

Documentation/git-cat-file.adoc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ info <object>::
169169
Print object info for object reference `<object>`. This corresponds to the
170170
output of `--batch-check`.
171171

172+
remote-object-info <remote> <object>...::
173+
Print object info for object references `<object>` at specified
174+
`<remote>` without downloading objects from the remote.
175+
Raise an error when the `object-info` capability is not supported by the remote.
176+
Raise an error when no object references are provided.
177+
This command may be combined with `--buffer`.
178+
172179
flush::
173180
Used with `--buffer` to execute all preceding commands that were issued
174181
since the beginning or since the last flush was issued. When `--buffer`
@@ -301,7 +308,8 @@ one per line, and print information based on the command given. With
301308
`--batch-command`, the `info` command followed by an object will print
302309
information about the object the same way `--batch-check` would, and the
303310
`contents` command followed by an object prints contents in the same way
304-
`--batch` would.
311+
`--batch` would. The `remote-object-info` command followed by a remote and
312+
object IDs prints object info from the remote without downloading the objects.
305313

306314
You can specify the information shown for each object by using a custom
307315
`<format>`. The `<format>` is copied literally to stdout for each
@@ -340,8 +348,15 @@ newline. The available atoms are:
340348
after that first run of whitespace (i.e., the "rest" of the
341349
line) are output in place of the `%(rest)` atom.
342350

351+
The command `remote-object-info` only supports the `%(objectname)` and
352+
`%(objectsize)` placeholders. See `CAVEATS` below for more information.
353+
343354
If no format is specified, the default format is `%(objectname)
344-
%(objecttype) %(objectsize)`.
355+
%(objecttype) %(objectsize)`, except for `remote-object-info` commands which
356+
use `%(objectname) %(objectsize)` because `%(objecttype)` is not supported yet.
357+
358+
WARNING: When "%(objecttype)" is supported, the default format WILL be unified,
359+
so DO NOT RELY on the current default format to stay the same!!!
345360

346361
If `--batch` is specified, or if `--batch-command` is used with the `contents`
347362
command, the object information is followed by the object contents (consisting
@@ -438,6 +453,10 @@ scripting purposes.
438453
CAVEATS
439454
-------
440455
456+
Note that only `%(objectname)` and `%(objectsize)` are currently
457+
supported by the `remote-object-info` command. Using any other placeholder in
458+
the format string will return an empty string in its position.
459+
441460
Note that the sizes of objects on disk are reported accurately, but care
442461
should be taken in drawing conclusions about which refs or objects are
443462
responsible for disk usage. The size of a packed non-delta object may be

Documentation/gitattributes.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,8 @@ patterns are available:
914914
- `scheme` suitable for source code in most Lisp dialects,
915915
including Scheme, Emacs Lisp, Common Lisp, and Clojure.
916916

917+
- `swift` suitable for source code in the Swift language.
918+
917919
- `tex` suitable for source code for LaTeX documents.
918920

919921

Documentation/gitprotocol-v2.adoc

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -568,21 +568,26 @@ An `object-info` request takes the following arguments:
568568
569569
oid <oid>
570570
Indicates to the server an object which the client wants to obtain
571-
information for.
571+
information for. They must be full OIDs.
572572
573-
The response of `object-info` is a list of the requested object ids
574-
and associated requested information, each separated by a single space.
573+
The response of `object-info` consists of one pkt-line per requested attribute,
574+
echoing the attributes the server will report, followed by one pkt-line per
575+
requested object id with its information, each field separated by a single
576+
space.
575577
576578
output = info flush-pkt
577579
578-
info = PKT-LINE(attrs) LF)
579-
*PKT-LINE(obj-info LF)
580-
581-
attrs = attr | attrs SP attrs
580+
info = *PKT-LINE(attr LF)
581+
*PKT-LINE(obj-info LF)
582582
583583
attr = "size"
584584
585-
obj-info = obj-id SP obj-size
585+
obj-size = 1*DIGIT
586+
587+
obj-info = obj-id [SP [obj-size]]
588+
589+
If the server does not recognize the OID, the response will be `<oid> SP`
590+
regardless of the number of attributes requested.
586591
587592
bundle-uri
588593
~~~~~~~~~~

Documentation/rev-list-options.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,14 @@ This implies the `--topo-order` option by default, but the
12691269
By default it is set to 0 (no limit), zero and negative values
12701270
are ignored and treated as no limit.
12711271

1272+
`--no-graph-indent`::
1273+
`--graph-indent`::
1274+
When used with `--graph`, indent visual roots (commits with no parents
1275+
or whose parents are not shown) to differentiate them from commits that
1276+
are vertically adjacent but unrelated. Enabled by default. Use
1277+
`--no-graph-indent` to disable or set `log.graphIndent` to set a
1278+
default preference.
1279+
12721280
ifdef::git-rev-list[]
12731281
`--count`::
12741282
Print a number stating how many commits would have been

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,7 @@ LIB_OBJS += ewah/ewah_io.o
11691169
LIB_OBJS += ewah/ewah_rlw.o
11701170
LIB_OBJS += exec-cmd.o
11711171
LIB_OBJS += fetch-negotiator.o
1172+
LIB_OBJS += fetch-object-info.o
11721173
LIB_OBJS += fetch-pack.o
11731174
LIB_OBJS += fmt-merge-msg.o
11741175
LIB_OBJS += fsck.o

apply.c

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ struct gitdiff_data {
4747
int p_value;
4848
};
4949

50-
static void git_apply_config(void)
50+
static void git_apply_config(struct repository *repo)
5151
{
52-
repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace);
53-
repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace);
54-
repo_config(the_repository, git_xmerge_config, NULL);
52+
struct repo_config_values *cfg = repo_config_values(repo);
53+
54+
FREE_AND_NULL(cfg->apply_default_whitespace);
55+
repo_config_get_string(repo, "apply.whitespace",
56+
&cfg->apply_default_whitespace);
57+
FREE_AND_NULL(cfg->apply_default_ignorewhitespace);
58+
repo_config_get_string(repo, "apply.ignorewhitespace",
59+
&cfg->apply_default_ignorewhitespace);
60+
repo_config(repo, git_xmerge_config, NULL);
5561
}
5662

5763
static int parse_whitespace_option(struct apply_state *state, const char *option)
@@ -109,6 +115,8 @@ int init_apply_state(struct apply_state *state,
109115
struct repository *repo,
110116
const char *prefix)
111117
{
118+
struct repo_config_values *cfg = repo_config_values(repo);
119+
112120
memset(state, 0, sizeof(*state));
113121
state->prefix = prefix;
114122
state->repo = repo;
@@ -126,10 +134,13 @@ int init_apply_state(struct apply_state *state,
126134
strset_init(&state->kept_symlinks);
127135
strbuf_init(&state->root, 0);
128136

129-
git_apply_config();
130-
if (apply_default_whitespace && parse_whitespace_option(state, apply_default_whitespace))
137+
git_apply_config(repo);
138+
139+
if (cfg->apply_default_whitespace &&
140+
parse_whitespace_option(state, cfg->apply_default_whitespace))
131141
return -1;
132-
if (apply_default_ignorewhitespace && parse_ignorewhitespace_option(state, apply_default_ignorewhitespace))
142+
if (cfg->apply_default_ignorewhitespace &&
143+
parse_ignorewhitespace_option(state, cfg->apply_default_ignorewhitespace))
133144
return -1;
134145
return 0;
135146
}
@@ -192,7 +203,8 @@ int check_apply_state(struct apply_state *state, int force_apply)
192203

193204
static void set_default_whitespace_mode(struct apply_state *state)
194205
{
195-
if (!state->whitespace_option && !apply_default_whitespace)
206+
if (!state->whitespace_option &&
207+
!repo_config_values(state->repo)->apply_default_whitespace)
196208
state->ws_error_action = (state->apply ? warn_on_ws_error : nowarn_ws_error);
197209
}
198210

@@ -3893,8 +3905,8 @@ static int check_preimage(struct apply_state *state,
38933905
if (*ce && !(*ce)->ce_mode)
38943906
BUG("ce_mode == 0 for path '%s'", old_name);
38953907

3896-
if (trust_executable_bit || !S_ISREG(st->st_mode))
3897-
st_mode = ce_mode_from_stat(*ce, st->st_mode);
3908+
if (repo_trust_executable_bit(state->repo) || !S_ISREG(st->st_mode))
3909+
st_mode = ce_mode_from_stat(state->repo, *ce, st->st_mode);
38983910
else if (*ce)
38993911
st_mode = (*ce)->ce_mode;
39003912
else
@@ -4287,7 +4299,8 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
42874299
}
42884300
}
42894301

4290-
hold_lock_file_for_update(&lock, state->fake_ancestor, LOCK_DIE_ON_ERROR);
4302+
repo_hold_lock_file_for_update(state->repo, &lock, state->fake_ancestor,
4303+
LOCK_DIE_ON_ERROR);
42914304
res = write_locked_index(&result, &lock, COMMIT_LOCK);
42924305
discard_index(&result);
42934306

@@ -4511,7 +4524,7 @@ static int try_create_file(struct apply_state *state, const char *path,
45114524
return !!mkdir(path, 0777);
45124525
}
45134526

4514-
if (has_symlinks && S_ISLNK(mode))
4527+
if (repo_has_symlinks(state->repo) && S_ISLNK(mode))
45154528
/* Although buf:size is counted string, it also is NUL
45164529
* terminated.
45174530
*/
@@ -4945,9 +4958,10 @@ static int apply_patch(struct apply_state *state,
49454958
state->update_index = (state->check_index || state->ita_only) && state->apply;
49464959
if (state->update_index && !is_lock_file_locked(&state->lock_file)) {
49474960
if (state->index_file)
4948-
hold_lock_file_for_update(&state->lock_file,
4949-
state->index_file,
4950-
LOCK_DIE_ON_ERROR);
4961+
repo_hold_lock_file_for_update(state->repo,
4962+
&state->lock_file,
4963+
state->index_file,
4964+
LOCK_DIE_ON_ERROR);
49514965
else
49524966
repo_hold_locked_index(state->repo, &state->lock_file,
49534967
LOCK_DIE_ON_ERROR);

branch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int find_tracked_branch(struct remote *remote, void *priv)
6161

6262
static int should_setup_rebase(const char *origin)
6363
{
64-
switch (autorebase) {
64+
switch (repo_config_values(the_repository)->autorebase) {
6565
case AUTOREBASE_NEVER:
6666
return 0;
6767
case AUTOREBASE_LOCAL:
@@ -372,7 +372,7 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)
372372
*/
373373
int validate_branchname(const char *name, struct strbuf *ref)
374374
{
375-
if (check_branch_ref(ref, name)) {
375+
if (check_branch_ref(the_repository, ref, name)) {
376376
int code = die_message(_("'%s' is not a valid branch name"), name);
377377
advise_if_enabled(ADVICE_REF_SYNTAX,
378378
_("See 'git help check-ref-format'"));
@@ -394,7 +394,7 @@ static void prepare_checked_out_branches(void)
394394
return;
395395
initialized_checked_out_branches = 1;
396396

397-
worktrees = get_worktrees();
397+
worktrees = get_worktrees(the_repository);
398398

399399
while (worktrees[i]) {
400400
char *old, *wt_gitdir;
@@ -846,7 +846,7 @@ void remove_branch_state(struct repository *r, int verbose)
846846

847847
void die_if_checked_out(const char *branch, int ignore_current_worktree)
848848
{
849-
struct worktree **worktrees = get_worktrees();
849+
struct worktree **worktrees = get_worktrees(the_repository);
850850

851851
for (int i = 0; worktrees[i]; i++) {
852852
if (worktrees[i]->is_current && ignore_current_worktree)

0 commit comments

Comments
 (0)