Patch Set 3: I would prefer that you didn't submit this

I agree to Robin's comment, RepositoryState should get something like canAmend() to avoid combining flags in using code which is hard to understand