libgit2/libgit2 — pull request #1401 by carlosmn (2013-03-07 15:43:37+00:00)
Title: refs: explicitly catch leading slashes

It's somewhat common to try to write "/refs/tags/something". There is
no easy way to catch it during the main body of the function, as there
is no way to distinguish whether it's a leading slash or a double
slash somewhere in the middle.

Catch this at the beginning so we don't trigger the assert in
is_all_caps_and_underscore().

---

Not pretty, but effective. The case when we're not normalising is already handled, but when normalising, this is the simplest approach.