critic
critic copied to clipboard
pre-receive hook should try to avoid ref collisions
A situation came up recently with our critic instance, which caused some trouble for related services: a branch was pushed with a refname that matched a commit hash. This didn't bother critic, but other systems which had git checkouts with an origin remote and a critic remote could no longer checkout the commit via "git checkout
We think it would make sense for critic to reject pushes that upload a new branch with a name that looks like a git commit hash (40 hex characters). Apparently github implements a hook that does this (mentioned in https://github.com/jupyterhub/binderhub/issues/299 for example). Would you recommend doing this in src/hooks/pre-receive rather than in the critic service that it talks to?
Do you think it is worth trying to reject clashes between branch and tag names also?