bup: Properly handle key names with spaces or other things that are not legal git refs.

Continue using the key name as bup ref name, to preserve backwards
compatability, unless it is an illegal git ref. In that case, use a sha256
of the key name instead.
This commit is contained in:
Joey Hess 2012-04-11 12:45:05 -04:00
parent 378f61d0ef
commit c924542e61
4 changed files with 22 additions and 6 deletions

View file

@ -67,8 +67,8 @@ matchingUniq ref repo = nubBy uniqref <$> matching ref repo
{- Checks if a String is a legal git ref name.
-
- The rules for this are complex; see git-check-ref-format(1) -}
legalRef :: Bool -> String -> Bool
legalRef allowonelevel s = all (== False) illegal
legal :: Bool -> String -> Bool
legal allowonelevel s = all (== False) illegal
where
illegal =
[ any ("." `isPrefixOf`) pathbits