critic icon indicating copy to clipboard operation
critic copied to clipboard

pre-receive hook should try to avoid ref collisions

Open mostynb opened this issue 5 years ago • 0 comments

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 " (they would get the branch instead).

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?

mostynb avatar Sep 04 '18 21:09 mostynb