-
Notifications
You must be signed in to change notification settings - Fork 215
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
Neogit doesn't use the user's configured .gitmessages file #66
Comments
We are currently manually rebuilding the commit content and we are not respecting any configiurations on the git side. Are you using any other configurations on the git side? |
I have git config files for work and personal use that make some changes to the defaults for example [push]
followTags = true
[pull]
rebase = true
[rebase]
autoStash = true These are some things I've tweaked that aren't recognised by neogit . EDIT: I forgot to include the one that's actually relevant to this issue [commit]
template = ~/.gitmessage |
@RianFuro do you have any opinions regarding respecting specific Some things like gitmessage template are a must have imo, but should we also support things like push followTags and whatever (Just like he has configured)? I never changed git defaults so I don't even know what is possible and what each settings does. |
Yeah same here. I have gpg signing configured so I made sure that still worked when committing, but I must admit I use less of git than I probably should. On a conceptual level I feel we should support everything at some point; otherwise we'd betray user expectations when they decide to give neogit a try. Ideally we'd really only have to take care where we deviate from calling git "normally", e.g. our commit workflow, and minimize those places as much as possible. |
👍 |
Might want to try setting the HOME env var when launching git. It should help it locate the user’s .gitconfig files. |
@Odie we already do that: |
Okay. I played around with the code a bit. Here's what I found:
I'm not familiar with the codebase enough try putting in fixes here. This particular issue can probably be fixed along with #54, by getting git to prep COMMIT_EDITMSG directly. |
It's not that involved really. You don't really have to possibility in lua to distinguish between a field set to You can "easily" check that by constructing a toy example (template from here, just adapted the called script): local uv = vim.loop
local stdin = uv.new_pipe(false)
local stdout = uv.new_pipe(false)
local stderr = uv.new_pipe(false)
print("stdin", stdin)
print("stdout", stdout)
print("stderr", stderr)
local handle, pid = uv.spawn("sh", {
args = {'test.sh'},
stdio = {stdin, stdout, stderr}
}, function(code, signal) -- on exit
print("exit code", code)
print("exit signal", signal)
end)
print("process opened", handle, pid)
uv.read_start(stdout, function(err, data)
assert(not err, err)
if data then
print("stdout chunk", stdout, data)
else
print("stdout end", stdout)
end
end)
uv.read_start(stderr, function(err, data)
assert(not err, err)
if data then
print("stderr chunk", stderr, data)
else
print("stderr end", stderr)
end
end)
uv.write(stdin, "Hello World")
uv.shutdown(stdin, function()
print("stdin shutdown", stdin)
uv.close(handle, function()
print("process closed", handle, pid)
end)
end) Is sadly the simplest way to call spawn. #!/bin/sh
echo $MY_VAR Executing the above script from neovim (for example with |
I see! Thanks for that code snippet. I tried dumping $HOME both via a shell script and yet another lua script. Both printed out $HOME successfully. x) So does that mean if neogit just asked git to prep COMMIT_EDITMSG as usual, everything should just work? |
I'll add this comment here (since I believe this may be related to the parent issue), but sometimes the message showing which files have been staged for commit doesn't update to reflect which files are actually going to be committed. I don't have a repro for this, but I have noticed in using Neogit over the past few days that if you mix committing using the CLI and with Neogit it will not update the status message. For example, it will say that I am committing file I think fixing whatever issue this is might also fix that one, since it's all touching similar code (if I have read this issue correctly). |
So I had a look through the mountain of vimscript in I'm not sure this is the best solution/why it was needed since a git config also allows a user to do things like |
Maybe there is an easy way to do this using Maybe |
I made a demo for this. Currently only the 'c' action is supported. Not sure if I will make a full PR or not, depends on how time-consuming the rest of the commit actions end up being :P I notice the reword and amend |
Just to flag this although it might be a known issue already but whilst using neogit it doesn't read my
.gitmessages
from my.gitconfig
. I've set the commit message text to use a different placeholder to match the commit style I use. The screen shot show the commit buffer with vim fugitive and neogit. Fugitive somehow is reading this information whereas neogit doesn't.It's not a blocking issue at all just worth pointing out.
The text was updated successfully, but these errors were encountered: