merge: use skip_prefix()
Get rid of a magic string length constant by using skip_prefix() instead of starts_with(). Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Aug 10, 2017 at 18:47 UTC
de3ce210edb4870b082fab18148f859d2b3c9ae2
1 file changed
+2
-2
builtin/merge.c
+2
-2
@@ -1118,8 +1118,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1118
* current branch.
1119
*/
1120
branch = branch_to_free = resolve_refdup("HEAD", 0, head_oid.hash, NULL);
1121
- if (branch && starts_with(branch, "refs/heads/"))
1122
- branch += 11;
1121
+ if (branch)
1122
+ skip_prefix(branch, "refs/heads/", &branch);
1123
if (!branch || is_null_oid(&head_oid))
1124
head_commit = NULL;
1125
else