X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-for-each-ref.c;h=e46b7adc9719e147536398e8e365d6d3e65a4ba7;hb=35fb0e8633217f602360a9987af51c4b960e7850;hp=fa6c1ed75285649943e0e62ee0b66ef146dda517;hpb=304d058370a9a797c38ec739c6d39fa45d9ed8e5;p=git.git diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index fa6c1ed75..e46b7adc9 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -620,14 +620,16 @@ static char *get_short_ref(struct refinfo *ref) for (j = 0; j < i; j++) { const char *rule = ref_rev_parse_rules[j]; unsigned char short_objectname[20]; + char refname[PATH_MAX]; /* * the short name is ambiguous, if it resolves * (with this previous rule) to a valid ref * read_ref() returns 0 on success */ - if (!read_ref(mkpath(rule, short_name_len, short_name), - short_objectname)) + mksnpath(refname, sizeof(refname), + rule, short_name_len, short_name); + if (!read_ref(refname, short_objectname)) break; }