[git] Avoid the ternary operator for compatibility with Python < 2.5