git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Rafael Silva <rafaeloliveira.cs@gmail.com>,
	Git List <git@vger.kernel.org>
Subject: Re: [RFC PATCH 1/2] worktree: teach `list` to mark locked worktree
Date: Wed, 30 Sep 2020 03:35:07 -0400	[thread overview]
Message-ID: <CAPig+cQHDuWy1vc_ngXbMQZQ=a9fd6S5_cCU-2sb_+Te5aEOhw@mail.gmail.com> (raw)
In-Reply-To: <xmqq8sctlgzx.fsf@gitster.c.googlers.com>

On Mon, Sep 28, 2020 at 5:38 PM Junio C Hamano <gitster@pobox.com> wrote:
> Rafael Silva <rafaeloliveira.cs@gmail.com> writes:
> > The output of `worktree list` command is extended to mark a locked
> > worktree with `(locked)` text. This is used to communicate to the
> > user that a linked worktree is locked instead of learning only when
> > attempting to remove it.
>
> For this change, it might look like this:
>
>     The "git worktree list" shows the absolute path to the working
>     tree, the commit that is checked out and the name of the branch.
>     It is not immediately obvious which of the worktrees, if any,
>     are locked.
>
>     "git worktree remove" refuses to remove a locked worktree with
>     an error message.  If "git worktree list" told which worktrees
>     are locked in its output, the user would not even attempt to
>     remove such a worktree.

Nicely written. I might end the final sentence like this:

    ... the user would not even attempt to remove such a worktree or
    would know to use `git worktree remove -f -f <path>`.

> > diff --git a/builtin/worktree.c b/builtin/worktree.c
> > @@ -676,8 +676,12 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)
> > +     if (!is_main_worktree(wt) &&
> > +         worktree_lock_reason(wt))
> > +             strbuf_addstr(&sb, " (locked)");
>
> Is this because for the primary worktree, worktree_lock_reason()
> will always yield true?
>
>     ... goes and looks ...
>
> Ah, OK, the callers are not even allowed to ask the question on the
> primary one.  That's a bit strange API but OK.

That is indeed a slightly hostile API, and it wouldn't hurt to change
it simply to return 'false' for the main worktree, but that's not
something this patch series need tackle.

  parent reply	other threads:[~2020-09-30  7:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 15:49 [RFC PATCH 0/2] teach `worktree list` to mark locked worktrees Rafael Silva
2020-09-28 15:49 ` [RFC PATCH 1/2] worktree: teach `list` to mark locked worktree Rafael Silva
2020-09-28 21:37   ` Junio C Hamano
2020-09-29 21:36     ` Rafael Silva
2020-09-30  7:35     ` Eric Sunshine [this message]
2020-09-28 15:49 ` [RFC PATCH 2/2] t2402: add test to locked linked worktree marker Rafael Silva
2020-09-28 21:54   ` Junio C Hamano
2020-09-29 21:37     ` Rafael Silva
2020-09-30  8:06   ` Eric Sunshine
2020-09-28 21:19 ` [RFC PATCH 0/2] teach `worktree list` to mark locked worktrees Junio C Hamano
2020-09-29 21:35   ` Rafael Silva
2020-09-30  7:19 ` Eric Sunshine
2020-10-02 16:28   ` Rafael Silva
2020-10-09 22:50     ` Eric Sunshine
2020-10-10 19:06       ` Rafael Silva
2020-10-10 18:55 ` [PATCH v2 0/1] Teach "worktree list" to annotate " Rafael Silva
2020-10-10 18:55   ` [PATCH v2 1/1] worktree: teach `list` to annotate locked worktree Rafael Silva
2020-10-11  6:26     ` Eric Sunshine
2020-10-11  6:34       ` Eric Sunshine
2020-10-11 10:04       ` Rafael Silva
2020-10-11 10:11   ` [PATCH v3 0/1] Teach "worktree list" to annotate locked worktrees Rafael Silva
2020-10-11 10:11     ` [PATCH v3] worktree: teach `list` to annotate locked worktree Rafael Silva
2020-10-12  2:24       ` Eric Sunshine

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CAPig+cQHDuWy1vc_ngXbMQZQ=a9fd6S5_cCU-2sb_+Te5aEOhw@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rafaeloliveira.cs@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).