Merge branch 'bb/unicode-12.1-reiwa' into maint
[gitweb.git] / builtin / name-rev.c
index f1cb45c22746bbcfb76d8fb1fefd5061f582cf57..05ccf53e003144d07e319abb8930fa31623c6632 100644 (file)
@@ -361,23 +361,25 @@ static char const * const name_rev_usage[] = {
 static void name_rev_line(char *p, struct name_ref_data *data)
 {
        struct strbuf buf = STRBUF_INIT;
-       int forty = 0;
+       int counter = 0;
        char *p_start;
+       const unsigned hexsz = the_hash_algo->hexsz;
+
        for (p_start = p; *p; p++) {
 #define ishex(x) (isdigit((x)) || ((x) >= 'a' && (x) <= 'f'))
                if (!ishex(*p))
-                       forty = 0;
-               else if (++forty == GIT_SHA1_HEXSZ &&
+                       counter = 0;
+               else if (++counter == hexsz &&
                         !ishex(*(p+1))) {
                        struct object_id oid;
                        const char *name = NULL;
                        char c = *(p+1);
                        int p_len = p - p_start + 1;
 
-                       forty = 0;
+                       counter = 0;
 
                        *(p+1) = 0;
-                       if (!get_oid(p - (GIT_SHA1_HEXSZ - 1), &oid)) {
+                       if (!get_oid(p - (hexsz - 1), &oid)) {
                                struct object *o =
                                        lookup_object(the_repository,
                                                      oid.hash);
@@ -390,7 +392,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
                                continue;
 
                        if (data->name_only)
-                               printf("%.*s%s", p_len - GIT_SHA1_HEXSZ, p_start, name);
+                               printf("%.*s%s", p_len - hexsz, p_start, name);
                        else
                                printf("%.*s (%s)", p_len, p_start, name);
                        p_start = p + 1;