Skip to content

Commit 7e412e8

Browse files
rscharfegitster
authored andcommitted
fmt-merge-msg: use skip_prefix() instead of starts_with()
Get rid of two magic numbers by using skip_prefix(). Signed-off-by: René Scharfe <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a6293f5 commit 7e412e8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

builtin/fmt-merge-msg.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int handle_line(char *line, struct merge_parents *merge_parents)
106106
int i, len = strlen(line);
107107
struct origin_data *origin_data;
108108
char *src;
109-
const char *origin;
109+
const char *origin, *tag_name;
110110
struct src_data *src_data;
111111
struct string_list_item *item;
112112
int pulling_head = 0;
@@ -162,14 +162,13 @@ static int handle_line(char *line, struct merge_parents *merge_parents)
162162
if (pulling_head) {
163163
origin = src;
164164
src_data->head_status |= 1;
165-
} else if (starts_with(line, "branch ")) {
165+
} else if (skip_prefix(line, "branch ", &origin)) {
166166
origin_data->is_local_branch = 1;
167-
origin = line + 7;
168167
string_list_append(&src_data->branch, origin);
169168
src_data->head_status |= 2;
170-
} else if (starts_with(line, "tag ")) {
169+
} else if (skip_prefix(line, "tag ", &tag_name)) {
171170
origin = line;
172-
string_list_append(&src_data->tag, origin + 4);
171+
string_list_append(&src_data->tag, tag_name);
173172
src_data->head_status |= 2;
174173
} else if (skip_prefix(line, "remote-tracking branch ", &origin)) {
175174
string_list_append(&src_data->r_branch, origin);

0 commit comments

Comments
 (0)