Improved readability and performance of parse_git_dirty function