git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [RFC/PATCH 3/3] push: add 'prune' option
Date: Fri, 17 Feb 2012 17:25:07 -0500	[thread overview]
Message-ID: <20120217222507.GA31830@sigill.intra.peff.net> (raw)
In-Reply-To: <1329505957-24595-4-git-send-email-felipe.contreras@gmail.com>

On Fri, Feb 17, 2012 at 09:12:37PM +0200, Felipe Contreras wrote:

> This will allow us to remove refs from the remote that have been removed
> locally.
> 
> It's useful to conveniently synchronize all the local branches to
> certain remote.

Thanks for picking up this topic again.

There's one subtlety in the motivation above that you may find helpful
when you end up writing the documentation: "push --mirror" already does
this sort of pruning, but it _also_ implies that we are pushing
"refs/*:refs/*".  So this is really about giving access to the pruning
half, but still being able to use custom refspecs. So the features
together might end up being explained something like:

  --prune::
    ... prune things that no longer exist locally ...

  --mirror::
    ... turn on --prune, and also match all refs ...

At least that is my understanding of how the code is meant to work.

>  builtin/push.c |    2 ++
>  remote.c       |   29 ++++++++++++++++++++++++++---
>  remote.h       |    3 ++-
>  transport.c    |    2 ++
>  transport.h    |    1 +
>  5 files changed, 33 insertions(+), 4 deletions(-)

I've just given a quick read to the patches so far, but I did notice
this:

>  static char *check_pattern_match(const struct refspec *rs, int rs_nr, struct ref *ref,
> -		int send_mirror, const struct refspec **ret_pat)
> +		int send_mirror, int dir, const struct refspec **ret_pat)

The "dir" flag looks like it is meant to be short for "direction". But
the callers only pass 0 or 1.  I'm not clear which direction is which.
Either symbolic constants for directions, or perhaps giving it a more
boolean name like "match_to_dst" might make it more clear.

I'll try to take a closer look later tonight.

-Peff

  reply	other threads:[~2012-02-17 22:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17 19:12 [RFC/PATCH 0/3] push: add 'prune' option Felipe Contreras
2012-02-17 19:12 ` [RFC/PATCH 1/3] remote: use a local variable in match_push_refs() Felipe Contreras
2012-02-17 22:31   ` Junio C Hamano
2012-02-17 19:12 ` [RFC/PATCH 2/3] remote: reorganize check_pattern_match() Felipe Contreras
2012-02-17 22:34   ` Junio C Hamano
2012-02-22 20:15     ` Felipe Contreras
2012-02-22 21:02       ` Junio C Hamano
2012-02-17 19:12 ` [RFC/PATCH 3/3] push: add 'prune' option Felipe Contreras
2012-02-17 22:25   ` Jeff King [this message]
2012-02-17 22:34   ` Junio C Hamano
2012-02-22 20:43     ` Felipe Contreras
2012-02-22 20:56       ` Junio C Hamano
2012-02-22 23:06       ` Felipe Contreras
2012-02-22 23:54         ` Junio C Hamano
2012-02-21 15:30 ` [RFC/PATCH 0/3] " Nguyen Thai Ngoc Duy
2012-02-21 17:35   ` Jeff King
2012-02-22  1:45     ` Nguyen Thai Ngoc Duy

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=20120217222507.GA31830@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).