Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0c1ed96
Merge branch 'en/backfill-fixes-and-edges' into ds/path-walk-filters
gitster May 5, 2026
3198237
connect: use "service" enum for "name" argument
peff May 19, 2026
a237eac
approxidate: make "today" wrap to midnight
taahol May 21, 2026
d5ba64d
t0006: add support for approxidate test date adjustment
taahol May 21, 2026
bbe9b46
approxidate: make "specials" respect fixed day-of-month
taahol May 21, 2026
b809304
approxidate: use deferred mday adjustments for "specials"
taahol May 21, 2026
c8a3cea
doc: hook: remove stray backtick
LemmingAvalanche May 21, 2026
2d2aeb3
doc: hook: consistently capitalize Git
LemmingAvalanche May 21, 2026
2757bc8
doc: config: include existing git-hook(1) section
LemmingAvalanche May 21, 2026
5c6a41e
doc: hook: don’t self-link via config include
LemmingAvalanche May 21, 2026
abcf2dd
transport-helper: fix typo in BUG() message
peff May 22, 2026
b00c374
t5620: make test work with path-walk var
derrickstolee May 22, 2026
3556788
pack-objects: pass --objects with --path-walk
derrickstolee May 22, 2026
5406b62
t/perf: add pack-objects filter and path-walk benchmark
derrickstolee May 22, 2026
7a7070e
path-walk: always emit directly-requested objects
derrickstolee May 22, 2026
6d87f0e
path-walk: support blobless filter
derrickstolee May 22, 2026
bf24de4
backfill: die on incompatible filter options
derrickstolee May 22, 2026
f1b5d3d
path-walk: support blob size limit filter
derrickstolee May 22, 2026
8ff8de7
path-walk: add pl_sparse_trees to control tree pruning
derrickstolee May 22, 2026
2dc858e
pack-objects: support sparse:oid filter with path-walk
derrickstolee May 22, 2026
5c21575
t6601: tag otherwise-unreachable trees
derrickstolee May 22, 2026
5111520
path-walk: support `tree:0` filter
ttaylorr May 22, 2026
2b8d07e
path-walk: support `object:type` filter
ttaylorr May 22, 2026
456efac
path-walk: support `combine` filter
ttaylorr May 22, 2026
7b3ab91
Merge branch 'jk/connect-service-enum'
gitster Jun 2, 2026
15dc60d
Merge branch 'ta/approxidate-noon-fix'
gitster Jun 2, 2026
ffaa2ed
Merge branch 'ds/path-walk-filters'
gitster Jun 2, 2026
95e5fbd
Merge branch 'kh/doc-hook'
gitster Jun 2, 2026
9ac3f19
The 11th batch
gitster Jun 2, 2026
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
11 changes: 11 additions & 0 deletions Documentation/RelNotes/2.55.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ UI, Workflows & Features
* "git cat-file --batch" learns an in-line command "mailmap"
that lets the user toggle use of mailmap.

* The "git pack-objects --path-walk" traversal has been integrated
with several object filters, including blobless and sparse filters.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -115,6 +118,10 @@ Performance, Internal Implementation, Development Support etc.
more robust by falling back to reading the commit object when
the commit-graph is no longer available.

* The "name" argument in git_connect() and related functions has been
converted to a "service" enum to improve type safety and clarify its
purpose.


Fixes since v2.54
-----------------
Expand Down Expand Up @@ -230,6 +237,10 @@ Fixes since v2.54
* Update GitLab CI jobs that exercise macOS.
(merge 62319b49bb ps/gitlab-ci-macOS-improvements later to maint).

* "Friday noon" asked in the morning on Sunday was parsed to be one
day before the specified time, which has been corrected.
(merge b809304101 ta/approxidate-noon-fix later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge 80f4b802e9 ja/doc-difftool-synopsis-style later to maint).
(merge b96490241e jc/doc-timestamps-in-stat later to maint).
Expand Down
2 changes: 2 additions & 0 deletions Documentation/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ include::config/guitool.adoc[]

include::config/help.adoc[]

include::config/hook.adoc[]

include::config/http.adoc[]

include::config/i18n.adoc[]
Expand Down
19 changes: 13 additions & 6 deletions Documentation/config/hook.adoc
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
ifdef::git-hook[]
:see-git-hook:
endif::git-hook[]
ifndef::git-hook[]
:see-git-hook: See linkgit:git-hook[1].
endif::git-hook[]

hook.<friendly-name>.command::
The command to execute for `hook.<friendly-name>`. `<friendly-name>`
is a unique name that identifies this hook. The hook events that
trigger the command are configured with `hook.<friendly-name>.event`.
The value can be an executable path or a shell oneliner. If more than
one value is specified for the same `<friendly-name>`, only the last
value parsed is used. See linkgit:git-hook[1].
value parsed is used. {see-git-hook}

hook.<friendly-name>.event::
The hook events that trigger `hook.<friendly-name>`. The value is the
Expand All @@ -14,7 +21,7 @@ hook.<friendly-name>.event::
This is a multi-valued key. To run `hook.<friendly-name>` on multiple
events, specify the key more than once. An empty value resets
the list of events, clearing any previously defined events for
`hook.<friendly-name>`. See linkgit:git-hook[1].
`hook.<friendly-name>`. {see-git-hook}
+
The `<friendly-name>` must not be the same as a known hook event name
(e.g. do not use `hook.pre-commit.event`). Using a known event name as
Expand All @@ -27,7 +34,7 @@ hook.<friendly-name>.enabled::
Set to `false` to disable the hook without removing its
configuration. This is particularly useful when a hook is defined
in a system or global config file and needs to be disabled for a
specific repository. See linkgit:git-hook[1].
specific repository. {see-git-hook}

hook.<friendly-name>.parallel::
Whether the hook `hook.<friendly-name>` may run in parallel with other hooks
Expand All @@ -37,13 +44,13 @@ hook.<friendly-name>.parallel::
all hooks for that event run sequentially regardless of `hook.jobs`.
Only configured (named) hooks need to declare this. Traditional hooks
found in the hooks directory do not need to, and run in parallel when
the effective job count is greater than 1. See linkgit:git-hook[1].
the effective job count is greater than 1. {see-git-hook}

hook.<event>.enabled::
Switch to enable or disable all hooks for the `<event>` hook event.
When set to `false`, no hooks fire for that event, regardless of any
per-hook `hook.<friendly-name>.enabled` settings. Defaults to `true`.
See linkgit:git-hook[1].
{see-git-hook}
+
Note on naming: `<event>` must be the event name (e.g. `pre-commit`),
not a hook friendly-name. Since using a known event name as a
Expand All @@ -60,7 +67,7 @@ hook.<event>.jobs::
setting has no effect unless all configured hooks for the event have
`hook.<friendly-name>.parallel` set to `true`. Set to `-1` to use the
number of available CPU cores. Must be a positive integer or `-1`;
zero is rejected with a warning. See linkgit:git-hook[1].
zero is rejected with a warning. {see-git-hook}
+
Note on naming: although this key resembles `hook.<friendly-name>.*`
(a per-hook setting), `<event>` must be the event name, not a hook
Expand Down
4 changes: 4 additions & 0 deletions Documentation/git-backfill.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ OPTIONS
+
You may also use commit-limiting options understood by
linkgit:git-rev-list[1] such as `--first-parent`, `--since`, or pathspecs.
+
Most `--filter=<spec>` options don't work with the purpose of
`git backfill`, but the `sparse:<oid>` filter is integrated to provide a
focused set of paths to download, distinct from the `--sparse` option.

SEE ALSO
--------
Expand Down
11 changes: 6 additions & 5 deletions Documentation/git-hook.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ git-hook(1)

NAME
----
git-hook - Run git hooks
git-hook - Run Git hooks

SYNOPSIS
--------
Expand All @@ -15,8 +15,8 @@ SYNOPSIS
DESCRIPTION
-----------

A command interface for running git hooks (see linkgit:githooks[5]),
for use by other scripted git commands.
A command interface for running Git hooks (see linkgit:githooks[5]),
for use by other scripted Git commands.

This command parses the default configuration files for sets of configs like
so:
Expand All @@ -41,7 +41,7 @@ spell-checker for your commit messages, you would write a configuration like so:

With this config, when you run 'git commit', first `~/bin/linter --cpp20` will
have a chance to check your files to be committed (during the `pre-commit` hook
event`), and then `~/bin/spellchecker` will have a chance to check your commit
event), and then `~/bin/spellchecker` will have a chance to check your commit
message (during the `commit-msg` hook event).

Commands are run in the order Git encounters their associated
Expand Down Expand Up @@ -161,7 +161,7 @@ setting, allowing all hooks for the event to run concurrently, even if they
are not individually marked as parallel.
+
Some hooks always run sequentially regardless of this flag or the
`hook.jobs` config, because git knows they cannot safely run in parallel:
`hook.jobs` config, because Git knows they cannot safely run in parallel:
`applypatch-msg`, `pre-commit`, `prepare-commit-msg`, `commit-msg`,
`post-commit`, `post-checkout`, and `push-to-checkout`.

Expand Down Expand Up @@ -204,6 +204,7 @@ unintended and unsupported ways.

CONFIGURATION
-------------
:git-hook: 1
include::config/hook.adoc[]

SEE ALSO
Expand Down
8 changes: 5 additions & 3 deletions Documentation/git-pack-objects.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,11 @@ will be automatically changed to version `1`.
of filenames that cause collisions in Git's default name-hash
algorithm.
+
Incompatible with `--delta-islands`, `--shallow`, or `--filter`. The
`--use-bitmap-index` option will be ignored in the presence of
`--path-walk.`
Incompatible with `--delta-islands`. The `--use-bitmap-index` option is
ignored in the presence of `--path-walk`. The `--path-walk` option
supports the `--filter=<spec>` forms `blob:none`, `blob:limit=<n>`,
`tree:0`, `object:type=<type>`, and `sparse:<oid>`. These supported filter
types can be combined with the `combine:<spec>+<spec>` form.


DELTA ISLANDS
Expand Down
3 changes: 2 additions & 1 deletion Documentation/rev-list-options.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ ordering and formatting options, such as `--reverse`.

`--since=<date>`::
`--after=<date>`::
Show commits more recent than _<date>_.
Show commits more recent than _<date>_. As a special case,
'today' means the last midnight.

`--since-as-filter=<date>`::
Show all commits more recent than _<date>_. This visits
Expand Down
7 changes: 7 additions & 0 deletions Documentation/technical/api-path-walk.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ commits.
applications could disable some options to make it simpler to walk
the objects or to have fewer calls to `path_fn`.
+
Note that objects directly requested as pending objects (such as targets
of lightweight tags or other ref tips) are always emitted to `path_fn`,
even when the corresponding type flag is disabled. Only objects
discovered during the tree walk are subject to these type filters. This
ensures that objects specifically requested through the revision input
are never silently dropped.
+
While it is possible to walk only commits in this way, consumers would be
better off using the revision walk API instead.

Expand Down
2 changes: 1 addition & 1 deletion builtin/archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static int run_remote_archiver(int argc, const char **argv,

_remote = remote_get(remote);
transport = transport_get(_remote, _remote->url.v[0]);
transport_connect(transport, "git-upload-archive", exec, fd);
transport_connect(transport, GIT_CONNECT_UPLOAD_ARCHIVE, exec, fd);

/*
* Inject a fake --format field at the beginning of the
Expand Down
8 changes: 5 additions & 3 deletions builtin/backfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ static void reject_unsupported_rev_list_options(struct rev_info *revs)
if (revs->explicit_diff_merges)
die(_("'%s' cannot be used with 'git backfill'"),
"--diff-merges");
if (revs->filter.choice)
die(_("'%s' cannot be used with 'git backfill'"),
"--filter");
if (!path_walk_filter_compatible(&revs->filter))
die(_("cannot backfill with these filter options"));
if (revs->filter.blob_limit_value)
die(_("cannot backfill with blob size limits"));
}

static int do_backfill(struct backfill_context *ctx)
Expand All @@ -108,6 +109,7 @@ static int do_backfill(struct backfill_context *ctx)

if (ctx->sparse) {
CALLOC_ARRAY(info.pl, 1);
info.pl_sparse_trees = 1;
if (get_sparse_checkout_patterns(info.pl)) {
path_walk_info_clear(&info);
return error(_("problem loading sparse-checkout"));
Expand Down
2 changes: 1 addition & 1 deletion builtin/fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ int cmd_fetch_pack(int argc,
int flags = args.verbose ? CONNECT_VERBOSE : 0;
if (args.diag_url)
flags |= CONNECT_DIAG_URL;
conn = git_connect(fd, dest, "git-upload-pack",
conn = git_connect(fd, dest, GIT_CONNECT_UPLOAD_PACK,
args.uploadpack, flags);
if (!conn)
return args.diag_url ? 0 : 1;
Expand Down
23 changes: 13 additions & 10 deletions builtin/pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -4764,7 +4764,7 @@ static int add_objects_by_path(const char *path,
return 0;
}

static void get_object_list_path_walk(struct rev_info *revs)
static int get_object_list_path_walk(struct rev_info *revs)
{
struct path_walk_info info = PATH_WALK_INFO_INIT;
unsigned int processed = 0;
Expand All @@ -4787,8 +4787,9 @@ static void get_object_list_path_walk(struct rev_info *revs)
result = walk_objects_by_path(&info);
trace2_region_leave("pack-objects", "path-walk", revs->repo);

if (result)
die(_("failed to pack objects via path-walk"));
path_walk_info_clear(&info);

return result;
}

static void get_object_list(struct rev_info *revs, struct strvec *argv)
Expand Down Expand Up @@ -4851,8 +4852,13 @@ static void get_object_list(struct rev_info *revs, struct strvec *argv)
fn_show_object = show_object;

if (path_walk) {
get_object_list_path_walk(revs);
} else {
if (get_object_list_path_walk(revs)) {
warning(_("failed to pack objects via path-walk"));
path_walk = 0;
}
}

if (!path_walk) {
if (prepare_revision_walk(revs))
die(_("revision walk setup failed"));
mark_edges_uninteresting(revs, show_edge, sparse);
Expand Down Expand Up @@ -5187,7 +5193,7 @@ int cmd_pack_objects(int argc,

if (path_walk) {
const char *option = NULL;
if (filter_options.choice)
if (!path_walk_filter_compatible(&filter_options))
option = "--filter";
else if (use_delta_islands)
option = "--delta-islands";
Expand All @@ -5200,10 +5206,7 @@ int cmd_pack_objects(int argc,
}
if (path_walk) {
strvec_push(&rp, "--boundary");
/*
* We must disable the bitmaps because we are removing
* the --objects / --objects-edge[-aggressive] options.
*/
strvec_push(&rp, "--objects");
use_bitmap_index = 0;
} else if (thin) {
use_internal_rev_list = 1;
Expand Down
5 changes: 3 additions & 2 deletions builtin/send-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ int cmd_send_pack(int argc,
fd[0] = 0;
fd[1] = 1;
} else {
conn = git_connect(fd, dest, "git-receive-pack", receivepack,
args.verbose ? CONNECT_VERBOSE : 0);
conn = git_connect(fd, dest, GIT_CONNECT_RECEIVE_PACK,
receivepack,
args.verbose ? CONNECT_VERBOSE : 0);
}

packet_reader_init(&reader, fd[0], NULL, 0,
Expand Down
4 changes: 2 additions & 2 deletions connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,
* the connection failed).
*/
struct child_process *git_connect(int fd[2], const char *url,
const char *name,
enum git_connect_service service,
const char *prog, int flags)
{
char *hostandport, *path;
Expand All @@ -1413,7 +1413,7 @@ struct child_process *git_connect(int fd[2], const char *url,
* fetch, ls-remote, etc), then fallback to v0 since we don't know how
* to do anything else (like push or remote archive) via v2.
*/
if (version == protocol_v2 && strcmp("git-upload-pack", name))
if (version == protocol_v2 && service != GIT_CONNECT_UPLOAD_PACK)
version = protocol_v0;

/* Without this we cannot rely on waitpid() to tell
Expand Down
7 changes: 6 additions & 1 deletion connect.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
#define CONNECT_DIAG_URL (1u << 1)
#define CONNECT_IPV4 (1u << 2)
#define CONNECT_IPV6 (1u << 3)
struct child_process *git_connect(int fd[2], const char *url, const char *name, const char *prog, int flags);
enum git_connect_service {
GIT_CONNECT_UPLOAD_PACK,
GIT_CONNECT_RECEIVE_PACK,
GIT_CONNECT_UPLOAD_ARCHIVE,
};
struct child_process *git_connect(int fd[2], const char *url, enum git_connect_service, const char *prog, int flags);
int finish_connect(struct child_process *conn);
int git_connection_is_socket(struct child_process *conn);
int server_supports(const char *feature);
Expand Down
Loading