mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-01 11:49:01 +00:00
86b6a11e63
This commit fixes #1305 Before this commit, running `jj init --git-repo=./` in a folder that does not have a .git would cause jj to panick and leave an unfinished corrupted jj repo. This commit fixes that by changing the call chain to return an error instead of calling .unwrap() and panicking. This commit also adds logic to delete the unfinished jj repository when the git backend initialization failed. Before this commit, running the above command would result in the following ``` Running `jj/target/debug/jj init --git-repo=./` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -3, klass: 2, message: "failed to resolve path '/Users/kevincliao/github/jj/test-repo/.jj/repo/store/../../../.git': No such file or directory" }', lib/src/git_backend.rs:83:75 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` After this commit, the result is the following and the jj repo is deleted: ``` Running `jj/target/debug/jj init --git-repo=./` Error: Failed to access the repository: Error: Failed to open git repository: failed to resolve path '/Users/kevincliao/github/jj/test-repo/.jj/repo/store/../../../.git': No such file or directory; class=Os (2); code=NotFound (-3) ``` |
||
---|---|---|
.. | ||
main.rs |