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>
SZEDER Gábor committed
Dec 9, 2019 at 12:52 UTC
fee984bcab9f7331b319aa5a48824593e854b784
1 file changed
+7
-4
builtin/name-rev.c
+7
-4
@@ -126,18 +126,21 @@ static void name_rev(struct commit *commit,
126
if (parent_number > 1) {
127
size_t len;
128
129
- strip_suffix(tip_name, "^0", &len);
129
+ strip_suffix(name->tip_name, "^0", &len);
130
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,
134
name->generation,
135
parent_number);
136
else
135
- new_name = xstrfmt("%.*s^%d", (int)len, tip_name,
137
+ new_name = xstrfmt("%.*s^%d", (int)len,
138
+ name->tip_name,
139
parent_number);
140
generation = 0;
141
distance = name->distance + MERGE_TRAVERSAL_WEIGHT;
142
} else {
140
- new_name = tip_name;
143
+ new_name = name->tip_name;
144
generation = name->generation + 1;
145
distance = name->distance + 1;
146
}