nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

file status icon does not update until you save the file

Open unphased opened this issue 7 months ago • 1 comments

Description

I noticed that the red "x" icon next to a file indicates that it has been modified (per git). Its state appears to change whenever you save the file.

It would be sensible for it to work like this (update whenever the file is saved), however this has a vital flaw which is that when we commit in git these states do not refresh. Therefore the red x icon state is always actually out of sync even if I close out nvim-tree and re-open it. I have to go through each of the files and re-save them to cause the icon state to reflect real git status state.

Neovim version

NVIM v0.10.0-dev-2981+g8c6b0a5f2-Homebrew
Build type: Release
LuaJIT 2.1.1700008891

Operating system and version

macos 13.5, ubuntu 22.04

Windows variant

No response

nvim-tree version

05f55c1

Clean room replication

Please let me know if necessary to provide this

Steps to reproduce

  • Open nvim-tree in a git tracked repo
  • Edit a git tracked file
  • Confirm red x icon indicating modified file shows up for that file
  • Commit the file in git
  • !!! Confirm red x icon indicating file is still modified when we have just committed the change to it so that it is not modified !!!

Optional:

  • Without closing nvim, open a separate git tracked file, edit and save it
  • See this file now gain the modified icon
  • Confirm original file still shown by nvim-tree as modified...

Expected behavior

either

  • detect git commit events somehow and update all modified files states
  • upon any file save rescan whole tree for git modified status changes so we can at least with (reasonable latency) pick up any files got committed and are no longer modified

Actual behavior

each file incorrectly marked as modified which is no longer modified due to having been committed must manually each be re-saved to have its modified state updated properly!

unphased avatar Dec 07 '23 06:12 unphased

The status should update in this situation:

  • HEAD.lock, index etc. are watched for updates
  • they are updated on commit
  • a full git refresh is done

I'm not able to reproduce this.

Please:

  • provide configuration as per "Clean Room" Replication
  • a repository that can replicate this issue
    • repo to clone OR
    • tarball of a git repo
  • steps including specific files and where the commit is done: within nvim, from another terminal, via another plugin etc.

alex-courtis avatar Dec 09 '23 00:12 alex-courtis