summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-11-26 14:22:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-27 02:17:30 (GMT)
commit7e412e8a3492bc60604060f4f1b1d4ddeda7071f (patch)
tree7cecf74d2ebde8e8d3b140dfdb16167543ba45af /builtin
parenta6293f5d28763580dd1035d3c6b018b42be7e25a (diff)
downloadgit-7e412e8a3492bc60604060f4f1b1d4ddeda7071f.zip
git-7e412e8a3492bc60604060f4f1b1d4ddeda7071f.tar.gz
git-7e412e8a3492bc60604060f4f1b1d4ddeda7071f.tar.bz2
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 <l.s.r@web.de> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fmt-merge-msg.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index a461558..736f666 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -106,7 +106,7 @@ static int handle_line(char *line, struct merge_parents *merge_parents)
int i, len = strlen(line);
struct origin_data *origin_data;
char *src;
- const char *origin;
+ const char *origin, *tag_name;
struct src_data *src_data;
struct string_list_item *item;
int pulling_head = 0;
@@ -162,14 +162,13 @@ static int handle_line(char *line, struct merge_parents *merge_parents)
if (pulling_head) {
origin = src;
src_data->head_status |= 1;
- } else if (starts_with(line, "branch ")) {
+ } else if (skip_prefix(line, "branch ", &origin)) {
origin_data->is_local_branch = 1;
- origin = line + 7;
string_list_append(&src_data->branch, origin);
src_data->head_status |= 2;
- } else if (starts_with(line, "tag ")) {
+ } else if (skip_prefix(line, "tag ", &tag_name)) {
origin = line;
- string_list_append(&src_data->tag, origin + 4);
+ string_list_append(&src_data->tag, tag_name);
src_data->head_status |= 2;
} else if (skip_prefix(line, "remote-tracking branch ", &origin)) {
string_list_append(&src_data->r_branch, origin);