Skip to content

Panic on git branchless init in a non-git directory #1069

@dragon-dxw

Description

@dragon-dxw

Description of the bug

First time using git branchless, I accidently ran the command in the parent folder of my git repos, rather than in a git repo.

I did not expect an uncaught panic.

Expected behavior

A polite error message informing me of the mistake I'd made.

Actual behavior

A panic.

The application panicked (crashed).
Message:  A fatal error occurred: 
   0: could not open repository: could not find repository from '/Users/dragon/dxw/archives'; class=Repository (6); code=NotFound (-3)
   1: could not find repository from '/Users/dragon/dxw/archives'; class=Repository (6); code=NotFound (-3)

Location:
   git-branchless-init/src/lib.rs:606

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   0: git_branchless_init::command_init with effects=<Output fancy=true> git_run_info=<GitRunInfo path_to_git="git" working_directory="/Users/dragon/dxw/archives" env=not shown> main_branch_name=None
      at git-branchless-init/src/lib.rs:599
   1: git_branchless_init::command_main with ctx=CommandContext { effects: <Output fancy=true>, git_run_info: <GitRunInfo path_to_git="git" working_directory="/Users/dragon/dxw/archives" env=not shown> } args=InitArgs { uninstall: false, main_branch_name: None }
      at git-branchless-init/src/lib.rs:668

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Location: git-branchless/src/commands/mod.rs:235

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Version of rustc

No response

Automated bug report

No response

Version of git-branchless

git-branchless-opts 0.8.0

Version of git

git version 2.42.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions