summaryrefslogtreecommitdiff
path: root/builtin/name-rev.c
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2019-12-09 11:52:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-09 21:33:01 (GMT)
commitfee984bcab9f7331b319aa5a48824593e854b784 (patch)
treee01f7d18d23f0271a232d100c390c41e4e08423b /builtin/name-rev.c
parent8c5724c585791662ec5701719e8665a2db5517fd (diff)
downloadgit-fee984bcab9f7331b319aa5a48824593e854b784.zip
git-fee984bcab9f7331b319aa5a48824593e854b784.tar.gz
git-fee984bcab9f7331b319aa5a48824593e854b784.tar.bz2
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>
Diffstat (limited to 'builtin/name-rev.c')
-rw-r--r--builtin/name-rev.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index fc61d6f..6c1e6e9 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -126,18 +126,21 @@ static void name_rev(struct commit *commit,
if (parent_number > 1) {
size_t len;
- strip_suffix(tip_name, "^0", &len);
+ strip_suffix(name->tip_name, "^0", &len);
if (name->generation > 0)
- new_name = xstrfmt("%.*s~%d^%d", (int)len, tip_name,
+ new_name = xstrfmt("%.*s~%d^%d",
+ (int)len,
+ name->tip_name,
name->generation,
parent_number);
else
- new_name = xstrfmt("%.*s^%d", (int)len, tip_name,
+ new_name = xstrfmt("%.*s^%d", (int)len,
+ name->tip_name,
parent_number);
generation = 0;
distance = name->distance + MERGE_TRAVERSAL_WEIGHT;
} else {
- new_name = tip_name;
+ new_name = name->tip_name;
generation = name->generation + 1;
distance = name->distance + 1;
}