All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git mailing list <git@vger.kernel.org>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Pavel Rappo <pavel.rappo@gmail.com>
Subject: Re: [PATCH] remote: handle negative refspecs in git remote show
Date: Thu, 16 Jun 2022 15:09:54 -0700	[thread overview]
Message-ID: <CA+P7+xrx-Cec0mUJvDtWn0Fxu5vLdVkTbteWKiZyouH=64pWvA@mail.gmail.com> (raw)
In-Reply-To: <xmqqletwqnse.fsf@gitster.g>

On Thu, Jun 16, 2022 at 2:52 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Jacob Keller <jacob.keller@gmail.com> writes:
>
> >> This is somewhat curious.  Do we really need to destroy the
> >> fetch_map like the above?  I know by removing skipped items from the
> >> list, the existing loop (below) can stop having to worry about them,
> >> but the caller of get_ref_states() may later want to iterate over
> >> the full fetch_map for other reasons (even if the current one does
> >> not, a future version of the caller may have a reason to do so that
> >> we do not know right now yet).
> >>
> >
> > Good point. I'll fix this. I think we can just move the
> > omit_name_by_refspec into the other loop.
> >
> >> > +
> >> >       for (ref = fetch_map; ref; ref = ref->next) {
> >> >               if (!ref->peer_ref || !ref_exists(ref->peer_ref->name))
> >> >                       string_list_append(&states->new_refs, abbrev_branch(ref->name));
> >>
> >> IOW, is adding a new condition to this existing loop insufficient?
> >>
> >
> > The tricky part here is that we don't have a simple check, and we're
> > currently iterating over all of the refspecs each time. But we have to
> > do that regardless so I think this makes sense. Will fix.
>
> Another thing that worries me is that get_stale_heads() will not see
> the filtered refs with your original implementation, because you cull
> them from the fetch_map in the extra loop upfront.
>

I think the new implementation fixed this, but I'll see about adding a test!

> I do not know offhand what its effect would be, but it probably is
> worth testing.  In your original scenario, if we locally have
> refs/remotes/jdk19/old and refs/remotes/jdk19/pr/1 (perhaps obtained
> before we configured ^refs/pr/* negative refspec), we'd want to see
> that pr/1 exists here but will not be updated.
>

Yea, I will see if I can check that.

>   * remote jdk19
>     Fetch URL: git@github.com:openjdk/jdk19.git
>     Push  URL: git@github.com:openjdk/jdk19.git
>     HEAD branch: master
>     Remote branches:
>       master tracked
>       old    stale
>       pr/1   stale
>       pr/2   skipped
>       pr/3   skipped
>     Local ref configured for 'git push':
>       master pushes to master (fast-forwardable)

  reply	other threads:[~2022-06-16 22:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14  0:32 [PATCH] remote: handle negative refspecs in git remote show Jacob Keller
2022-06-14  1:03 ` Taylor Blau
2022-06-14  1:56   ` Jacob Keller
2022-06-14  2:26     ` Taylor Blau
2022-06-16 20:48       ` Jacob Keller
2022-06-14  6:09   ` Jacob Keller
2022-06-15 21:44 ` Junio C Hamano
2022-06-16 20:41   ` Jacob Keller
2022-06-16 21:52     ` Junio C Hamano
2022-06-16 22:09       ` Jacob Keller [this message]
2022-06-16 22:33         ` Jacob Keller

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='CA+P7+xrx-Cec0mUJvDtWn0Fxu5vLdVkTbteWKiZyouH=64pWvA@mail.gmail.com' \
    --to=jacob.keller@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.e.keller@intel.com \
    --cc=pavel.rappo@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.
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.