git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Sam Bostock via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,  Sam Bostock <sam.bostock@shopify.com>
Subject: Re: [PATCH] worktree: clarify --expire applies to missing worktrees
Date: Sat, 20 Dec 2025 14:44:15 +0900	[thread overview]
Message-ID: <xmqq4iplvhao.fsf@gitster.g> (raw)
In-Reply-To: <CAPig+cTC8ROsf-cOhUcxovUOcQ47As496SAm7FcEFnzGChhLww@mail.gmail.com> (Eric Sunshine's message of "Fri, 19 Dec 2025 10:11:36 -0500")

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Fri, Dec 19, 2025 at 10:01 AM Sam Bostock via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>> The `--expire` option for `git worktree list` and `git worktree prune`
>> only affects worktrees whose working directory path no longer exists.
>> The help text did not make this clear, and the documentation
>> inconsistently used "unused" for prune but "missing" for list.
>>
>> This updates the help text and documentation to consistently describe
>> these as "missing worktrees".
>>
>> Signed-off-by: Sam Bostock <sam@sambostock.ca>
>> ---
>
> This change makes sense to me; it certainly helps clarify the meaning.
> One or two comments (below)...
>
>> diff --git a/Documentation/git-worktree.adoc b/Documentation/git-worktree.adoc
>> @@ -271,7 +271,7 @@ mismatch, even if the links are correct.
>>  `--expire <time>`::
>> -       With `prune`, only expire unused worktrees older than _<time>_.
>> +       With `prune`, only expire missing worktrees older than _<time>_.
>
> Rather than saying that this "expires", I wonder if it would be even
> clearer to say that it prunes or removes information about missing
> worktrees. Something like:
>
>     With `prune`, only prune missing worktrees if older than _<time>_.

Yup, and a very related tangent.

The entry for 'prune' itself reads like this:

        `prune`::
        Prune worktree information in `$GIT_DIR/worktrees`.

In general (see recent topics by Julia, for example), it is risky to
explain option DOSOMETHING in terms of the same verb dosomething.
It may serve as a memory aid, but at the same time, if the verb
dosomething is not in everyday lingo, can mean different things, or
we use it a bit differently from the common uses, explaining the
option using a more familiar verb may be helpful, especially to non
native audiences.

In the context of *removing* a worktree, there are potentially three
situations.

 (1) the user has both the working tree and the control info
     healthy, and they no longer needs it (i.e., "git worktree
     remove")

 (2) the user still has the working tree, but somehow lost the
     control info.  Git does not have a direct way to remove the
     working tree and we expect the user to do "rm -rf" the
     remaining working tree.

 (3) the user somehow has lost the working tree but the control info
     remains, and they want to remove the useless entry from "git
     worktree list".  This is what "git worktree prune" is about.

It would have been nice if we could arrange the situation (2) and
(3) to be impossible to get into, but running "rm -rf" on random
directories is not a privileged operation on most systems, so the
users can easily get into them, especially (3).  It would be very
nice if we can find a better wording than "Prune worktree info" to
explain the 'prune' operation.

I wonder if this would work better.

	`prune`::
		Remove worktree information in `$GIT_DIR/worktrees`
		only, without touching the working tree.  This is
		often needed when the working tree is lost (e.g.,
		the user manually removed it) and the worktree
		information has become dangling.


  reply	other threads:[~2025-12-20  5:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19 15:00 [PATCH] worktree: clarify --expire applies to missing worktrees Sam Bostock via GitGitGadget
2025-12-19 15:11 ` Eric Sunshine
2025-12-20  5:44   ` Junio C Hamano [this message]
2025-12-20  7:14     ` Eric Sunshine
2025-12-20  7:31       ` Junio C Hamano
2025-12-20  8:23         ` Eric Sunshine
2025-12-19 18:16 ` [PATCH v2 0/2] " Sam Bostock via GitGitGadget
2025-12-19 18:16   ` [PATCH v2 1/2] " Sam Bostock via GitGitGadget
2025-12-20  6:07     ` Junio C Hamano
2025-12-19 18:16   ` [PATCH v2 2/2] worktree: use 'prune' instead of 'expire' in help text Sam Bostock via GitGitGadget
2025-12-20  6:11     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4iplvhao.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=sam.bostock@shopify.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).