How do I check for valid Git branch names?

前端 未结 6 1733
粉色の甜心
粉色の甜心 2021-01-03 23:40

I\'m developing a git post-receive hook in Python. Data is supplied on stdin with lines similar to

ef4d4037f8568e386629457d4d960915a85da2ae 61a4         


        
6条回答
  •  滥情空心
    2021-01-04 00:22

    If You want to check if reference is valid with pygit2 You can do like that function (code copied from documentation):

    from pygit2 import reference_is_valid_name
    reference_is_valid_name("refs/heads/master")
    

提交回复
热议问题