pull: convert get_tracking_branch to use refspec_item_init
Convert 'get_tracking_branch()' to use 'refspec_item_init()' instead of the old 'parse_fetch_refspec()' function. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams committed
May 16, 2018 at 15:57 UTC
895d3912582360a9f1ab805c75883f9fcf5f5c3c
1 file changed
+4
-4
builtin/pull.c
+4
-4
@@ -676,12 +676,12 @@ static const char *get_upstream_branch(const char *remote)
676
*/
677
static const char *get_tracking_branch(const char *remote, const char *refspec)
678
{
679
- struct refspec_item *spec;
679
+ struct refspec_item spec;
680
const char *spec_src;
681
const char *merge_branch;
682
683
- spec = parse_fetch_refspec(1, &refspec);
684
- spec_src = spec->src;
683
+ refspec_item_init(&spec, refspec, REFSPEC_FETCH);
684
+ spec_src = spec.src;
685
if (!*spec_src || !strcmp(spec_src, "HEAD"))
686
spec_src = "HEAD";
687
else if (skip_prefix(spec_src, "heads/", &spec_src))
@@ -701,7 +701,7 @@ static const char *get_tracking_branch(const char *remote, const char *refspec)
701
} else
702
merge_branch = NULL;
703
704
- free_refspec(1, spec);
704
+ refspec_item_clear(&spec);
705
return merge_branch;
706
}
707