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>
This commit is contained in:

committed by
Junio C Hamano

parent
9c8361b289
commit
895d391258
@ -676,12 +676,12 @@ static const char *get_upstream_branch(const char *remote)
|
|||||||
*/
|
*/
|
||||||
static const char *get_tracking_branch(const char *remote, const char *refspec)
|
static const char *get_tracking_branch(const char *remote, const char *refspec)
|
||||||
{
|
{
|
||||||
struct refspec_item *spec;
|
struct refspec_item spec;
|
||||||
const char *spec_src;
|
const char *spec_src;
|
||||||
const char *merge_branch;
|
const char *merge_branch;
|
||||||
|
|
||||||
spec = parse_fetch_refspec(1, &refspec);
|
refspec_item_init(&spec, refspec, REFSPEC_FETCH);
|
||||||
spec_src = spec->src;
|
spec_src = spec.src;
|
||||||
if (!*spec_src || !strcmp(spec_src, "HEAD"))
|
if (!*spec_src || !strcmp(spec_src, "HEAD"))
|
||||||
spec_src = "HEAD";
|
spec_src = "HEAD";
|
||||||
else if (skip_prefix(spec_src, "heads/", &spec_src))
|
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)
|
|||||||
} else
|
} else
|
||||||
merge_branch = NULL;
|
merge_branch = NULL;
|
||||||
|
|
||||||
free_refspec(1, spec);
|
refspec_item_clear(&spec);
|
||||||
return merge_branch;
|
return merge_branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user