From: Manish Goregaokar <manishearth@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Manish Goregaokar" <manishearth@gmail.com>,
git@vger.kernel.org, "Michael Haggerty" <mhagger@alum.mit.edu>,
"Jeff King" <peff@peff.net>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH v2 1/2] refs: Add for_each_worktree_ref for iterating over all worktree HEADs
Date: Sat, 20 May 2017 10:33:25 -0700 [thread overview]
Message-ID: <CACpkpxmGzz0hUsypX5ORX7FLB3rh_xbyPOKz4SUt-zrjSjCq_g@mail.gmail.com> (raw)
In-Reply-To: <xmqqy3trstup.fsf@gitster.mtv.corp.google.com>
Yes, you are right (on both counts).
One thing which I think hasn't been covered yet is the rebase
ORIG_HEAD. I'll see if that's still a problem on `pu` and make a patch
for it if so.
(I recall `git prune` during a rebase messing up repo state, though
it's really my fault for trying that in the first place. Would be nice
if it worked, though)
-Manish Goregaokar
On Sat, May 20, 2017 at 3:30 AM, Junio C Hamano <gitster@pobox.com> wrote:
> manishearth@gmail.com writes:
>
>> +int for_each_worktree_ref(each_ref_fn fn, void *cb_data)
>> +{
>> + int i, flag, retval = 0;
>> + struct object_id oid;
>> + struct worktree **worktrees = get_worktrees(GWT_SORT_LINKED);
>> + struct commit* commit;
>> + for (i = 0; worktrees[i]; i++) {
>> + if ((commit = lookup_commit_reference(worktrees[i]->head_sha1))) {
>> + oid = commit->object.oid;
>> + if (!read_ref_full("HEAD", RESOLVE_REF_READING, oid.hash, &flag)) {
>> + if ((retval = fn("HEAD", &oid, flag, cb_data)))
>> + return retval;
>> + }
>> + }
>> + }
>> + return retval;
>> +}
>
> I would have expected for-each-worktree-ref to iterate over all the
> refs in a given worktree, but that is not what this does. This
> instead iterates over worktrees and shows only their HEAD ref, no
> other refs. This helper is somewhat misnamed.
>
> By the way, doesn't nd/prune-in-worktree topic that has been cooking
> in 'pu' supersede this change? It not just protects the commit at
> the tip of HEAD in each worktree, it also makes sure the ones in
> HEAD's reflog are not prematurely pruned.
>
> Thanks.
>
next prev parent reply other threads:[~2017-05-20 17:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 0:07 [PATCH 1/2] refs: Add for_each_worktree_ref for iterating over all worktree HEADs Manish Goregaokar
2017-05-17 0:08 ` Manish Goregaokar
2017-05-17 0:28 ` Jonathan Nieder
2017-05-17 0:50 ` manish.earth
2017-05-17 0:50 ` [PATCH 2/2] reachable: Add HEADs of all worktrees to reachability analysis manish.earth
2017-05-17 0:55 ` [PATCH 1/2] refs: Add for_each_worktree_ref for iterating over all worktree HEADs Manish Goregaokar
2017-05-17 21:48 ` Manish Goregaokar
2017-05-18 0:07 ` Brandon Williams
2017-05-18 1:16 ` Manish Goregaokar
2017-05-18 1:42 ` [PATCH v2 " manishearth
2017-05-18 1:42 ` [PATCH v2 2/2] reachable: Add HEADs of all worktrees to reachability analysis manishearth
2017-05-18 1:45 ` [PATCH v2 1/2] refs: Add for_each_worktree_ref for iterating over all worktree HEADs Manish Goregaokar
2017-05-18 9:40 ` Simon Ruderich
2017-05-18 20:29 ` Samuel Lijin
2017-05-18 21:06 ` Brandon Williams
2017-05-20 10:30 ` Junio C Hamano
2017-05-20 17:33 ` Manish Goregaokar [this message]
2017-05-20 23:49 ` Junio C Hamano
2017-05-22 11:17 ` Duy Nguyen
2017-05-22 22:52 ` Manish Goregaokar
2017-05-25 12:51 ` Duy Nguyen
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=CACpkpxmGzz0hUsypX5ORX7FLB3rh_xbyPOKz4SUt-zrjSjCq_g@mail.gmail.com \
--to=manishearth@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
/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).