Subject: [PATCH 00/35] refactoring refspecs

From: Brandon Williams <[email-masked]>
Date: Mon, 14 May 2018 14:55:51 -0700

When working on protocol v2 I noticed that working with refspecs was a
little difficult because of the various api's that existed.  Some
functions expected an array of "const char *" while others expected an
array of "struct refspec".  In all cases a length parameter needed to be
passed as a parameter as well.  This makes working with refspecs a
little challenging because of the different expectations different parts
of the code base have.

This series refactors how refspecs are handled through out the code base
by renaming the existing struct refspec to refspec_item and introducing
a new 'struct refspec' which is a container of refspec_items, much like
how a pathspec contains pathspec_items.  This simplifies many callers
and makes handling pathspecs a bit easier.

I have some follow on work which I'll build on top of this series, but
since this was already getting a bit lengthy at 35 patches I'll save
that for another time.

Brandon Williams (35):
  refspec: move refspec parsing logic into its own file
  refspec: factor out parsing a single refspec
  refspec: rename struct refspec to struct refspec_item
  refspec: introduce struct refspec
  refspec: convert valid_fetch_refspec to use parse_refspec
  submodule--helper: convert push_check to use struct refspec
  pull: convert get_tracking_branch to use refspec_item_init
  transport: convert transport_push to use struct refspec
  remote: convert check_push_refs to use struct refspec
  remote: convert match_push_refs to use struct refspec
  clone: convert cmd_clone to use refspec_item_init
  fast-export: convert to use struct refspec
  remote: convert push refspecs to struct refspec
  remote: convert fetch refspecs to struct refspec
  transport-helper: convert to use struct refspec
  fetch: convert fetch_one to use struct refspec
  fetch: convert refmap to use struct refspec
  refspec: remove the deprecated functions
  fetch: convert do_fetch to take a struct refspec
  fetch: convert get_ref_map to take a struct refspec
  fetch: convert prune_refs to take a struct refspec
  remote: convert get_stale_heads to take a struct refspec
  remote: convert apply_refspecs to take a struct refspec
  remote: convert query_refspecs to take a struct refspec
  remote: convert get_ref_match to take a struct refspec
  remote: convert match_explicit_refs to take a struct refspec
  push: check for errors earlier
  push: convert to use struct refspec
  transport: convert transport_push to take a struct refspec
  send-pack: store refspecs in a struct refspec
  transport: remove transport_verify_remote_names
  http-push: store refspecs in a struct refspec
  remote: convert match_push_refs to take a struct refspec
  remote: convert check_push_refs to take a struct refspec
  submodule: convert push_unpushed_submodules to take a struct refspec

 Makefile                    |   1 +
 branch.c                    |   7 +-
 builtin/clone.c             |  13 +-
 builtin/fast-export.c       |  22 +--
 builtin/fetch.c             | 128 +++++++-------
 builtin/merge.c             |   1 +
 builtin/pull.c              |   9 +-
 builtin/push.c              |  80 ++++-----
 builtin/remote.c            |  37 ++--
 builtin/send-pack.c         |  24 +--
 builtin/submodule--helper.c |  14 +-
 checkout.c                  |   5 +-
 http-push.c                 |  18 +-
 refspec.c                   | 194 +++++++++++++++++++++
 refspec.h                   |  44 +++++
 remote.c                    | 324 ++++++++----------------------------
 remote.h                    |  48 ++----
 submodule.c                 |  19 +--
 submodule.h                 |   3 +-
 transport-helper.c          |  39 ++---
 transport.c                 |  51 ++----
 transport.h                 |   4 +-
 22 files changed, 514 insertions(+), 571 deletions(-)
 create mode 100644 refspec.c
 create mode 100644 refspec.h

-- 
2.17.0.441.gb46fe60e1d-goog