Fix random sha1 in error message in http-fetch and http-push
[gitweb.git] / http-push.c
index fc60bfd5f476abc94c3f70b5ea95373bd444e16f..c96e43da163fac00b245f2fe5736494185e40aba 100644 (file)
@@ -1149,9 +1149,10 @@ int fetch_ref(char *ref, unsigned char *sha1)
                return error("Unable to start request");
        }
 
+       if (buffer.posn != 41)
+               return 1;
         hex[40] = '\0';
-        get_sha1_hex(hex, sha1);
-        return 0;
+       return get_sha1_hex(hex, sha1);
 }
 
 static void one_remote_object(const char *hex)