Miscellaneous repo/changeset fixes

* better git statuses handling
* refactoring and cleanup to make it testable