python: introduce git_core library

Signed-off-by: John Keeping <john@keeping.me.uk>
WIP: move subprocess helpers to compat