<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/worktree.h, branch v2.46.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.46.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.46.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-06-24T23:39:15Z</updated>
<entry>
<title>Merge branch 'jc/worktree-git-path'</title>
<updated>2024-06-24T23:39:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-06-24T23:39:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=107ed551030713e25933dc8e92ad8d67cff28ff6'/>
<id>urn:sha1:107ed551030713e25933dc8e92ad8d67cff28ff6</id>
<content type='text'>
Code cleanup.

* jc/worktree-git-path:
  worktree_git_path(): move the declaration to path.h
</content>
</entry>
<entry>
<title>worktree_git_path(): move the declaration to path.h</title>
<updated>2024-06-08T18:42:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-06-08T18:39:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bf6a86236e829d08c92356e5c861193ccb516ef7'/>
<id>urn:sha1:bf6a86236e829d08c92356e5c861193ccb516ef7</id>
<content type='text'>
The definition of this function is in path.c but its declaration is
in worktree.h, which is something unexpected.  The function is
explained as "Similar to git_path()"; declaring it next to where
git_path() is declared would make more sense.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: retrieve worktree ref stores via associated repository</title>
<updated>2024-05-17T17:33:38Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-05-17T08:18:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dc7fb4f72c2e39ffbb98aee55ad7ea4c3f8e12fc'/>
<id>urn:sha1:dc7fb4f72c2e39ffbb98aee55ad7ea4c3f8e12fc</id>
<content type='text'>
Similar as with the preceding commit, the worktree ref stores are always
looked up via `the_repository`. Also, again, those ref stores are stored
in a global map.

Refactor the code so that worktrees have a pointer to their repository.
Like this, we can move the global map into `struct repository` and stop
using `the_repository`. With this change, we can now in theory look up
worktree ref stores for repositories other than `the_repository`. In
practice, the worktree code will need further changes to look up
arbitrary worktrees.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: expose interface to look up worktree by name</title>
<updated>2024-01-08T21:17:30Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-01-08T10:05:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b8a846b2e03610e6f550d364c75e514532ef7adf'/>
<id>urn:sha1:b8a846b2e03610e6f550d364c75e514532ef7adf</id>
<content type='text'>
Our worktree interfaces do not provide a way to look up a worktree by
its name. Expose `get_linked_worktree()` to allow for this usecase. As
callers are responsible for freeing this worktree, introduce a new
function `free_worktree()` that does so.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rj/avoid-switching-to-already-used-branch'</title>
<updated>2023-03-19T22:03:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-03-19T22:03:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=96a806f87a379fbc54b5cdb889518e9540d954c9'/>
<id>urn:sha1:96a806f87a379fbc54b5cdb889518e9540d954c9</id>
<content type='text'>
A few subcommands have been taught to stop users from working on a
branch that is being used in another worktree linked to the same
repository.

* rj/avoid-switching-to-already-used-branch:
  switch: reject if the branch is already checked out elsewhere (test)
  rebase: refuse to switch to a branch already checked out elsewhere (test)
  branch: fix die_if_checked_out() when ignore_current_worktree
  worktree: introduce is_shared_symref()
</content>
</entry>
<entry>
<title>worktree: introduce is_shared_symref()</title>
<updated>2023-02-25T21:05:23Z</updated>
<author>
<name>Rubén Justo</name>
<email>rjusto@gmail.com</email>
</author>
<published>2023-02-25T14:21:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=662078caacd450f93faa72e0e7d8580c42621415'/>
<id>urn:sha1:662078caacd450f93faa72e0e7d8580c42621415</id>
<content type='text'>
Add a new function, is_shared_symref(), which contains the heart of
find_shared_symref().  Refactor find_shared_symref() to use the new
function is_shared_symref().

Soon, we will use is_shared_symref() to search for symref beyond
the first worktree that matches.

Signed-off-by: Rubén Justo &lt;rjusto@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>object.h: stop depending on cache.h; make cache.h depend on object.h</title>
<updated>2023-02-24T01:25:29Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-02-24T00:09:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a64215b6cd5e67939187475c5b248dc5d13e3d60'/>
<id>urn:sha1:a64215b6cd5e67939187475c5b248dc5d13e3d60</id>
<content type='text'>
Things should be able to depend on object.h without pulling in all of
cache.h.  Move an enum to allow this.

Note that a couple files previously depended on things brought in
through cache.h indirectly (revision.h -&gt; commit.h -&gt; object.h -&gt;
cache.h).  As such, this change requires making existing dependencies
more explicit in half a dozen files.  The inclusion of strbuf.h in
some headers if of particular note: these headers directly embedded a
strbuf in some new structs, meaning they should have been including
strbuf.h all along but were indirectly getting the necessary
definitions.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: unify parse_worktree_ref() and ref_type()</title>
<updated>2022-09-19T18:11:11Z</updated>
<author>
<name>Han-Wen Nienhuys</name>
<email>hanwen@google.com</email>
</author>
<published>2022-09-19T16:34:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=71e5473493612f74244e2fa7a257a868df98be53'/>
<id>urn:sha1:71e5473493612f74244e2fa7a257a868df98be53</id>
<content type='text'>
The logic to handle worktree refs (worktrees/NAME/REF and
main-worktree/REF) existed in two places:

* ref_type() in refs.c

* parse_worktree_ref() in worktree.c

Collapse this logic together in one function parse_worktree_ref():
this avoids having to cross-check the result of parse_worktree_ref()
and ref_type().

Introduce enum ref_worktree_type, which is slightly different from
enum ref_type. The latter is a misleading name (one would think that
'ref_type' would have the symref option).

Instead, enum ref_worktree_type only makes explicit how a refname
relates to a worktree. From this point of view, HEAD and
refs/bisect/abc are the same: they specify the current worktree
implicitly.

The files-backend must avoid packing refs/bisect/* and friends into
packed-refs, so expose is_per_worktree_ref() separately.

Signed-off-by: Han-Wen Nienhuys &lt;hanwen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: create init_worktree_config()</title>
<updated>2022-02-08T17:49:20Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2022-02-07T21:32:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=615a84ad788b26260c5b053ace2d5720ea5f05c5'/>
<id>urn:sha1:615a84ad788b26260c5b053ace2d5720ea5f05c5</id>
<content type='text'>
Upgrading a repository to use extensions.worktreeConfig is non-trivial.
There are several steps involved, including moving some config settings
from the common config file to the main worktree's config.worktree file.
The previous change updated the documentation with all of these details.

Commands such as 'git sparse-checkout set' upgrade the repository to use
extensions.worktreeConfig without following these steps, causing some
user pain in some special cases.

Create a helper method, init_worktree_config(), that will be used in a
later change to fix this behavior within 'git sparse-checkout set'. The
method is carefully documented in worktree.h.

Note that we do _not_ upgrade the repository format version to 1 during
this process. The worktree config extension must be considered by Git
and third-party tools even if core.repositoryFormatVersion is 0 for
historical reasons documented in 11664196ac ("Revert
"check_repository_format_gently(): refuse extensions for old
repositories"", 2020-07-15). This is a special case for this extension,
and newer extensions (such as extensions.objectFormat) still need to
upgrade the repository format version.

Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: simplify find_shared_symref() memory ownership model</title>
<updated>2021-12-02T06:18:25Z</updated>
<author>
<name>Anders Kaseorg</name>
<email>andersk@mit.edu</email>
</author>
<published>2021-12-01T22:15:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c8dd491fa5b57ecfd9ef33ae5291eb2a9402cd59'/>
<id>urn:sha1:c8dd491fa5b57ecfd9ef33ae5291eb2a9402cd59</id>
<content type='text'>
Storing the worktrees list in a static variable meant that
find_shared_symref() had to rebuild the list on each call (which is
inefficient when the call site is in a loop), and also that each call
invalidated the pointer returned by the previous call (which is
confusing).

Instead, make it the caller’s responsibility to pass in the worktrees
list and manage its lifetime.

Signed-off-by: Anders Kaseorg &lt;andersk@mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
