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

[RFC 00/11] Make reference pruning more configurable

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Dec 4, 2013, 05:44 UTC
Message-ID
<1386135890-13954-1-git-send-email-mhagger@alum.mit.edu>
This patch series applies on top of
    mh/fetch-tags-in-addition-to-normal-refs

and has some minor conflicts with that branch (mostly related to documentation).

Let me state in advance that I personally think that the features implemented in this patch series are overkill. But since it was already implemented, I thought I would throw it out there and see if anybody likes it.

This patch series makes it possible for the user to specify explicitly which reference namespaces should be subjected to pruning when fetching from a remote.

* It allows a <pattern> to be passed to the --prune option for the
  following commands:
      git fetch --prune=<pattern> [...]
      git remote update --prune=<pattern> [...]
      git remote prune --prune=<pattern> [...]
          Only references that match the specified pattern(s) are
          considered for pruning.
      git remote show --prune=<pattern> [...]
          Only show prunable references that match the specified
          pattern(s).
  The --prune=<pattern> option can be specified multiple times.
* It introduces the following multivalued configuration values:
      fetch.pruneRef
      remote.<name>.pruneRef
          Configuration settings for setting the default
          "--prune=<pattern>" options, globally and per-remote.
Background: I started working on this feature as my first approach to
solving the problem that
    git fetch --tags --prune

can nuke tags unrelated to the remote being fetched from. Only later did I hit upon the better solution that is implemented in mh/fetch-tags-in-addition-to-normal-refs, namely to change the semantics of the --tags option to *not* subject tags to pruning.

But even though "--prune=<pattern>" is no longer needed to prevent tag nuking, it might be useful to somebody for other purposes, and therefore I am submitting it to the list as an RFC. Maybe there is a use case associated with non-branch, non-tag references, like perhaps Gerrit pull request-related references?

Personally, I am -0 on this series. I think it adds more complication (code, documentation, etc) than its usefulness justifies. I think the functionality in mh/fetch-tags-in-addition-to-normal-refs (which we want in any case!) will satisfy 99% of users and I can't think of use cases where additional configurability of reference pruning is needed.

So, if anybody can think of a compelling use case for this feature, please make your case!

Michael
Michael Haggerty (11):
  get_stale_heads(): allow limiting to refname patterns
  remote.c: add infrastructure for parsing --prune options
  fetch: use the new functions for handling --prune options
  remote: use the new functions for handling --prune options
  remote.c: add infrastructure to handle --prune=<pattern>
  fetch --prune: allow refname patterns to be specified
  remote update --prune: allow refname patterns to be specified
  string_list_append_list(): new function
  remote prune: allow --prune=<pattern> options
  remote show: allow --prune=<pattern> options
  remote: allow prune patterns to be configured
 Documentation/config.txt                    |  28 ++++--
 Documentation/fetch-options.txt             |  13 ++-
 Documentation/git-remote.txt                |  29 +++++--
 Documentation/technical/api-string-list.txt |  10 ++-
 builtin/fetch.c                             |  43 +++------
 builtin/remote.c                            |  85 ++++++++++++------
 remote.c                                    | 130 +++++++++++++++++++++++++++-
 remote.h                                    |  48 +++++++++-
 string-list.c                               |   9 ++
 string-list.h                               |   8 ++
 t/t5505-remote.sh                           |  88 +++++++++++++++++++
 t/t5510-fetch.sh                            |  25 ++++++
 12 files changed, 441 insertions(+), 75 deletions(-)
-- 
1.8.4.3
Next: Michael Haggerty
Message 1 of 15 in “[RFC 00/11] Make reference pruning more configurable”
  1. Michael HaggertyDec 4, 2013
  2. 01/11 get_stale_heads(): allow limiting to refname patternsMichael Haggerty, Dec 4, 2013
  3. 02/11 remote.c: add infrastructure for parsing --prune optionsMichael Haggerty, Dec 4, 2013
  4. Duy NguyenDec 4, 2013
  5. Michael HaggertyDec 4, 2013
  6. 03/11 fetch: use the new functions for handling --prune optionsMichael Haggerty, Dec 4, 2013
  7. 04/11 remote: use the new functions for handling --prune optionsMichael Haggerty, Dec 4, 2013
  8. 05/11 remote.c: add infrastructure to handle --prune=<pattern>Michael Haggerty, Dec 4, 2013
  9. 06/11 fetch --prune: allow refname patterns to be specifiedMichael Haggerty, Dec 4, 2013
  10. 07/11 remote update --prune: allow refname patterns to be specifiedMichael Haggerty, Dec 4, 2013
  11. 08/11 string_list_append_list(): new functionMichael Haggerty, Dec 4, 2013
  12. 09/11 remote prune: allow --prune=<pattern> optionsMichael Haggerty, Dec 4, 2013
  13. 10/11 remote show: allow --prune=<pattern> optionsMichael Haggerty, Dec 4, 2013
  14. 11/11 remote: allow prune patterns to be configuredMichael Haggerty, Dec 4, 2013
  15. Junio C HamanoDec 4, 2013

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.