Skip to content

Commit a6293f5

Browse files
rscharfegitster
authored andcommitted
fetch: use skip_prefix() instead of starts_with()
Get rid of magic numbers by letting skip_prefix() set the pointer "what". Signed-off-by: René Scharfe <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d9f6f3b commit a6293f5

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

builtin/fetch.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -954,18 +954,12 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
954954
kind = "";
955955
what = "";
956956
}
957-
else if (starts_with(rm->name, "refs/heads/")) {
957+
else if (skip_prefix(rm->name, "refs/heads/", &what))
958958
kind = "branch";
959-
what = rm->name + 11;
960-
}
961-
else if (starts_with(rm->name, "refs/tags/")) {
959+
else if (skip_prefix(rm->name, "refs/tags/", &what))
962960
kind = "tag";
963-
what = rm->name + 10;
964-
}
965-
else if (starts_with(rm->name, "refs/remotes/")) {
961+
else if (skip_prefix(rm->name, "refs/remotes/", &what))
966962
kind = "remote-tracking branch";
967-
what = rm->name + 13;
968-
}
969963
else {
970964
kind = "";
971965
what = rm->name;

0 commit comments

Comments
 (0)