Code

Run "git repack -a -d" once more at end, if there's 1MB or more of not-packed data.
[git.git] / sha1_name.c
index 5cf5578af1e346788bd6276a26d996cb83a2208d..6d7cd78381414aa2fef31d31d46fbb24b0aaab1d 100644 (file)
@@ -157,7 +157,7 @@ static int get_short_sha1(const char *name, int len, unsigned char *sha1,
        char canonical[40];
        unsigned char res[20];
 
-       if (len < MINIMUM_ABBREV)
+       if (len < MINIMUM_ABBREV || len > 40)
                return -1;
        hashclr(res);
        memset(canonical, 'x', 40);