refactor git status segment into its own function