On Sat, 23 Sep 2006, David Rientjes wrote: > @@ -202,16 +202,17 @@ int cmd_name_rev(int argc, const char ** > #define ishex(x) (isdigit((x)) || ((x) >= 'a' && (x) <= 'f')) > if (!ishex(*p)) > forty = 0; > - else if (++forty == 40 && > + else if (++forty == 2 * SHA_DIGEST_LENGTH && > !ishex(*(p+1))) { > - unsigned char sha1[40]; > + unsigned char sha1[2 * SHA_DIGEST_LENGTH]; > const char *name = "undefined"; > char c = *(p+1); > > forty = 0; > > *(p+1) = 0; > - if (!get_sha1(p - 39, sha1)) { > + if (!get_sha1(p - (SHA_DIGEST_LENGTH + 1), > + sha1)) { > struct object *o = > lookup_object(sha1); > if (o) Off by 18 error. Signed-off-by: David Rientjes <rientjes@xxxxxxxxxxxxxxxxx> --- builtin-name-rev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-name-rev.c b/builtin-name-rev.c index f522664..ed99679 100644 --- a/builtin-name-rev.c +++ b/builtin-name-rev.c @@ -211,7 +211,7 @@ #define ishex(x) (isdigit((x)) || ((x) > forty = 0; *(p+1) = 0; - if (!get_sha1(p - (SHA_DIGEST_LENGTH + 1), + if (!get_sha1(p - 2 * SHA_DIGEST_LENGTH + 1, sha1)) { struct object *o = lookup_object(sha1); - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html