Check for valid refs in CommitController before doing anything
Before a 404 would be rendered only after a request to Gitaly would return with an InvalidArgument error. Now we check that the ref have a valid format before sending it to Gitaly. In both cases, a 404 is returned to the user, but this change prevents Gitaly from generating error noise in production.
Closes gitaly#1425 (closed)