Spun off from #173.
We currently have a charset restriction on ref names, but folks may want to use colons, etc. I don't think folks should care about human-readability of the refs filenames, so I'd like to change the mapping from refs to filenames from “they're the same thing” to “the filename is the NFC Unicode that is UTF-8 encoded and then filesystem-safe Base 64 encoded”. Then folks can put whatever they want in the ref name.
As an example in Python 3:
>>> import base64
>>> import unicodedata
>>> name = 'Ζεύς'
>>> name_nfc = unicodedata.normalize('NFC', name)
>>> name_utf8 = name_nfc.encode('UTF-8')
>>> name_base64 = base64.b64encode(name_utf8, altchars=b'-_')
>>> print((name, name_nfc, name_utf8, name_base64))
('Ζεύς', 'Ζεύς', b'\xce\x96\xce\xb5\xcf\x8d\xcf\x82', b'zpbOtc-Nz4I=')
So the Ζεύς ref would be stored in refs/zpbOtc-Nz4I=.
There's previous Base 64 discussion (in the context of container IDs) in opencontainers/runc#675 and opencontainers/runc#676.
Spun off from #173.
We currently have a charset restriction on ref names, but folks may want to use colons, etc. I don't think folks should care about human-readability of the
refsfilenames, so I'd like to change the mapping from refs to filenames from “they're the same thing” to “the filename is the NFC Unicode that is UTF-8 encoded and then filesystem-safe Base 64 encoded”. Then folks can put whatever they want in the ref name.As an example in Python 3:
So the
Ζεύςref would be stored inrefs/zpbOtc-Nz4I=.There's previous Base 64 discussion (in the context of container IDs) in opencontainers/runc#675 and opencontainers/runc#676.