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 <gits...@pobox.com> wrote:
> manishea...@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.
>

Reply via email to