Miscellaneous repo/changeset fixes

* better git statuses handling
* refactoring and cleanup to make it testable
style is dot at the end of the previous line.