]> git.ipfire.org Git - thirdparty/git.git/blobdiff - refs.c
silence gcc array-bounds warning
[thirdparty/git.git] / refs.c
diff --git a/refs.c b/refs.c
index 1e5e7b4ad953ca55ffc4b7da439f90fa4715bbb1..e264f7a9f493671db652599172b472b3ef4a00b6 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1688,7 +1688,7 @@ char *shorten_unambiguous_ref(const char *ref)
                size_t total_len = 0;
 
                /* the rule list is NULL terminated, count them first */
-               for (; ref_rev_parse_rules[nr_rules]; nr_rules++)
+               for (nr_rules = 0; ref_rev_parse_rules[nr_rules]; nr_rules++)
                        /* no +1 because strlen("%s") < strlen("%.*s") */
                        total_len += strlen(ref_rev_parse_rules[nr_rules]);