list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Jacob Keller <>
To: Jeff King <>
Cc: Git mailing list <>
Subject: Re: avoiding fetching specific refs from a remote
Date: Wed, 12 Aug 2020 15:04:09 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Tue, Aug 4, 2020 at 11:37 PM Jeff King <> wrote:
> On Tue, Aug 04, 2020 at 02:53:30PM -0700, Jacob Keller wrote:
> > This results in the annoying completion behavior where:
> >
> > $git checkout ma<TAB>
> > main
> > master
> >
> > Essentially, because both main and master have similar names, tab
> > completion requires remembering to type one additional character than
> > I am used to.
> Heh, I didn't think anybody considered that implication so far; the fact
> that they were similar names has generally been considered a positive. I
> agree it would be annoying.
> > I'd like to be able to customize my pull so that I either (a) exclude
> > the reference when performing a fetch, or (b) exclude the reference
> > when tab completing.
> Not quite (b), but if you:
>   - delete any local "master" branch, if you haven't already
> then it shouldn't complete "master". The second is necessary because
> we'd try to complete the magic "git checkout master" that auto-creates
> the branch from the remote version.
> > something like adding a remote.<name>.excludeRefs which would allow
> > specifying a set of references to exclude from matching the refspec..
> >
> > I realize I could customize the refspec to list the set of things I
> > want, but then I would miss any potential future branches until I
> > updated my remote config again.
> This is definitely a reasonable thing to want, and it has come up off
> and on over the years. One search term for the list archive is "negative
> refspecs", though it turns up a lot of useless hits when the two words
> are not directly adjacent.
> This old thread might be worth reading:
> and there is even a patch in there:
> but I didn't go over it carefully enough to know whether it is utter
> trash, or something that could be used as a starting point.
> -Peff

I dug up the patch and have applied it to master. One concern I have
is how do we tell what side the negative refspec applies to? It seems
like we'd need to be able to distinguish whether it applies to the
refname on the remote, or the refname on the local branch. The patch
as-is assumes that negative refspecs only ever have "src".. I guess
for fetch that means the name of the ref on the remote, and for push
that means the name of the ref on the local end?

I was trying to modify the patch to add support to the push code flows
so that it was more complete and could be submitted. I'll be sending
what I have as an RFC soon.


  parent reply	other threads:[~2020-08-12 22:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 21:53 Jacob Keller
2020-08-05  6:37 ` Jeff King
2020-08-05 16:22   ` Junio C Hamano
2020-08-05 20:34     ` Jacob Keller
2020-08-05 20:34     ` Jeff King
2020-08-05 20:31   ` Jacob Keller
2020-08-05 22:12   ` Philippe Blain
2020-08-07  8:04     ` Eric Wong
2020-08-12 22:04   ` Jacob Keller [this message]
2020-08-13  8:48     ` Jeff King

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:

  List information:

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

  git send-email \ \ \ \ \
    --subject='Re: avoiding fetching specific refs from a remote' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

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).