Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c8f660a
Merge branch 'lo/repo-info' into lo/repo-info-step-2
gitster Aug 21, 2025
9851830
bulk-checkin: introduce object database transaction structure
jltobler Aug 22, 2025
b336144
bulk-checkin: remove global transaction state
jltobler Aug 22, 2025
aa4d81b
bulk-checkin: require transaction for index_blob_bulk_checkin()
jltobler Aug 22, 2025
ddc0b56
bulk-checkin: use repository variable from transaction
jltobler Aug 22, 2025
bf5c224
docs: fix typo in worktree.adoc 'extension'
M-L-Ml Sep 3, 2025
a92f5ca
repo: add the flag -z as an alias for --format=nul
lucasoshiro Sep 4, 2025
c2e3713
repo: add the field objects.format
lucasoshiro Sep 4, 2025
069c15d
object-name: declare pointer type of extend_abbrev_len()'s 2nd parameter
rscharfe Sep 4, 2025
c9388d9
midx-write: only load initialized packs
derrickstolee Sep 5, 2025
3a45c7b
midx-write: put failing response value back
derrickstolee Sep 5, 2025
9c2262d
midx-write: use cleanup when incremental midx fails
derrickstolee Sep 5, 2025
68383ac
midx-write: use uint32_t for preferred_pack_idx
derrickstolee Sep 5, 2025
1f2bc6b
midx-write: reenable signed comparison errors
derrickstolee Sep 5, 2025
c25651a
midx-write: simplify error cases
derrickstolee Sep 5, 2025
7a57fb1
t5530: modernize tests
pks-t Sep 5, 2025
88a2dc6
upload-pack: don't ACK non-commits repeatedly in protocol v2
pks-t Sep 5, 2025
7d00521
Merge branch 'jt/de-global-bulk-checkin'
gitster Sep 15, 2025
13d1e86
Merge branch 'lo/repo-info-step-2'
gitster Sep 15, 2025
e18e761
Merge branch 'ds/midx-write-fixes'
gitster Sep 15, 2025
a93ec6d
Merge branch 'ps/upload-pack-oom-protection'
gitster Sep 15, 2025
5fe4f63
Merge branch 'rs/object-name-extend-abbrev-len-update'
gitster Sep 15, 2025
0e3aa6a
Merge branch 'mm/worktree-doc-typofix'
gitster Sep 15, 2025
a483264
The ninth batch
gitster Sep 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Documentation/RelNotes/2.52.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ UI, Workflows & Features
* "git refs exists" that works like "git show-ref --exists" has been
added.

* "repo info" learns a short-hand option "-z" that is the same as
"--format=nul", and learns to report the objects format used in the
repository.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -55,6 +59,10 @@ Performance, Internal Implementation, Development Support etc.
which items are still on the queue (an unacceptable alternative is
to reserve one object flag bits).

* The bulk-checkin code used to depend on a file-scope static
singleton variable, which has been updated to pass an instance
throughout the callchain.


Fixes since v2.51
-----------------
Expand Down Expand Up @@ -164,6 +172,11 @@ including security updates, are included in this release.
which has been disabled in Gitlab CI.
(merge 608cf5b793 ps/gitlab-ci-disable-windows-monitoring later to maint).

* A broken or malicious "git fetch" can say that it has the same
object for many many times, and the upload-pack serving it can
exhaust memory storing them redundantly, which has been corrected.
(merge 88a2dc68c8 ps/upload-pack-oom-protection later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge 823d537fa7 kh/doc-git-log-markup-fix later to maint).
(merge cf7efa4f33 rj/t6137-cygwin-fix later to maint).
Expand All @@ -182,3 +195,6 @@ including security updates, are included in this release.
(merge 2f4bf83ffc km/alias-doc-markup-fix later to maint).
(merge b0d97aac19 kh/doc-markup-fixes later to maint).
(merge f9a6705d9a tc/t0450-harden later to maint).
(merge c25651aefd ds/midx-write-fixes later to maint).
(merge 069c15d256 rs/object-name-extend-abbrev-len-update later to maint).
(merge bf5c224537 mm/worktree-doc-typofix later to maint).
2 changes: 1 addition & 1 deletion Documentation/config/worktree.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ worktree.useRelativePaths::
different locations or environments. Defaults to "false".
+
Note that setting `worktree.useRelativePaths` to "true" implies enabling the
`extension.relativeWorktrees` config (see linkgit:git-config[1]),
`extensions.relativeWorktrees` config (see linkgit:git-config[1]),
thus making it incompatible with older versions of Git.
9 changes: 7 additions & 2 deletions Documentation/git-repo.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-repo - Retrieve information about the repository
SYNOPSIS
--------
[synopsis]
git repo info [--format=(keyvalue|nul)] [<key>...]
git repo info [--format=(keyvalue|nul)] [-z] [<key>...]

DESCRIPTION
-----------
Expand All @@ -18,7 +18,7 @@ THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.

COMMANDS
--------
`info [--format=(keyvalue|nul)] [<key>...]`::
`info [--format=(keyvalue|nul)] [-z] [<key>...]`::
Retrieve metadata-related information about the current repository. Only
the requested data will be returned based on their keys (see "INFO KEYS"
section below).
Expand All @@ -40,6 +40,8 @@ supported:
between the key and the value and using a NUL character after each value.
This format is better suited for being parsed by another applications than
`keyvalue`. Unlike in the `keyvalue` format, the values are never quoted.
+
`-z` is an alias for `--format=nul`.

INFO KEYS
---------
Expand All @@ -53,6 +55,9 @@ values that they return:
`layout.shallow`::
`true` if this is a shallow repository, otherwise `false`.

`object.format`::
The object format (hash algorithm) used in the repository.

`references.format`::
The reference storage format. The valid values are:
+
Expand Down
5 changes: 3 additions & 2 deletions builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ int cmd_add(int argc,
char *seen = NULL;
char *ps_matched = NULL;
struct lock_file lock_file = LOCK_INIT;
struct odb_transaction *transaction;

repo_config(repo, add_config, NULL);

Expand Down Expand Up @@ -574,7 +575,7 @@ int cmd_add(int argc,
string_list_clear(&only_match_skip_worktree, 0);
}

begin_odb_transaction();
transaction = begin_odb_transaction(repo->objects);

ps_matched = xcalloc(pathspec.nr, 1);
if (add_renormalize)
Expand All @@ -593,7 +594,7 @@ int cmd_add(int argc,

if (chmod_arg && pathspec.nr)
exit_status |= chmod_pathspec(repo, &pathspec, chmod_arg[0], show_only);
end_odb_transaction();
end_odb_transaction(transaction);

finish:
if (write_locked_index(repo->index, &lock_file,
Expand Down
45 changes: 33 additions & 12 deletions builtin/repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "shallow.h"

static const char *const repo_usage[] = {
"git repo info [--format=(keyvalue|nul)] [<key>...]",
"git repo info [--format=(keyvalue|nul)] [-z] [<key>...]",
NULL
};

Expand Down Expand Up @@ -38,6 +38,12 @@ static int get_layout_shallow(struct repository *repo, struct strbuf *buf)
return 0;
}

static int get_object_format(struct repository *repo, struct strbuf *buf)
{
strbuf_addstr(buf, repo->hash_algo->name);
return 0;
}

static int get_references_format(struct repository *repo, struct strbuf *buf)
{
strbuf_addstr(buf,
Expand All @@ -49,6 +55,7 @@ static int get_references_format(struct repository *repo, struct strbuf *buf)
static const struct field repo_info_fields[] = {
{ "layout.bare", get_layout_bare },
{ "layout.shallow", get_layout_shallow },
{ "object.format", get_object_format },
{ "references.format", get_references_format },
};

Expand Down Expand Up @@ -112,26 +119,40 @@ static int print_fields(int argc, const char **argv,
return ret;
}

static int parse_format_cb(const struct option *opt,
const char *arg, int unset UNUSED)
{
enum output_format *format = opt->value;

if (opt->short_name == 'z')
*format = FORMAT_NUL_TERMINATED;
else if (!strcmp(arg, "nul"))
*format = FORMAT_NUL_TERMINATED;
else if (!strcmp(arg, "keyvalue"))
*format = FORMAT_KEYVALUE;
else
die(_("invalid format '%s'"), arg);

return 0;
}

static int repo_info(int argc, const char **argv, const char *prefix,
struct repository *repo)
{
const char *format_str = "keyvalue";
enum output_format format;
enum output_format format = FORMAT_KEYVALUE;
struct option options[] = {
OPT_STRING(0, "format", &format_str, N_("format"),
N_("output format")),
OPT_CALLBACK_F(0, "format", &format, N_("format"),
N_("output format"),
PARSE_OPT_NONEG, parse_format_cb),
OPT_CALLBACK_F('z', NULL, &format, NULL,
N_("synonym for --format=nul"),
PARSE_OPT_NONEG | PARSE_OPT_NOARG,
parse_format_cb),
OPT_END()
};

argc = parse_options(argc, argv, prefix, options, repo_usage, 0);

if (!strcmp(format_str, "keyvalue"))
format = FORMAT_KEYVALUE;
else if (!strcmp(format_str, "nul"))
format = FORMAT_NUL_TERMINATED;
else
die(_("invalid format '%s'"), format_str);

return print_fields(argc, argv, repo, format);
}

Expand Down
5 changes: 3 additions & 2 deletions builtin/unpack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ static void unpack_all(void)
{
int i;
unsigned char *hdr = fill(sizeof(struct pack_header));
struct odb_transaction *transaction;

if (get_be32(hdr) != PACK_SIGNATURE)
die("bad pack file");
Expand All @@ -599,12 +600,12 @@ static void unpack_all(void)
progress = start_progress(the_repository,
_("Unpacking objects"), nr_objects);
CALLOC_ARRAY(obj_list, nr_objects);
begin_odb_transaction();
transaction = begin_odb_transaction(the_repository->objects);
for (i = 0; i < nr_objects; i++) {
unpack_one(i);
display_progress(progress, i + 1);
}
end_odb_transaction();
end_odb_transaction(transaction);
stop_progress(&progress);

if (delta_list)
Expand Down
7 changes: 4 additions & 3 deletions builtin/update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static void report(const char *fmt, ...)
* objects invisible while a transaction is active, so flush the
* transaction here before reporting a change made by update-index.
*/
flush_odb_transaction();
flush_odb_transaction(the_repository->objects->transaction);
va_start(vp, fmt);
vprintf(fmt, vp);
putchar('\n');
Expand Down Expand Up @@ -940,6 +940,7 @@ int cmd_update_index(int argc,
strbuf_getline_fn getline_fn;
int parseopt_state = PARSE_OPT_UNKNOWN;
struct repository *r = the_repository;
struct odb_transaction *transaction;
struct option options[] = {
OPT_BIT('q', NULL, &refresh_args.flags,
N_("continue refresh even when index needs update"),
Expand Down Expand Up @@ -1130,7 +1131,7 @@ int cmd_update_index(int argc,
* Allow the object layer to optimize adding multiple objects in
* a batch.
*/
begin_odb_transaction();
transaction = begin_odb_transaction(the_repository->objects);
while (ctx.argc) {
if (parseopt_state != PARSE_OPT_DONE)
parseopt_state = parse_options_step(&ctx, options,
Expand Down Expand Up @@ -1213,7 +1214,7 @@ int cmd_update_index(int argc,
/*
* By now we have added all of the new objects
*/
end_odb_transaction();
end_odb_transaction(transaction);

if (split_index > 0) {
if (repo_config_get_split_index(the_repository) == 0)
Expand Down
Loading