<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/worktree.c, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-04-03T20:01:09Z</updated>
<entry>
<title>Merge branch 'pw/worktree-reduce-the-repository'</title>
<updated>2026-04-03T20:01:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-03T20:01:09Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=05ddb9ee8a4c619fbb0e7309fe291bff5cd7c987'/>
<id>urn:sha1:05ddb9ee8a4c619fbb0e7309fe291bff5cd7c987</id>
<content type='text'>
Reduce the reference to the_repository in the worktree subsystem.

* pw/worktree-reduce-the-repository:
  worktree: reject NULL worktree in get_worktree_git_dir()
  worktree add: stop reading ".git/HEAD"
  worktree: remove "the_repository" from is_current_worktree()
</content>
</entry>
<entry>
<title>worktree add: stop reading ".git/HEAD"</title>
<updated>2026-03-26T15:20:50Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2026-03-26T14:16:58Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=8bad0e07e1eddff2268bc9be3368c9b5fee47915'/>
<id>urn:sha1:8bad0e07e1eddff2268bc9be3368c9b5fee47915</id>
<content type='text'>
The function can_use_local_refs() prints a warning if there are no local
branches and HEAD is invalid or points to an unborn branch. As part of
the warning it prints the contents of ".git/HEAD". In a repository using
the reftable backend HEAD is not stored in the filesystem so reading
that file is pointless. In a repository using the files backend it is
unclear how useful printing it is - it would be better to diagnose the
problem for the user. For now, simplify the warning by not printing
the file contents and adjust the relevant test case accordingly. Also
fixup the test case to use test_grep so that anyone trying to debug a
test failure in the future is not met by a wall of silence.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: do not pass strbuf by value</title>
<updated>2026-03-11T18:08:53Z</updated>
<author>
<name>Deveshi Dwivedi</name>
<email>deveshigurgaon@gmail.com</email>
</author>
<published>2026-03-11T17:33:35Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=4107c0bb3455905aeacdba3be09b20e62b310eaa'/>
<id>urn:sha1:4107c0bb3455905aeacdba3be09b20e62b310eaa</id>
<content type='text'>
write_worktree_linking_files() takes two struct strbuf parameters by
value, even though it only reads path strings from them.

Passing a strbuf by value is misleading and dangerous. The structure
carries a pointer to its underlying character array; caller and callee
end up sharing that storage.  If the callee ever causes the strbuf to
be reallocated, the caller's copy becomes a dangling pointer, which
results in a double-free when the caller does strbuf_release().

The function only needs the string values, not the strbuf machinery.
Switch it to take const char * and update all callers to pass .buf.

Signed-off-by: Deveshi Dwivedi &lt;deveshigurgaon@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ob/core-attributesfile-in-repository'</title>
<updated>2026-03-05T18:04:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-05T18:04:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=db227bce2224b55b11954a5f292a0b035b7d9279'/>
<id>urn:sha1:db227bce2224b55b11954a5f292a0b035b7d9279</id>
<content type='text'>
The core.attributesfile is intended to be set per repository, but
were kept track of by a single global variable in-core, which has
been corrected by moving it to per-repository data structure.

* ob/core-attributesfile-in-repository:
  environment: move "branch.autoSetupMerge" into `struct repo_config_values`
  environment: stop using core.sparseCheckout globally
  environment: stop storing `core.attributesFile` globally
</content>
</entry>
<entry>
<title>Merge branch 'pw/no-more-NULL-means-current-worktree'</title>
<updated>2026-03-04T18:53:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-04T18:53:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=7b7d67104e315437c46e62986e163c97c5a51dd3'/>
<id>urn:sha1:7b7d67104e315437c46e62986e163c97c5a51dd3</id>
<content type='text'>
API clean-up for the worktree subsystem.

* pw/no-more-NULL-means-current-worktree:
  path: remove repository argument from worktree_git_path()
  wt-status: avoid passing NULL worktree
</content>
</entry>
<entry>
<title>Merge branch 'kn/ref-location'</title>
<updated>2026-03-04T18:52:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-04T18:52:58Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=1d0a2acb78f157d39937a088548e561b27722e8d'/>
<id>urn:sha1:1d0a2acb78f157d39937a088548e561b27722e8d</id>
<content type='text'>
Allow the directory in which reference backends store their data to
be specified.

* kn/ref-location:
  refs: add GIT_REFERENCE_BACKEND to specify reference backend
  refs: allow reference location in refstorage config
  refs: receive and use the reference storage payload
  refs: move out stub modification to generic layer
  refs: extract out `refs_create_refdir_stubs()`
  setup: don't modify repo in `create_reference_database()`
</content>
</entry>
<entry>
<title>environment: stop using core.sparseCheckout globally</title>
<updated>2026-02-26T15:22:51Z</updated>
<author>
<name>Olamide Caleb Bello</name>
<email>belkid98@gmail.com</email>
</author>
<published>2026-02-16T16:38:26Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=4021751558126d39b642503e7ef4768131df45e7'/>
<id>urn:sha1:4021751558126d39b642503e7ef4768131df45e7</id>
<content type='text'>
The config value `core.sparseCheckout` is parsed in
`git_default_core_config()` and stored globally in
`core_apply_sparse_checkout`. This could cause it to be overwritten
by another repository when different Git repositories run in the same
process.

Move the parsed value into `struct repo_config_values` in the_repository
to retain current behaviours and move towards libifying Git.

Suggested-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
Mentored-by: Christian Couder &lt;christian.couder@gmail.com&gt;
Mentored-by: Usman Akinyemi &lt;usmanakinyemi202@gmail.com&gt;
Signed-off-by: Olamide Caleb Bello &lt;belkid98@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: allow reference location in refstorage config</title>
<updated>2026-02-25T17:38:41Z</updated>
<author>
<name>Karthik Nayak</name>
<email>karthik.188@gmail.com</email>
</author>
<published>2026-02-25T09:40:45Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=01dc84594ee365ee7086fccc7f590ab527730531'/>
<id>urn:sha1:01dc84594ee365ee7086fccc7f590ab527730531</id>
<content type='text'>
The 'extensions.refStorage' config is used to specify the reference
backend for a given repository. Both the 'files' and 'reftable' backends
utilize the $GIT_DIR as the reference folder by default in
`get_main_ref_store()`.

Since the reference backends are pluggable, this means that they could
work with out-of-tree reference directories too. Extend the 'refStorage'
config to also support taking an URI input, where users can specify the
reference backend and the location.

Add the required changes to obtain and propagate this value to the
individual backends. Add the necessary documentation and tests.

Traditionally, for linked worktrees, references were stored in the
'$GIT_DIR/worktrees/&lt;wt_id&gt;' path. But when using an alternate reference
storage path, it doesn't make sense to store the main worktree
references in the new path, and the linked worktree references in the
$GIT_DIR. So, let's store linked worktree references in
'$ALTERNATE_REFERENCE_DIR/worktrees/&lt;wt_id&gt;'. To do this, create the
necessary files and folders while also adding stubs in the $GIT_DIR path
to ensure that it is still considered a Git directory.

Ideally, we would want to pass in a `struct worktree *` to individual
backends, instead of passing the `gitdir`. This allows them to handle
worktree specific logic. Currently, that is not possible since the
worktree code is:

  - Tied to using the global `the_repository` variable.

  - Is not setup before the reference database during initialization of
    the repository.

Add a TODO in 'refs.c' to ensure we can eventually make that change.

Helped-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>path: remove repository argument from worktree_git_path()</title>
<updated>2026-02-19T19:03:24Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2026-02-19T14:26:33Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a49cb0f093809e3e66566f161aa930f37346775d'/>
<id>urn:sha1:a49cb0f093809e3e66566f161aa930f37346775d</id>
<content type='text'>
worktree_git_path() takes a struct repository and a struct worktree
which also contains a struct repository. The repository argument
was added by a973f60dc7c (path: stop relying on `the_repository` in
`worktree_git_path()`, 2024-08-13) and exists because the worktree
argument is optional. Having two ways of passing a repository is
a potential foot-gun as if the the worktree argument is present the
repository argument must match the worktree's repository member. Since
the last commit there are no callers that pass a NULL worktree so lets
remove the repository argument. This removes the potential confusion
and lets us delete a number of uses of "the_repository".

worktree_git_path() has the following callers:

 - builtin/worktree.c:validate_no_submodules() which is called from
   check_clean_worktree() and move_worktree(), both of which supply
   a non-NULL worktree.

 - builtin/fsck.c:cmd_fsck() which loops over all worktrees.

 - revision.c:add_index_objects_to_pending() which loops over all
   worktrees.

 - worktree.c:worktree_lock_reason() which dereferences wt before
   calling worktree_git_path().

 - wt-status.c:wt_status_check_bisect() and wt_status_check_rebase()
   which are always called with a non-NULL worktree after the last
   commit.

 - wt-status.c:git_branch() which is only called by
   wt_status_check_bisect() and wt_status_check_rebase().

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sb/doc-worktree-prune-expire-improvement'</title>
<updated>2026-02-09T20:09:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-02-09T20:09:10Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=4f3929275b6ce975f80e00a2decfc4ab734a8ead'/>
<id>urn:sha1:4f3929275b6ce975f80e00a2decfc4ab734a8ead</id>
<content type='text'>
The help text and the documentation for the "--expire" option of
"git worktree [list|prune]" have been improved.

* sb/doc-worktree-prune-expire-improvement:
  worktree: clarify that --expire only affects missing worktrees
</content>
</entry>
</feed>
