Allow to push a tag that points to a non-commit object

When pushing a tag that points to a non-commit object, like `v2.6.11`
on linux-stable [1] which points to a tree, or `spearce-gpg-pub` on
jgit [2] which points to a blob, Gerrit rejects the push with the error
message 'missing object(s)'.

This causes problems in the use case where a repository is being synched
from somewhere else, for example Github, and pushed into Gerrit with:

 git push mirror refs/heads/*:refs/heads/* --tags

In the validation of received commits, instead of trying to parse the
received object as a commit and failing if it is not, parse it first as
any object and return early if it's not a commit.

[1] https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tag/?id=v2.6.11
[2] https://git.eclipse.org/c/jgit/jgit.git/tag/?id=spearce-gpg-pub

Bug: Issue 3328
Change-Id: I013c75db9de44e4b562b712bec8dc7381750740a
1 file changed