Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed file cannot be shown properly #1157

Closed
rami3l opened this issue Feb 1, 2024 · 9 comments · Fixed by #1165
Closed

Renamed file cannot be shown properly #1157

rami3l opened this issue Feb 1, 2024 · 9 comments · Fixed by #1165
Labels
bug Something isn't working

Comments

@rami3l
Copy link
Contributor

rami3l commented Feb 1, 2024

Description

When a file is renamed (similar to #715), the Renamed session in Neogit seems broken.

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

Operating system and version

macOS 14.2.1 23C71 arm64

Steps to reproduce

I'm trying this on my neovim config repo, but it seems to me that this can be reproduced regardless of the actual repo.

  1. Rename any file (in this case, lsp/config/rust_analyzer.lua) and stage. This will lead to a git status like the following:
> git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        renamed:    lsp/config/rust_analyzer.lua -> lsp/config/rust-analyzer.lua
  1. Launch magit.

Expected behavior

The Renamed line and the diff are showing properly.
Pressing enter on the Renamed line will lead to the just-renamed lsp/config/rust-analyzer.lua.

Actual behavior

In my case Neogit gives:

v Staged changes (1)
> Renamed        a -> lsp/config/rust-analyzer.lu

> Recent commits (10)

In this state not only is it impossible to see the diff, but pressing enter on the Renamed line will lead to an inexistent lsp/config/rust-analyzer.lu file.

Minimal config

{
  "NeogitOrg/neogit",
  opts = {
    signs = {
      item = { ">", "v" },
      section = { ">", "v" },
    },
  },
}
@rami3l rami3l added the bug Something isn't working label Feb 1, 2024
@rami3l
Copy link
Contributor Author

rami3l commented Feb 5, 2024

To provide more context on this, the git status invocation gives:

$ git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always status -z --porcelain=2 -b
# branch.oid 048af8ddf23bf8cdf58c818739eb828a84ba01cd# branch.head master# branch.upstream origin/master# branch.ab +0 -02 R. N... 100644 100644 100644 ac01e6941fe11104afee78fa73ad77f9707d169b ac01e6941fe11104afee78fa73ad77f9707d169b R100 lua/plugins/lsp/rust-analyzer.lualua/plugins/lsp/rust_analyzer.lua

... and I suspect the problem is somewhere near here:

elseif kind == "2" then
local mode_staged, mode_unstaged, _, _, _, _, _, _, _, name, orig_name = rest:match(match_2)

local match_2 = "(.)(.) (....) (%d+) (%d+) (%d+) (%w+) (%w+) (%a%d+) ([^\t]+)\t?(.+)"

... where match_2 should be parsing, in the example above:

R. N... 100644 100644 100644 ac01e6941fe11104afee78fa73ad77f9707d169b ac01e6941fe11104afee78fa73ad77f9707d169b R100 lua/plugins/lsp/rust-analyzer.lualua/plugins/lsp/rust_analyzer.lua
Full Logs
[TRACE Mon Feb  5 19:23:13 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "rev-parse", "--show-toplevel" }
[DEBUG Mon Feb  5 19:23:13 2024] ...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:103: [REPO]: Initializing Repository
[DEBUG Mon Feb  5 19:23:13 2024] ...l/.local/share/nvim/lazy/neogit/lua/neogit/lib/state.lua:10: [STATE]: Reading file: '/Users/rami3l/.local/state/nvim/neogit/%Users%rami3l%.config%nvim'
[DEBUG Mon Feb  5 19:23:13 2024] ...l/.local/share/nvim/lazy/neogit/lua/neogit/lib/state.lua:10: [STATE]: Loaded: '/Users/rami3l/.local/state/nvim/neogit/%Users%rami3l%.config%nvim'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "rev-parse", "--show-toplevel" }
[DEBUG Mon Feb  5 19:23:14 2024] ...mi3l/.local/share/nvim/lazy/neogit/lua/neogit/status.lua:1415: [STATUS BUFFER]: Creating...
[DEBUG Mon Feb  5 19:23:14 2024] ...mi3l/.local/share/nvim/lazy/neogit/lua/neogit/status.lua:1424: [STATUS BUFFER]: Initializing...
[DEBUG Mon Feb  5 19:23:14 2024] ...mi3l/.local/share/nvim/lazy/neogit/lua/neogit/status.lua:1469: [STATUS BUFFER]: Dispatching initial render
[DEBUG Mon Feb  5 19:23:14 2024] ...mi3l/.local/share/nvim/lazy/neogit/lua/neogit/status.lua:533: [STATUS BUFFER]: Acquired refresh lock:
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "rev-parse", "--show-toplevel" }
[DEBUG Mon Feb  5 19:23:14 2024] ...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:76: [REPO]: Refreshing 'update_status'
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'status': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always status -z --porcelain=2 -b'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "status", "-z", "--porcelain=2", "-b" }
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always status -z --porcelain=2 -b' succeeded in 4 ms
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'rev-parse': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always rev-parse --short 048af8ddf23bf8cdf58c818739eb828a84ba01cd'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "rev-parse", "--short", "048af8ddf23bf8cdf58c818739eb828a84ba01cd" }
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always rev-parse --short 048af8ddf23bf8cdf58c818739eb828a84ba01cd' succeeded in 4 ms
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'log': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch origin/master --max-count=1'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "log", '--format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null},', "--no-patch", "origin/master", "--max-count=1" }
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch origin/master --max-count=1' succeeded in 4 ms
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'rev-parse': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always rev-parse --verify --quiet refs/heads/origin/master'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "rev-parse", "--verify", "--quiet", "refs/heads/origin/master" }
[WARN  Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:622: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always rev-parse --verify --quiet refs/heads/origin/master' failed with code 1 after 4 ms
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'describe': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always describe --long --tags HEAD'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "describe", "--long", "--tags", "HEAD" }
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[WARN  Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:622: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always describe --long --tags HEAD' failed with code 128 after 3 ms
[WARN  Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:628: [CLI] [STDERR] fatal: No names found, cannot describe anything.
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'log': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch --max-count=10'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "log", '--format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null},', "--no-patch", "--max-count=10" }
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'log': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch @{upstream}.. --max-count=256'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "log", '--format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null},', "--no-patch", "@{upstream}..", "--max-count=256" }
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'log': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --max-count=1 --format=%s 048af8ddf23bf8cdf58c818739eb828a84ba01cd'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "log", "--max-count=1", "--format=%s", "048af8ddf23bf8cdf58c818739eb828a84ba01cd" }
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'log': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch ..@{upstream} --max-count=256'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "log", '--format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null},', "--no-patch", "..@{upstream}", "--max-count=256" }
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'stash': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always stash list'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "stash", "list" }
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always stash list' succeeded in 5 ms
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch @{upstream}.. --max-count=256' succeeded in 5 ms
[DEBUG Mon Feb  5 19:23:14 2024] ...cal/share/nvim/lazy/neogit/lua/neogit/lib/git/config.lua:100: [Config] Rebuilding git config_cache
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'config': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always config --list --null --local'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "config", "--list", "--null", "--local" }
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always config --list --null --local' succeeded in 3 ms
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'log': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch origin/master.. --max-count=256'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "log", '--format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null},', "--no-patch", "origin/master..", "--max-count=256" }
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --max-count=1 --format=%s 048af8ddf23bf8cdf58c818739eb828a84ba01cd' succeeded in 9 ms
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch ..@{upstream} --max-count=256' succeeded in 10 ms
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:869: [CLI]: Executing 'log': 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch ..origin/master --max-count=256'
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:363: [PROCESS] Spawning: { "git", "--no-pager", "--literal-pathspecs", "--no-optional-locks", "-c", "core.preloadindex=true", "-c", "color.ui=always", "log", '--format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null},', "--no-patch", "..origin/master", "--max-count=256" }
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch --max-count=10' succeeded in 10 ms
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch origin/master.. --max-count=256' succeeded in 4 ms
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one
[TRACE Mon Feb  5 19:23:14 2024] ....local/share/nvim/lazy/neogit/lua/neogit/lib/git/cli.lua:632: [CLI] Execution of 'git --no-pager --literal-pathspecs --no-optional-locks -c core.preloadindex=true -c color.ui=always log --format={"sanitized_subject_line":"%f","ref_name":"%D","rel_date":"%cr","abbreviated_parent":"%p","abbreviated_tree":"%t","subject":"%s","body":"%b","parent":"%P","author_name":"%aN","author_date":"%aD","encoding":"%e","committer_email":"%cE","committer_name":"%cN","oid":"%H","tree":"%T","committer_date":"%cD","abbreviated_commit":"%h","commit_notes":"%N","author_email":"%aE","null":null}, --no-patch ..origin/master --max-count=256' succeeded in 3 ms
[DEBUG Mon Feb  5 19:23:14 2024] ...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:62: [REPO]: Refreshes complete
[DEBUG Mon Feb  5 19:23:14 2024] ...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:65: [REPO]: Running refresh callback
[DEBUG Mon Feb  5 19:23:14 2024] ...mi3l/.local/share/nvim/lazy/neogit/lua/neogit/status.lua:513: [STATUS BUFFER]: Redrawing
[DEBUG Mon Feb  5 19:23:14 2024] ...mi3l/.local/share/nvim/lazy/neogit/lua/neogit/status.lua:518: [STATUS BUFFER]: Finished Redrawing
[INFO  Mon Feb  5 19:23:14 2024] ...mi3l/.local/share/nvim/lazy/neogit/lua/neogit/status.lua:560: [STATUS BUFFER]: Refresh lock is now free
[TRACE Mon Feb  5 19:23:14 2024] ...i3l/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:76: [PROCESS] Preview buffer already exists. Focusing the existing one

@rami3l
Copy link
Contributor Author

rami3l commented Feb 5, 2024

I think I may have found out the origin of the problem.

https://git-scm.com/docs/git-status says:

Renamed or copied entries have the following format:

2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
...
<sep>       When the `-z` option is used, the 2 pathnames are separated
	    with a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)
	    byte separates them.

... which indicates that this is indeed a regression introduced in 5312c67.

@rami3l
Copy link
Contributor Author

rami3l commented Feb 5, 2024

@CKolkey Aha! This is a combination of 2 separate issues so fixing only one of them (with #1165) won't work.

I expect rest to be

"R. N... 100644 100644 100644 ac01e6941fe11104afee78fa73ad77f9707d169b ac01e6941fe11104afee78fa73ad77f9707d169b R100 lua/plugins/lsp/rust-analyzer.lua\0lua/plugins/lsp/rust_analyzer.lua"

... but instead the actual value was all the contents before '\0', so with git status -z the old pattern matched something like lua/plugins/lsp/rust-analyzer.lu <- a, leading to the original problematic status line.

@javoscript
Copy link

Just for the record, the same issue keeps happening with the latest version ( c0b1d4d ), and Neovim version 0.9.5

2024-04-02_15-43-56

@rami3l
Copy link
Contributor Author

rami3l commented Apr 3, 2024

It's actually fixed in #1167 rather than #1165, at least for a while...

Could this be a regression for some kind?

@rami3l
Copy link
Contributor Author

rami3l commented Apr 3, 2024

Just for the record, the same issue keeps happening with the latest version ( c0b1d4d ), and Neovim version 0.9.5

2024-04-02_15-43-56

@javoscript I'm on c0b1d4d + nvim 0.9 as well and it seems that I can't reproduce this issue 👀

@javoscript
Copy link

@rami3l The issue seems to happen when there are staged changes in renamed file, and unstaged changes to it's content.

Steps to reproduce, in an example repo without unstaged changes:

echo "example" > test.txt

git add -A && git commit -m "..."

mv test.txt test_2.txt

git add -A

echo "change" >> test_2.txt

Open neovim and neogit status buffer and the bug happens.

2024-04-03_11-43-36

@rami3l
Copy link
Contributor Author

rami3l commented Apr 3, 2024

Given that maybe we should reopen this issue. @CKolkey what do you think?

@CKolkey
Copy link
Member

CKolkey commented Apr 3, 2024

So, on the nightly branch, here's how that sequence results (thanks for the reproduction steps):
Screenshot 2024-04-03 at 19 30 43

Since it's fixed there, I'm not super keen to revisit this. I'll merge this into master when nvim-0.10 is released - in the meantime I recommend either using nightly or waiting the (hopefully) short time until it's release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants