Check that the identifier isn't the hash of a git tree
If the user provides the hash of a tree instead of the hash of a commit,
we currently crash in a 500 error.
With this commit if the hash returned a tree, don't try to extract a tree
from it.
Fixes an error reported by email.
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>