push: clarify rejection of update to non-commit-ish
[gitweb.git] / remote.c
index f5bc4e7260850d9b870d3e62e21c8a3a5380a130..ee0c1e54bcf20ba972c1f8813d0f7a81af675afd 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1291,6 +1291,11 @@ static inline int is_forwardable(struct ref* ref)
        if (!o || o->type != OBJ_COMMIT)
                return 0;
 
+       /* new object must be commit-ish */
+       o = deref_tag(parse_object(ref->new_sha1), NULL, 0);
+       if (!o || o->type != OBJ_COMMIT)
+               return 0;
+
        return 1;
 }