Skip to content

Commit fee984b

Browse files
szedergitster
authored andcommitted
name-rev: use 'name->tip_name' instead of 'tip_name'
Following the previous patches in this series we can get the value of 'name_rev()'s 'tip_name' parameter from the 'struct rev_name' associated with the commit as well. So let's use 'name->tip_name' instead, which makes the patch eliminating the recursion of name_rev() a bit easier to follow. Note that at this point we could drop the 'tip_name' parameter as well, but that parameter will be necessary later, after the recursion is eliminated. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 8c5724c commit fee984b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

builtin/name-rev.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,21 @@ static void name_rev(struct commit *commit,
126126
if (parent_number > 1) {
127127
size_t len;
128128

129-
strip_suffix(tip_name, "^0", &len);
129+
strip_suffix(name->tip_name, "^0", &len);
130130
if (name->generation > 0)
131-
new_name = xstrfmt("%.*s~%d^%d", (int)len, tip_name,
131+
new_name = xstrfmt("%.*s~%d^%d",
132+
(int)len,
133+
name->tip_name,
132134
name->generation,
133135
parent_number);
134136
else
135-
new_name = xstrfmt("%.*s^%d", (int)len, tip_name,
137+
new_name = xstrfmt("%.*s^%d", (int)len,
138+
name->tip_name,
136139
parent_number);
137140
generation = 0;
138141
distance = name->distance + MERGE_TRAVERSAL_WEIGHT;
139142
} else {
140-
new_name = tip_name;
143+
new_name = name->tip_name;
141144
generation = name->generation + 1;
142145
distance = name->distance + 1;
143146
}

0 commit comments

Comments
 (0)