All of lore.kernel.org
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH/RFD 3/6] rev-list: list all heads with --all
Date: Sat, 27 Feb 2016 09:15:55 +0700	[thread overview]
Message-ID: <CACsJy8CrYYjiyeKZuHW=erJ-JZyaWdJKCAzO=zLs2HwSb5ifKA@mail.gmail.com> (raw)
In-Reply-To: <61d93b0aba1d4cb7348066db0b48f1ce2d5b35c5.1456504190.git.git@drmicha.warpmail.net>

On Fri, Feb 26, 2016 at 11:39 PM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> HEAD is a worktree specific sysmref, so that a repository with multiple
> worktrees can have multiple HEADs, or HEADs in a worktree different from
> the current worktree.
>
> So far, "rev-parse --all" adds only the HEAD from the current worktree
> to the list of refs (besides branches etc.). So, a detached HEAD from a
> different checkout would be missed unless a shared ref (or current HEAD)
> points to it (or descents from it). As a consequence, "git prune" can
> prune detached HEADs from worktrees and leave the repo in an
> inconsistent state.
>
> Make "rev-parse --all" add the HEADs from all worktrees. This results in
> a non-worktree-specific ref list and solves the pruning problem.
>
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
>
> Notes:
>     This patch solves the pruning problem with worktrees, but I feel quite
>     uneasy about substituting the ref solving at the very heart of refs.c. So
>     please consider this a mere poc and a request for discussion/input
>     about how to do this the right way.
>
>     In essence, I feel the worktree interface still has to evolve a bit: I'd
>     rather for_each_worktree than loop myself, and if many call sites need to
>     be aware of multiple heads or worktrees than get_worktrees() should be
>     part of our init stuff, not here. [I may be out of sync of newer progress.]

How about adding for_each_head_ref_submodule()  and make
handle_revision_pseudo_opt() use it with a new option, .e.g
--all-work-trees?

I looked over head_ref and head_ref_submodule call sites. I think
we're ok. Most of them only concern about "our head". for-each-ref may
need some improvement though.
-- 
Duy

  reply	other threads:[~2016-02-27  2:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 16:39 [PATCH/WIP 0/6] Detached HEADs in new worktrees considered harmful Michael J Gruber
2016-02-26 16:39 ` [PATCH 1/6] Documentation/git-worktree: spell --detach correctly Michael J Gruber
2016-02-26 17:52   ` Junio C Hamano
2016-02-26 16:39 ` [PATCH 2/6] t6014: test prune with detached HEADs in separate worktrees Michael J Gruber
2016-02-26 18:03   ` Junio C Hamano
2016-02-26 16:39 ` [PATCH/RFD 3/6] rev-list: list all heads with --all Michael J Gruber
2016-02-27  2:15   ` Duy Nguyen [this message]
2016-02-26 16:39 ` [PATCH 4/6] WIP: mess only with mark_reachable Michael J Gruber
2016-02-26 16:39 ` [PATCH 5/6] WIP: fix unborn branch case Michael J Gruber
2016-02-26 16:39 ` [PATCH 6/6] revisions: list all worktree HEADs with --all Michael J Gruber
2016-02-26 17:37 ` [PATCH/WIP 0/6] Detached HEADs in new worktrees considered harmful 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='CACsJy8CrYYjiyeKZuHW=erJ-JZyaWdJKCAzO=zLs2HwSb5ifKA@mail.gmail.com' \
    --to=pclouds@gmail.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.