git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Steven Michalske <smichalske@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Ignoring remote branches.
Date: Wed, 12 May 2010 05:25:12 -0500	[thread overview]
Message-ID: <20100512102512.GA17810@progeny.tock> (raw)
In-Reply-To: <9F4F3DE1-59FE-4D27-A40E-81856BF95C9D@gmail.com>

Hi Steven,

Steven Michalske wrote:

> I want to track new branches, so specifying the branches I want
> to fetch is tedious.
> 
> Any workarounds to ignore all branches that match *.stgit

I would suggest using ‘git ls-remote’ and ‘git fetch’ to grab just the
branches you want.

  #!/bin/sh
  set -e

  : ${remote=origin}
  : ${options=--dry-run}
  script='!/\.stgit$/ s'
  script="${script}#.*\\trefs/heads/\\(.*\\)\$"
  script="${script}#git fetch $options $remote "
  script="${script} refs/heads/\\1:refs/remotes/$remote/\\1"
  script="${script}#p"

  eval "$(git ls-remote "$remote" | sed -n "$script")"

I am not sure how to generalize this: a pre-fetch hook that can reject
some branch names?  a fetchregexp configuration item?

 [remote "origin"]
	url = git://git.example.com/repo.git/
	fetchregexp = "refs/heads/\([^.]*\):refs/remotes/origin/\1"

Maybe we can solve some similar problems at the same time.

Thanks,
Jonathan

      reply	other threads:[~2010-05-12 10:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11  7:40 Ignoring remote branches Steven Michalske
2010-05-12 10:25 ` Jonathan Nieder [this message]

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=20100512102512.GA17810@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=smichalske@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 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 NNTP newsgroup(s).