Fix has_pending_commits test to work with Git 1.8
Move user@host segment into its own function