Re: [RFC/PATCH 3/3] push: add 'prune' option
- From
Jeff King <peff@peff.net>
- Date
- Feb 17, 2012, 22:25 UTC
- Message-ID
- <20120217222507.GA31830@sigill.intra.peff.net>
- 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:
Show 5 quoted lines
> 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.
Show 6 quoted lines
> 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