git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Felipe ContrerasNext: Junio C Hamano
Message 9 of 17 in “push: add 'prune' option”
  1. 0/3 push: add 'prune' optionFelipe Contreras, Feb 17, 2012
  2. 1/3 remote: use a local variable in match_push_refs()Felipe Contreras, Feb 17, 2012
  3. Junio C HamanoFeb 17, 2012
  4. 2/3 remote: reorganize check_pattern_match()Felipe Contreras, Feb 17, 2012
  5. Junio C HamanoFeb 17, 2012
  6. Felipe ContrerasFeb 22, 2012
  7. Junio C HamanoFeb 22, 2012
  8. 3/3 push: add 'prune' optionFelipe Contreras, Feb 17, 2012
  9. Jeff KingFeb 17, 2012
  10. Junio C HamanoFeb 17, 2012
  11. Felipe ContrerasFeb 22, 2012
  12. Junio C HamanoFeb 22, 2012
  13. Felipe ContrerasFeb 22, 2012
  14. Junio C HamanoFeb 22, 2012
  15. Nguyen Thai Ngoc DuyFeb 21, 2012
  16. Jeff KingFeb 21, 2012
  17. Nguyen Thai Ngoc DuyFeb 22, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.