Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ff1da37
submodule--helper: accept '-i' shorthand for update --init
martinetd Jul 8, 2026
37e3640
Merge branch 'ps/odb-drop-whence' into ps/odb-for-each-object-filter
gitster Jul 9, 2026
52bd2ff
config: refactor include_by_gitdir() into include_by_path()
black-desk Jul 10, 2026
5004829
config: add "worktree" and "worktree/i" includeIf conditions
black-desk Jul 10, 2026
f065d59
object-file: rename files transaction prepare function
jltobler Jul 10, 2026
9c182bb
object-file: rename files transaction fsync function
jltobler Jul 10, 2026
ee1785a
object-file: embed transaction flush logic in commit function
jltobler Jul 10, 2026
926618e
object-file: drop check for inflight transactions
jltobler Jul 10, 2026
6d01718
object-file: propagate files transaction errors
jltobler Jul 10, 2026
4576d6c
odb/transaction: propagate begin errors
jltobler Jul 10, 2026
dbb3c87
odb/transaction: propagate commit errors
jltobler Jul 10, 2026
28fbc06
odb/transaction: add transaction env interface
jltobler Jul 10, 2026
48d730a
odb/transaction: introduce ODB transaction flags
jltobler Jul 10, 2026
6c24256
builtin/receive-pack: drop redundant tmpdir env
jltobler Jul 10, 2026
bdee7b3
builtin/receive-pack: stage incoming objects via ODB transactions
jltobler Jul 10, 2026
dbe8efd
t9811: break long && chains into multiple lines
Jul 11, 2026
1569919
t9811: replace 'test -f' and '! test -f' with 'test_path_*'
Jul 11, 2026
b9a7080
fast-export: standardize usage string and SYNOPSIS
chriscool Jul 13, 2026
678f3bb
t1100: modernize test style
shkuls Jul 14, 2026
9719c29
t1100: move creation of expected output into setup test
shkuls Jul 14, 2026
7b0203b
strbuf: avoid redundant reset in strbuf_getwholeline()
rscharfe Jul 14, 2026
27bed41
odb/source-packed: improve lookup when enumerating objects
pks-t Jul 15, 2026
03aaa4f
pack-bitmap: mark object filter as `const`
pks-t Jul 15, 2026
6f48b8c
pack-objects: drop unused return value from add_object_entry()
peff Jul 15, 2026
1ca65ca
pack-bitmap: allow aborting iteration of bitmapped objects
pks-t Jul 15, 2026
eaa9807
pack-bitmap: iterate object sources when opening bitmaps
pks-t Jul 15, 2026
db95bfc
pack-bitmap: drop `_1` suffix from functions that open bitmaps
pks-t Jul 15, 2026
8cd7ee7
pack-bitmap: introduce function to open bitmap for a single source
pks-t Jul 15, 2026
204daf5
odb: introduce object filters to `odb_for_each_object()`
pks-t Jul 15, 2026
bfa86e6
builtin/cat-file: filter objects via object database
pks-t Jul 15, 2026
b6b2769
t7614: avoid hiding git's exit code in a pipe
shkuls Jul 15, 2026
bd29432
Merge branch 'kk/streaming-walk-pqueue' into kk/no-walk-pathspec-fix
gitster Jul 16, 2026
32c4ed7
revision: fix --no-walk path filtering regression
spkrka Jul 16, 2026
aebf83d
Merge branch 'dm/submodule-update-i-shorthand'
gitster Jul 22, 2026
ccf9746
Merge branch 'cl/conditional-config-on-worktree-path'
gitster Jul 22, 2026
55f961a
Merge branch 'jt/receive-pack-use-odb-transactions'
gitster Jul 22, 2026
0a4f81e
Merge branch 'ml/t9811-replace-test-f'
gitster Jul 22, 2026
9822fc3
Merge branch 'cc/doc-fast-export-synopsis-fix'
gitster Jul 22, 2026
88620f0
Merge branch 'rs/strbuf-avoid-redundant-reset'
gitster Jul 22, 2026
5183689
Merge branch 'ps/odb-for-each-object-filter'
gitster Jul 22, 2026
2b8f09f
Merge branch 'sk/t1100-modernize'
gitster Jul 22, 2026
af4899f
Merge branch 'sk/t7614-do-not-hide-git-exit-status'
gitster Jul 22, 2026
60aa81f
Merge branch 'kk/no-walk-pathspec-fix'
gitster Jul 22, 2026
9a0c470
The 7th batch
gitster Jul 22, 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
44 changes: 44 additions & 0 deletions Documentation/RelNotes/2.56.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ UI, Workflows & Features
help option ('-h' or '--help') is requested directly by the user,
aligning with standard Unix convention.

* The '[includeIf "condition"]' conditional inclusion facility for
configuration files has been taught to use the location of the
worktree in its condition.

* The usage string and SYNOPSIS for 'git fast-export' have been
standardized to make them consistent with each other and with other
commands.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -167,6 +175,37 @@ Performance, Internal Implementation, Development Support etc.
'change-id' trailer, ensuring that sent tags generated by 'b4' contain
the required tracking information for subsequent runs.

* 'git receive-pack' has been refactored to use ODB transaction
interfaces instead of directly managing 'tmp_objdir' for staging
incoming objects, bringing it closer to being ODB backend agnostic.

* The test script 't/t9811-git-p4-label-import.sh' has been
modernized to use 'test_path_is_file' and 'test_path_is_missing'
instead of raw 'test -f' and '! test -f' calls.

* A redundant strbuf_reset() call in the 'HAVE_GETDELIM' path of
strbuf_getwholeline() has been removed, as getdelim() overwrites the
buffer and the length is updated afterward.

* The object database enumeration interface odb_for_each_object() has
been taught to accept object filters, allowing the underlying backends
to optimize the traversal by using reachability bitmaps when
available. 'git cat-file --batch-all-objects' has been updated to use
this generic interface, simplifying its code and avoiding direct
access to ODB backend internals.

* The test script 't/t1100-commit-tree-options.sh' has been modernized
by converting test cases to the modern style (using single quotes and
tab indentation) and moving the creation of the expected file inside
the setup test so it runs under the protection of the test harness.

* The test script 't/t7614-merge-signoff.sh' has been updated to avoid
suppressing the exit code of 'git' commands in a pipe.

* The 'git rev-list --no-walk' command has been corrected to restore
pathspec filtering, which was lost when the streaming walk was
refactored.


Fixes since v2.55
-----------------
Expand Down Expand Up @@ -306,3 +345,8 @@ Fixes since v2.55
* The stream-based object signature verification path has been
corrected to avoid double-closing the stream on read errors.
(merge cfd52a74a0 ps/odb-stream-double-close-fix later to maint).

* The '-i' shorthand for the '--init' option, which was accepted by the
'git submodule update' command until it was broken in a modernization
of the option-parsing code, has been restored.
(merge ff1da37f58 dm/submodule-update-i-shorthand later to maint).
53 changes: 53 additions & 0 deletions Documentation/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,51 @@ refer to linkgit:gitignore[5] for details. For convenience:
This is the same as `gitdir` except that matching is done
case-insensitively (e.g. on case-insensitive file systems)

`worktree`::
The data that follows the keyword `worktree` and a colon is used as a
glob pattern. If the working directory of the current worktree matches
the pattern, the include condition is met.
+
The worktree location is the path where files are checked out (as returned
by `git rev-parse --show-toplevel`). This is different from `gitdir`, which
matches the `.git` directory path. In a linked worktree, the worktree path
is the directory where that worktree's files are located, not the main
repository's `.git` directory.
+
The pattern uses the same glob syntax as `gitdir` (including `~/`, `./`,
`**/`, and trailing-`/` prefix matching). This condition will never match
in a bare repository (which has no worktree).
+
Unlike `gitdir`, the `worktree` condition currently matches only the
realpath-resolved worktree location. If the working tree was entered via a
symbolic link, a pattern that uses the symbolic-link spelling may not match;
use the real path instead.
+
This is useful when you want to apply configuration based on where the
working tree is located on the filesystem. For example, a contributor who
works on the same project both personally and as an employee can use
different `user.name` and `user.email` values depending on which directory
the worktree is checked out under:
+
----
[includeIf "worktree:/home/user/work/"]
path = ~/.config/git/work.inc
[includeIf "worktree:/home/user/personal/"]
path = ~/.config/git/personal.inc
----
+
While `extensions.worktreeConfig` (see linkgit:git-worktree[1]) also supports
per-worktree configuration, it stores the config inside each repository's
`.git/config.worktree` file and requires running `git config --worktree`
inside each worktree individually. In contrast, `includeIf "worktree:..."`
can be set once in a global or system-level configuration file (e.g.
`~/.config/git/config`) and applies to all repositories at once based on
their worktree location.

`worktree/i`::
This is the same as `worktree` except that matching is done
case-insensitively (e.g. on case-insensitive file systems)

`onbranch`::
The data that follows the keyword `onbranch` and a colon is taken to be a
pattern with standard globbing wildcards and two additional
Expand Down Expand Up @@ -244,6 +289,14 @@ Example
[includeIf "gitdir:~/to/group/"]
path = /path/to/foo.inc

; include if the worktree is at /path/to/project-build
[includeIf "worktree:/path/to/project-build"]
path = build-config.inc

; include for all worktrees inside /path/to/group
[includeIf "worktree:/path/to/group/"]
path = group-config.inc

; relative paths are always relative to the including
; file (if the condition is true); their location is not
; affected by the condition
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-fast-export.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-fast-export - Git data exporter
SYNOPSIS
--------
[verse]
'git fast-export' [<options>] | 'git fast-import'
'git fast-export' [<options>] [<revision-range>] [[--] <path>...]

DESCRIPTION
-----------
Expand Down
2 changes: 1 addition & 1 deletion builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ int cmd_add(int argc,
string_list_clear(&only_match_skip_worktree, 0);
}

transaction = odb_transaction_begin(repo->objects);
odb_transaction_begin_or_die(repo->objects, &transaction, 0);

ps_matched = xcalloc(pathspec.nr, 1);
if (add_renormalize)
Expand Down
76 changes: 7 additions & 69 deletions builtin/cat-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "userdiff.h"
#include "oid-array.h"
#include "packfile.h"
#include "pack-bitmap.h"
#include "object-file.h"
#include "object-name.h"
#include "odb.h"
Expand Down Expand Up @@ -844,28 +843,6 @@ static int batch_one_object_oi(const struct object_id *oid,
return payload->callback(oid, NULL, 0, payload->payload);
}

static int batch_one_object_packed(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
void *_payload)
{
struct for_each_object_payload *payload = _payload;
return payload->callback(oid, pack, nth_packed_object_offset(pack, pos),
payload->payload);
}

static int batch_one_object_bitmapped(const struct object_id *oid,
enum object_type type UNUSED,
int flags UNUSED,
uint32_t hash UNUSED,
struct packed_git *pack,
off_t offset,
void *_payload)
{
struct for_each_object_payload *payload = _payload;
return payload->callback(oid, pack, offset, payload->payload);
}

static void batch_each_object(struct batch_options *opt,
for_each_object_fn callback,
unsigned flags,
Expand All @@ -875,56 +852,17 @@ static void batch_each_object(struct batch_options *opt,
.callback = callback,
.payload = _payload,
};
struct odb_source_info source_info;
struct object_info oi = {
.source_infop = &source_info,
};
struct odb_for_each_object_options opts = {
.flags = flags,
.filter = &opt->objects_filter,
};
struct bitmap_index *bitmap = NULL;
struct odb_source *source;

/*
* TODO: we still need to tap into implementation details of the object
* database sources. Ideally, we should extend `odb_for_each_object()`
* to handle object filters itself so that we can move the filtering
* logic into the individual sources.
*/
odb_prepare_alternates(the_repository->objects);
for (source = the_repository->objects->sources; source; source = source->next) {
struct odb_source_files *files = odb_source_files_downcast(source);
int ret = odb_source_for_each_object(&files->loose->base, NULL, batch_one_object_oi,
&payload, &opts);
if (ret)
break;
}

if (opt->objects_filter.choice != LOFC_DISABLED &&
(bitmap = prepare_bitmap_git(the_repository)) &&
!for_each_bitmapped_object(bitmap, &opt->objects_filter,
batch_one_object_bitmapped, &payload)) {
struct packed_git *pack;

repo_for_each_pack(the_repository, pack) {
if (bitmap_index_contains_pack(bitmap, pack) ||
open_pack_index(pack))
continue;
for_each_object_in_pack(pack, batch_one_object_packed,
&payload, flags);
}
} else {
struct odb_source_info source_info;
struct object_info oi = {
.source_infop = &source_info,
};

for (source = the_repository->objects->sources; source; source = source->next) {
struct odb_source_files *files = odb_source_files_downcast(source);
int ret = odb_source_for_each_object(&files->packed->base, &oi,
batch_one_object_oi, &payload, &opts);
if (ret)
break;
}
}

free_bitmap_index(bitmap);
odb_for_each_object_ext(the_repository->objects, &oi,
batch_one_object_oi, &payload, &opts);
}

static int batch_objects(struct batch_options *opt)
Expand Down
2 changes: 1 addition & 1 deletion builtin/fast-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "gpg-interface.h"

static const char *const fast_export_usage[] = {
N_("git fast-export [<rev-list-opts>]"),
N_("git fast-export [<options>] [<revision-range>] [[--] <path>...]"),
NULL
};

Expand Down
11 changes: 5 additions & 6 deletions builtin/pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,16 +1867,16 @@ static const char no_closure_warning[] = N_(
"disabling bitmap writing, as some objects are not being packed"
);

static int add_object_entry(const struct object_id *oid, enum object_type type,
const char *name, int exclude)
static void add_object_entry(const struct object_id *oid, enum object_type type,
const char *name, int exclude)
{
struct packed_git *found_pack = NULL;
off_t found_offset = 0;

display_progress(progress_state, ++nr_seen);

if (have_duplicate_entry(oid, exclude))
return 0;
return;

if (!want_object_in_pack(oid, exclude, &found_pack, &found_offset)) {
/* The pack is missing an object, so it will not have closure */
Expand All @@ -1885,13 +1885,12 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
warning(_(no_closure_warning));
write_bitmap_index = 0;
}
return 0;
return;
}

create_object_entry(oid, type, pack_name_hash_fn(name),
exclude, name && no_try_delta(name),
found_pack, found_offset);
return 1;
}

static int add_object_entry_from_bitmap(const struct object_id *oid,
Expand All @@ -1909,7 +1908,7 @@ static int add_object_entry_from_bitmap(const struct object_id *oid,
return 0;

create_object_entry(oid, type, name_hash, 0, 0, pack, offset);
return 1;
return 0;
}

struct pbase_tree_cache {
Expand Down
Loading