$ mkdir dir $ echo x > dir/x $ hg ci -Aqm add $ cd dir $ hg rm -q x $ hg st abort: error getting current working directory: $ENOENT$ [255] $ cd $TESTTMP/a $ hg co -qC .
Maybe we'll have to explicitly pin the cwd?
I'm planning on making a patch to make the rmdir of empty directories configurable, so it can just be disabled regardless of whether the user is in the directory or not. I think it's really weird that a somewhat equivalent set of commands, just without going into `dir` first, ends up deleting `dir`. I want a comprehensive set of tests for the various places that end up doing this (including histedit, rebase, rm, prune, etc.) so it's going to be a bit, if someone else wants to pick this up before then :P
I've sent https://phab.mercurial-scm.org/D3859 to try to resolve this issue.
Fixed by https://mercurial-scm.org/repo/hg/rev/da2a7d8354b2 Kyle Lippincott <spectral@google.com> unlinkpath: make empty directory removal optional (issue5901) (issue5826) There are known cases where performing operations such as rebase from a directory that is newly created can fail or at least lead to being in a directory handle that no longer exists. This is even reproducible by just doing something as simple as: cd foo; hg rm * The behavior is different if you use `hg addremove`, the directory is not removed until we attempt to go back to the node after committing it: cd foo; rm *; hg addremove; hg ci -m'bye foo'; hg co .^; hg co tip Differential Revision: https://phab.mercurial-scm.org/D3859 (please test the fix)
Bug was set to TESTING for 7 days, resolving