Changes in v2: * added missing extern keyword in the first patch * reordered patch 2 and 3 and updated some comments to be clearer. * fixed some memory leaks * squashed in some changes recommended by Aevar Brandon Williams (36): refspec: move refspec parsing logic into its own file refspec: rename struct refspec to struct refspec_item refspec: factor out parsing a single refspec 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 remote: remove add_prune_tags_to_fetch_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 | 134 ++++++-------- 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 | 353 ++++++++---------------------------- remote.h | 50 ++--- submodule.c | 19 +- submodule.h | 3 +- transport-helper.c | 39 ++-- transport.c | 51 ++---- transport.h | 4 +- 22 files changed, 527 insertions(+), 595 deletions(-) create mode 100644 refspec.c create mode 100644 refspec.h -- 2.17.0.441.gb46fe60e1d-goog