Skip to content

gitcommit auto-generation fails to trigger with fugitive.vim's :Git commit command #14

@meijieru

Description

@meijieru

Description:

The automatic commit message generation feature for the gitcommit extension does not work when initiating a commit with the fugitive.vim plugin.

The feature is configured to trigger automatically upon entering a gitcommit buffer. While the manual keymap (<leader>gc) works correctly inside the fugitive buffer, the auto_generate functionality fails to execute.

Steps to Reproduce:

  1. Configure the gitcommit extension with auto_generate = true.
  2. Install and enable the tpope/vim-fugitive plugin.
  3. In a git repository with staged changes, run the Neovim command :Git commit.
  4. A gitcommit buffer is opened by fugitive.

Expected Behavior:

After the gitcommit buffer opens, the CodeCompanion extension should automatically generate a commit message and insert it into the buffer, according to the auto_generate setting.

Actual Behavior:

The gitcommit buffer opens, but no commit message is generated. The buffer remains empty, waiting for manual input. The user has to trigger the generation manually via the configured keymap.

Possible Cause:

The current implementation uses a FileType=gitcommit autocommand to register a nested WinEnter autocommand, which is responsible for triggering the generation logic. It is likely that fugitive's method of creating and presenting the commit window follows a different event sequence than other git tools.

The WinEnter event might not be firing as expected for the fugitive buffer, or it might be firing at a moment when the buffer is not yet fully configured, causing the conditions for generation to fail. This suggests that relying on WinEnter alone might not be robust enough to support various git plugin workflows. A more reliable event, or a combination of events, might be needed to reliably detect the readiness of the gitcommit buffer across different plugins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions