In the previous commit, validate_branch_start() was forward declared in order to preserve the function order and minimize the diff. Since the forward declaration is no longer needed, remove it by moving setup_tracking() to the appropriate position. Signed-off-by: Glen Choo <chooglen@xxxxxxxxxx> --- This patch is logically part of the previous patch because it just cleans up the artificial forward declaration that exists only to shrink the diff for reviewers. As such, if/when this series is merged, I would prefer for this patch to be squashed with the previous one. branch.c | 98 +++++++++++++++++++++++++++----------------------------- 1 file changed, 47 insertions(+), 51 deletions(-) diff --git a/branch.c b/branch.c index 9429936734..6b9d64cdf9 100644 --- a/branch.c +++ b/branch.c @@ -209,57 +209,6 @@ static int inherit_tracking(struct tracking *tracking, const char *orig_ref) return 0; } -static void validate_branch_start(struct repository *r, const char *start_name, - enum branch_track track, - struct object_id *oid, char **real_ref); - -void setup_tracking(const char *new_ref, const char *orig_ref, - enum branch_track track, int quiet, int expand_orig) -{ - struct tracking tracking; - struct string_list tracking_srcs = STRING_LIST_INIT_DUP; - int config_flags = quiet ? 0 : BRANCH_CONFIG_VERBOSE; - char *full_orig_ref; - struct object_id unused_oid; - - memset(&tracking, 0, sizeof(tracking)); - if (expand_orig) - validate_branch_start(the_repository, orig_ref, track, &unused_oid, &full_orig_ref); - else - full_orig_ref = xstrdup(orig_ref); - - tracking.spec.dst = full_orig_ref; - tracking.srcs = &tracking_srcs; - if (track != BRANCH_TRACK_INHERIT) - for_each_remote(find_tracked_branch, &tracking); - else if (inherit_tracking(&tracking, orig_ref)) - return; - - if (!tracking.matches) - switch (track) { - case BRANCH_TRACK_ALWAYS: - case BRANCH_TRACK_EXPLICIT: - case BRANCH_TRACK_OVERRIDE: - break; - default: - goto cleanup; - } - - if (tracking.matches > 1) - die(_("Not tracking: ambiguous information for ref %s"), - full_orig_ref); - - if (tracking.srcs->nr < 1) - string_list_append(tracking.srcs, full_orig_ref); - if (install_branch_config_multiple_remotes(config_flags, new_ref, tracking.remote, - tracking.srcs) < 0) - exit(-1); - -cleanup: - string_list_clear(tracking.srcs, 0); - free(full_orig_ref); -} - int read_branch_desc(struct strbuf *buf, const char *branch_name) { char *v = NULL; @@ -407,6 +356,53 @@ static void validate_branch_start(struct repository *r, const char *start_name, oidcpy(oid, &commit->object.oid); } +void setup_tracking(const char *new_ref, const char *orig_ref, + enum branch_track track, int quiet, int expand_orig) +{ + struct tracking tracking; + struct string_list tracking_srcs = STRING_LIST_INIT_DUP; + int config_flags = quiet ? 0 : BRANCH_CONFIG_VERBOSE; + char *full_orig_ref; + struct object_id unused_oid; + + memset(&tracking, 0, sizeof(tracking)); + if (expand_orig) + validate_branch_start(the_repository, orig_ref, track, &unused_oid, &full_orig_ref); + else + full_orig_ref = xstrdup(orig_ref); + + tracking.spec.dst = full_orig_ref; + tracking.srcs = &tracking_srcs; + if (track != BRANCH_TRACK_INHERIT) + for_each_remote(find_tracked_branch, &tracking); + else if (inherit_tracking(&tracking, orig_ref)) + return; + + if (!tracking.matches) + switch (track) { + case BRANCH_TRACK_ALWAYS: + case BRANCH_TRACK_EXPLICIT: + case BRANCH_TRACK_OVERRIDE: + break; + default: + goto cleanup; + } + + if (tracking.matches > 1) + die(_("Not tracking: ambiguous information for ref %s"), + full_orig_ref); + + if (tracking.srcs->nr < 1) + string_list_append(tracking.srcs, full_orig_ref); + if (install_branch_config_multiple_remotes(config_flags, new_ref, tracking.remote, + tracking.srcs) < 0) + exit(-1); + +cleanup: + string_list_clear(tracking.srcs, 0); + free(full_orig_ref); +} + void create_branch(struct repository *r, const char *name, const char *start_name, int force, int clobber_head_ok, int reflog, int quiet, enum branch_track track) -- 2.33.GIT