git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Ignoring remote branches.
@ 2010-05-11  7:40 Steven Michalske
  2010-05-12 10:25 ` Jonathan Nieder
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Michalske @ 2010-05-11  7:40 UTC (permalink / raw)
  To: Git Mailing List

Howdy,

I would like to know a way to exclude fetching stacked git branches  
from repositories.

But 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

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Ignoring remote branches.
  2010-05-11  7:40 Ignoring remote branches Steven Michalske
@ 2010-05-12 10:25 ` Jonathan Nieder
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Nieder @ 2010-05-12 10:25 UTC (permalink / raw)
  To: Steven Michalske; +Cc: Git Mailing List

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-12 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11  7:40 Ignoring remote branches Steven Michalske
2010-05-12 10:25 ` Jonathan Nieder

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