zed icon indicating copy to clipboard operation
zed copied to clipboard

Inconsistent Commit Message Retention: .git/COMMIT_EDITMSG Stuck After Multiple Commits

Open mgibowski opened this issue 11 months ago • 0 comments

Summary

When Zed is used as the default git editor, it sometimes fails to load the current .git/COMMIT_EDITMSG and loads its outdated contents.

Previous issue https://github.com/zed-industries/zed/issues/18701 is still present in Zed 0.183.12

Steps to Reproduce (copied from the linked issue):

  1. Install Zed CLI.
  2. Set zed --wait as the Git editor: git config --global core.editor "zed --wait"
  3. Open a terminal inside Zed.
  4. Run a Git commit operation with changes staged: git commit
  5. Use Zed’s inline assistant to generate a commit message based on the diff.
  6. Use :x to save and close the buffer.
  7. Make another change to the codebase.
  8. Attempt to commit the new change with: git commit
  9. When Zed opens the Git editor, you will notice that it still contains the previous commit message and diff instead of the current one.

Observed Behavior:

  • Zed sometimes retains the old commit message and diff in .git/COMMIT_EDITMSG.
  • Removing .git/COMMIT_EDITMSG via rm .git/COMMIT_EDITMSG does not resolve the issue, and the problem persists.
  • The issue is not consistent but occurs sporadically, especially when the inline assistant is used for writing commit messages.

Expected Behavior:

When performing a Git commit, Zed should open the fresh commit message and diff in .git/COMMIT_EDITMSG relevant to the latest changes.

Impact:

This issue creates confusion and hinders smooth Git commit workflows when using Zed, especially when dealing with successive commits in quick succession.

Zed Version and System Specs

Zed: v0.183.12 (Zed) OS: macOS 14.7.0 Memory: 36 GiB Architecture: aarch64

mgibowski avatar Apr 30 '25 12:04 mgibowski