Revert almost all of 5be434785317; add a test
Because of file copies, we should update the manifest dict only after
committing all files.
abort: repository a not found!255abort: error: Connection refused255abort: repository a not found!255abort: destination '../a' already exists255abort: repository a not found!255abort: destination 'q' already exists