dirstate: fix rebuild; add a test
If rebuild calls invalidate, it will just queue a (re)read of the dirstate
file, while what we really want is to empty the current state.
adding b rev offset length base linkrev nodeid p1 p2 0 0 3 0 0 1e88685f5dde 000000000000 000000000000