jj/tests
Kevin Liao 86b6a11e63 Fix jj init --git-repo fails and leaves broken .jj folder
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)
```
2023-06-20 11:02:06 -07:00
..
common TestEnvironment: make it easier to run integration tests with printf debugging 2023-05-14 19:59:50 -07:00
test_abandon_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_alias.rs cargo: upgrade clap from to 4.1.11 to 4.3.0 2023-05-31 12:32:26 -07:00
test_branch_command.rs revsets: stop jj parsing br as a git_ref refs/heads/br 2023-06-12 14:31:44 -07:00
test_cat_command.rs cli: rename print to cat 2023-01-18 10:10:02 -08:00
test_checkout.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_commit_command.rs Switch graph node to use for commit instead of 2023-04-02 23:15:37 -07:00
test_commit_template.rs cli: allow resolving shorter ids within a configured revset 2023-05-11 23:41:24 -07:00
test_concurrent_operations.rs cli: reload both repo and wc commit if working copy was updated 2023-05-22 08:36:38 +09:00
test_config_command.rs cargo: upgrade to clap 4.1 2023-03-17 22:44:29 -07:00
test_debug_command.rs jj debug operation --display id option to show current operation id for tests 2023-06-07 13:42:48 -07:00
test_describe_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_diff_command.rs Fix warnings in tests on non-Unix platforms 2023-05-01 13:37:31 +09:00
test_diffedit_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_duplicate_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_edit_command.rs tests: avoid hardcoding commit/operation ids when possible 2023-05-22 07:02:32 -07:00
test_git_clone.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_git_colocated.rs tests: demo jj branch forget behavior in colocated repos 2023-06-12 14:31:44 -07:00
test_git_fetch.rs cmd: have jj branch list report git-tracking (@git) branches 2023-06-12 14:31:44 -07:00
test_git_import_export.rs revset: allow checking out git-tracking (@git) branches 2023-06-12 14:31:44 -07:00
test_git_push.rs cli: add jj git push -r for pushing branches pointing to revset 2023-06-04 20:50:11 -07:00
test_git_remotes.rs copyright: change from "Google LLC" to "The Jujutsu Authors" 2022-11-28 06:05:45 -10:00
test_gitignores.rs copyright: change from "Google LLC" to "The Jujutsu Authors" 2022-11-28 06:05:45 -10:00
test_global_opts.rs cargo: upgrade clap from to 4.1.11 to 4.3.0 2023-05-31 12:32:26 -07:00
test_init_command.rs Fix jj init --git-repo fails and leaves broken .jj folder 2023-06-20 11:02:06 -07:00
test_interdiff_command.rs copyright: change from "Google LLC" to "The Jujutsu Authors" 2022-11-28 06:05:45 -10:00
test_log_command.rs cleanup: fix clippy issues 2023-06-05 11:11:17 -05:00
test_move_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_new_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_obslog_command.rs cli: allow resolving shorter ids within a configured revset 2023-05-11 23:41:24 -07:00
test_operations.rs tests: avoid hardcoding commit/operation ids when possible 2023-05-22 07:02:32 -07:00
test_rebase_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_resolve_command.rs merge_tools: simplify error message for complex conflicts 2023-06-07 13:45:16 -07:00
test_restore_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_revset_output.rs cli: load revset/template aliases in order of config layers 2023-05-23 14:20:55 +09:00
test_show_command.rs cli: in "show" template, indent description like Git does 2023-03-04 12:10:53 +09:00
test_sparse_command.rs cli: make jj sparse --list a subcommand 2023-05-22 09:49:38 -07:00
test_split_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_squash_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_status_command.rs cli: append "\n" to commit description specified by -m/--message 2022-12-22 14:59:03 +09:00
test_templater.rs cli: load revset/template aliases in order of config layers 2023-05-23 14:20:55 +09:00
test_undo.rs Switch graph node to use for commit instead of 2023-04-02 23:15:37 -07:00
test_unsquash_command.rs cli: print parent commit summary on checkout 2023-05-02 15:04:13 +09:00
test_untrack_command.rs cli: make jj sparse --list a subcommand 2023-05-22 09:49:38 -07:00
test_util_command.rs cli: rename jj support to jj util 2023-04-12 21:34:47 -07:00
test_workspaces.rs cli: add pointer from error message to docs about stale working copy 2023-05-31 06:32:40 -07:00