I\'m developing a git post-receive hook in Python. Data is supplied on stdin
with lines similar to
ef4d4037f8568e386629457d4d960915a85da2ae 61a4
git check-ref-format
with subprocess.Popen
is a possibility:
import subprocess
process = subprocess.Popen(["git", "check-ref-format", ref])
exit_status = process.wait()
Advantages:
Disadvantages:
pygit2, which uses C bindings to libgit2, would be an even better possibility if check-ref-format
is exposed there, as it would be faster than Popen
, but I haven't found it.