Skip to content

bug: requirement to be in git repository and have git installed #155

@rserbitar

Description

@rserbitar

Did you check docs and existing issues?

  • I have read the plugin docs
  • I have read the opencode docs
  • I have searched the existing plugin issues
  • I have searched the existing opencode issues

:checkhealth opencode output

============================================================================== opencode: 3 ⚠️ opencode.nvim ~ - OS: Linux 6.18.7-arch1-1 (x86_64) - nvim version: 0.12.0-dev+gc39d18ee93. - opencode.nvim git commit hash: ed2a936b163df9e92ef210daad3a9ae89ca7e073. - vim.g.opencode_opts: nil opencode.nvim [binaries] ~ - ✅ OK opencode available with version 1.1.42. - ✅ OK curl available. - ✅ OK pgrep available. - ✅ OK lsof available. opencode.nvim [snacks] ~ - ✅ OK snacks.input is enabled: ask() will be enhanced. - ✅ OK blink.cmp is available: opts.ask.blink_cmp_sources will be registered in ask(). - ✅ OK snacks.picker is enabled: select() will be enhanced. opencode.nvim [providers] ~ - ✅ OK Configured opencode provider: snacks. - ✅ OK The snacks provider is available. - ⚠️ WARNING The kitty provider is not available — KITTY_LISTEN_ON environment variable is not set. - ADVICE: - Enable remote control in kitty. - ⚠️ WARNING The wezterm provider is not available — wezterm executable not found in $PATH. - ADVICE: - Install wezterm and ensure it's in your $PATH. - ⚠️ WARNING The tmux provider is not available — tmux executable not found in $PATH. - ADVICE: - Install tmux and ensure it's in your $PATH. - ✅ OK The terminal provider is available.

Describe the bug

require("opencode").select() creashes when opencode is not executed in a git repository because git diff does not work in a non git repository.

Steps To Reproduce

do require("oepncode").select() while starting neovim in a non git repository (which will system call git diff at some point.

error message:

`git diff` failed with code 129
warning: Not a git repository. Use --no-index to compare two paths outside a working tree
usage: git diff --no-index [<options>] <path> <path> [<pathspec>...]

Expected Behavior

should just work.

I would suggest doing git diff --no-index in the system call instead (if not in a git repository).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions