merge branches!
cherry pick 9ec6897
really handle dirty index/workdir properly