<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/worktree.h, branch gitk-resize-error</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=gitk-resize-error</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=gitk-resize-error'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2021-12-02T06:18:25Z</updated>
<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='http://git.kilabit.info/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>
<entry>
<title>worktree: teach worktree to lazy-load "prunable" reason</title>
<updated>2021-01-30T17:57:16Z</updated>
<author>
<name>Rafael Silva</name>
<email>rafaeloliveira.cs@gmail.com</email>
</author>
<published>2021-01-19T21:27:34Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=fc0c7d5e9e9e396afdd669019e7635773b1d1423'/>
<id>urn:sha1:fc0c7d5e9e9e396afdd669019e7635773b1d1423</id>
<content type='text'>
Add worktree_prune_reason() to allow a caller to discover whether a
worktree is prunable and the reason that it is, much like
worktree_lock_reason() indicates whether a worktree is locked and the
reason for the lock. As with worktree_lock_reason(), retrieve the
prunable reason lazily and cache it in the `worktree` structure.

Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Rafael Silva &lt;rafaeloliveira.cs@gmail.com&gt;
Reviewed-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: libify should_prune_worktree()</title>
<updated>2021-01-30T17:57:08Z</updated>
<author>
<name>Rafael Silva</name>
<email>rafaeloliveira.cs@gmail.com</email>
</author>
<published>2021-01-19T21:27:33Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a29a8b7574ab34026252691933f462eddc59146a'/>
<id>urn:sha1:a29a8b7574ab34026252691933f462eddc59146a</id>
<content type='text'>
As part of teaching "git worktree list" to annotate worktree that is a
candidate for pruning, let's move should_prune_worktree() from
builtin/worktree.c to worktree.c in order to make part of the worktree
public API.

should_prune_worktree() knows how to select the given worktree for
pruning based on an expiration date, however the expiration value is
stored in a static file-scope variable and it is not local to the
function. In order to move the function, teach should_prune_worktree()
to take the expiration date as an argument and document the new
parameter that is not immediately obvious.

Also, change the function comment to clearly state that the worktree's
path is returned in `wtpath` argument.

Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Rafael Silva &lt;rafaeloliveira.cs@gmail.com&gt;
Reviewed-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ma/worktree-cleanups'</title>
<updated>2020-10-05T21:01:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-10-05T21:01:52Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=07601b5b360264a74f94d74640999ea19cf61517'/>
<id>urn:sha1:07601b5b360264a74f94d74640999ea19cf61517</id>
<content type='text'>
Code clean-up.

* ma/worktree-cleanups:
  worktree: use skip_prefix to parse target
  worktree: rename copy-pasted variable
  worktree: update renamed variable in comment
  worktree: inline `worktree_ref()` into its only caller
  wt-status: introduce wt_status_state_free_buffers()
  wt-status: print to s-&gt;fp, not stdout
  wt-status: replace sha1 mentions with oid
</content>
</entry>
<entry>
<title>worktree: inline `worktree_ref()` into its only caller</title>
<updated>2020-09-27T21:21:47Z</updated>
<author>
<name>Martin Ågren</name>
<email>martin.agren@gmail.com</email>
</author>
<published>2020-09-27T13:15:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=ef2d5547fa342197befd4be599438d7a7fa41e04'/>
<id>urn:sha1:ef2d5547fa342197befd4be599438d7a7fa41e04</id>
<content type='text'>
We have `strbuf_worktree_ref()`, which works on a strbuf, and a wrapper
for it, `worktree_ref()` which returns a string. We even make this
wrapper available through worktree.h. But it only has a single caller,
sitting right next to it in worktree.c.

Just inline the wrapper into its only caller. This means the caller can
quite naturally reuse a single strbuf. We currently achieve something
similar by having a static strbuf in the wrapper.

Signed-off-by: Martin Ågren &lt;martin.agren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: teach "repair" to fix outgoing links to worktrees</title>
<updated>2020-08-31T18:47:45Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2020-08-31T06:57:58Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=b214ab5aa597e748c228e657d4eb7c18960e6a67'/>
<id>urn:sha1:b214ab5aa597e748c228e657d4eb7c18960e6a67</id>
<content type='text'>
The .git/worktrees/&lt;id&gt;/gitdir file points at the location of a linked
worktree's .git file. Its content must be of the form
/path/to/worktree/.git (from which the location of the worktree itself
can be derived by stripping the "/.git" suffix). If the gitdir file is
deleted or becomes corrupted or outdated, then Git will be unable to
find the linked worktree. An easy way for the gitdir file to become
outdated is for the user to move the worktree manually (without using
"git worktree move"). Although it is possible to manually update the
gitdir file to reflect the new linked worktree location, doing so
requires a level of knowledge about worktree internals beyond what a
user should be expected to know offhand.

Therefore, teach "git worktree repair" how to repair broken or outdated
.git/worktrees/&lt;id&gt;/gitdir files automatically. (For this to work, the
command must either be invoked from within the worktree whose gitdir
file requires repair, or from within the main or any linked worktree by
providing the path of the broken worktree as an argument to "git
worktree repair".)

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: teach "repair" to fix worktree back-links to main worktree</title>
<updated>2020-08-31T18:47:45Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2020-08-31T06:57:57Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=bdd1f3e4da716012a52194cdfbc9c80dfdce87d4'/>
<id>urn:sha1:bdd1f3e4da716012a52194cdfbc9c80dfdce87d4</id>
<content type='text'>
The .git file in a linked worktree is a "gitfile" which points back to
the .git/worktrees/&lt;id&gt; entry in the main worktree or bare repository.
If a worktree's .git file is deleted or becomes corrupted or outdated,
then the linked worktree won't know how to find the repository or any of
its own administrative files (such as 'index', 'HEAD', etc.). An easy
way for the .git file to become outdated is for the user to move the
main worktree or bare repository. Although it is possible to manually
update each linked worktree's .git file to reflect the new repository
location, doing so requires a level of knowledge about worktree
internals beyond what a user should be expected to know offhand.

Therefore, teach "git worktree repair" how to repair broken or outdated
worktree .git files automatically. (For this to work, the command must
be invoked from within the main worktree or bare repository, or from
within a worktree which has not become disconnected from the repository
-- such as one which was created after the repository was moved.)

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: drop get_worktrees() unused 'flags' argument</title>
<updated>2020-06-22T17:31:15Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2020-06-19T23:35:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=03f2465bb1c1d9222181c493373e668c0ba7eb51'/>
<id>urn:sha1:03f2465bb1c1d9222181c493373e668c0ba7eb51</id>
<content type='text'>
get_worktrees() accepts a 'flags' argument, however, there are no
existing flags (the lone flag GWT_SORT_LINKED was recently retired) and
no behavior which can be tweaked. Therefore, drop the 'flags' argument.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: drop get_worktrees() special-purpose sorting option</title>
<updated>2020-06-22T17:30:29Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2020-06-19T23:35:43Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d9c54c2bbf684ca3903bc2227c81f657a557d8b8'/>
<id>urn:sha1:d9c54c2bbf684ca3903bc2227c81f657a557d8b8</id>
<content type='text'>
Of all the clients of get_worktrees(), only "git worktree list" wants
the list sorted in a very specific way; other clients simply don't care
about the order. Rather than imbuing get_worktrees() with special
knowledge about how various clients -- now and in the future -- may want
the list sorted, drop the sorting capability altogether and make it the
client's responsibility to sort the list if needed.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: add utility to find worktree by pathname</title>
<updated>2020-02-24T21:04:30Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2020-02-24T09:08:47Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=bb4995fc3fab35b56f1ca48cda9187bcf340e643'/>
<id>urn:sha1:bb4995fc3fab35b56f1ca48cda9187bcf340e643</id>
<content type='text'>
find_worktree() employs heuristics to match user provided input -- which
may be a pathname or some sort of shorthand -- with an actual worktree.
Although this convenience allows a user to identify a worktree with
minimal typing, the black-box nature of these heuristics makes it
potentially difficult for callers which already know the exact path of a
worktree to be confident that the correct worktree will be returned for
any specific pathname (particularly a relative one), especially as the
heuristics are enhanced and updated.

Therefore, add a companion function, find_worktree_by_path(), which
deterministically identifies a worktree strictly by pathname with no
interpretation and no magic matching.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
