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

Git Gutter is not updated after a git commit #4994

Open
mar-mei opened this issue Dec 3, 2022 · 7 comments
Open

Git Gutter is not updated after a git commit #4994

mar-mei opened this issue Dec 3, 2022 · 7 comments
Assignees
Labels
A-vcs Area: Version control system interaction C-enhancement Category: Improvements

Comments

@mar-mei
Copy link

mar-mei commented Dec 3, 2022

Summary

The UI of the new Git Gutter is not updated at git changes, such as a:

git commit

Reproduction Steps

I tried this:

  1. hx
  2. Open a file with a git repo
  3. Make some changes
  4. Save file
  5. Run: git commit -am "my changes" in a new terminal

I expected this to happen:
UI is updated

Instead, this happened:
Git diff remains unchanged

Only after a hx :reload of the file the ui ist updated


hx

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

Platform

Linux

Terminal Emulator

Kitty

Helix Version

helix 22.08.1 (bcdb475)

@mar-mei mar-mei added the C-bug Category: This is a bug label Dec 3, 2022
@kirawi
Copy link
Member

kirawi commented Dec 3, 2022

This is a limitation in order to keep the initial PR scoped, but you can manually update it via :reload.

@pascalkuthe
Copy link
Member

As @kirawi pointed out this is an intentional limitation of the current implementation as implementation file watching is challenging (and also has some other prerequisites like caching git repos) and therefore was too much to bundle with the initial implementation. I will be writing a poper tracking issue for my plans in that regard soon and close this issue then

@pascalkuthe pascalkuthe added C-enhancement Category: Improvements A-vcs Area: Version control system interaction and removed C-bug Category: This is a bug labels Dec 3, 2022
@pascalkuthe pascalkuthe self-assigned this Dec 3, 2022
dxmh added a commit to dxmh/system-config that referenced this issue Feb 16, 2023
This is mainly used as a workaround to update the git gutter:
helix-editor/helix#4994
@quantonganh
Copy link
Contributor

I've just come up with a workaround using WezTerm: #2261 (comment).

@sidequestboy
Copy link

Is it possible to get helix to automatically call reload-all when it gets focused in the same way that auto-save is triggered? It might be a reasonable temporary fix while file-watching is being worked on

@quantonganh
Copy link
Contributor

@sidequestboy You can do that by introducing a new configuration option auto-reload-all (defaults to false). Afterward, you can make the reload_all function public, and call it here. However, the potential drawback is that it might trigger reload-all too frequently. Moreover, in my opinion, we should avoid reloading unsaved changes buffers, as discussed in #5680.

@H4ckint0sh
Copy link

H4ckint0sh commented Aug 31, 2023

I have made a script to do this using "tmux" (set-hook).

tmux.conf

bind-key g run-shell -b helix-lazygit

helix-lazygit

#!/bin/bash

# Split horizontally and run lazygit 
tmux split-window -v -l 70% -c "#{pane_current_path}" lazygit

# run reload script on exit
tmux set-hook pane-exited "run-shell '$HOME/bin/helix-reload.sh'"

helix-reload.sh

#!/bin/bash

# Data to be listed
LIST_DATA="#{pane_index} #{pane_current_command}"

# Find pane id where helix is running
HELIX_PANE_INDEX=$(tmux list-panes -a -F "$LIST_DATA" | grep "hx" | awk '{print $1}')

# Send reload command if such a pane exists
if [ -n "$HELIX_PANE_INDEX" ]; then

  # change to helix pane
  tmux select-pane -t $HELIX_PANE_INDEX

  # Send ":" to start command input in Helix
  tmux send-keys ":"

  # Send the "reload-all" command to the pane that runs helix and simulate Enter
  tmux send-keys "reload-all" C-m

fi

@ygabuev
Copy link
Contributor

ygabuev commented Sep 25, 2023

As @kirawi pointed out this is an intentional limitation of the current implementation as implementation file watching is challenging (and also has some other prerequisites like caching git repos) and therefore was too much to bundle with the initial implementation. I will be writing a poper tracking issue for my plans in that regard soon and close this issue then

@kirawi Hello. Is there any progress outlining this issue in more general terms? I guess this might be helpful, maybe someone else would be willing to work on this issue given a proper outline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vcs Area: Version control system interaction C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

7 participants