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

Closing the commit view without writing anything causes a commit with all comments #323

Closed
cfal opened this issue Jul 28, 2022 · 3 comments · Fixed by #333
Closed

Closing the commit view without writing anything causes a commit with all comments #323

cfal opened this issue Jul 28, 2022 · 3 comments · Fixed by #333
Labels
bug Something isn't working

Comments

@cfal
Copy link

cfal commented Jul 28, 2022

Description

after opening the commit view (cc), it doesn't seem possible to exit without committing, even when the file is not saved, and no comment is written. a commit with only comments is always created:

Author: cfal <[email protected]>
Date:   Fri Jul 29 07:15:32 2022 +0800

    # On branch master
    # Your branch is up to date with 'origin/master'.
   ...

Neovim version

NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

Ubuntu 20.04

Steps to reproduce

  1. Open the commit window (cc)
  2. Close it immediately with q

Expected behavior

No commit is created if no message is written.

Actual behavior

A commit is created.

Minimal config

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup({
    {
      "wbthomason/packer.nvim",
      {
        "TimUntersberger/neogit",
        requires = {
          { "nvim-lua/plenary.nvim" },
          { "sindrets/diffview.nvim" },
        },
        config = function()
          print("loaded neogit")
          require("neogit").setup()
        end,
      },
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  })
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing neogit and dependencies.")
  vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
@cfal cfal added the bug Something isn't working label Jul 28, 2022
@cfal
Copy link
Author

cfal commented Jul 28, 2022

I'm not sure if this is a dupe of #320, but i haven't changed any comment character.

@dlobue
Copy link

dlobue commented Aug 10, 2022

I've run into this exact same issue. In fact, I've also written a partial commit message, saved and closed the commit buffer, and then answered "no" to the commit prompt, and still ended up with the commit going through.

@sindrets
Copy link
Contributor

This was introduced in b2752b3.

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