Skip to content

Commit 895d391

Browse files
bmwillgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9c8361b commit 895d391

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

builtin/pull.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,12 +676,12 @@ static const char *get_upstream_branch(const char *remote)
676676
*/
677677
static const char *get_tracking_branch(const char *remote, const char *refspec)
678678
{
679-
struct refspec_item *spec;
679+
struct refspec_item spec;
680680
const char *spec_src;
681681
const char *merge_branch;
682682

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;
685685
if (!*spec_src || !strcmp(spec_src, "HEAD"))
686686
spec_src = "HEAD";
687687
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)
701701
} else
702702
merge_branch = NULL;
703703

704-
free_refspec(1, spec);
704+
refspec_item_clear(&spec);
705705
return merge_branch;
706706
}
707707

0 commit comments

Comments
 (0)