Patch Set 9:

I also applied the same checks to CommitCommand.

My remaining question is: is there a better place to put this logic?  Currently it is pretty much duplicated between AddCommand and CommitCommand.