atom / github

:octocat: Git and GitHub integration for Atom
https://github.atom.io
MIT License
1.11k stars 392 forks source link

"Invalid commit template path set in Git config" error and commit button doesn't work if commit template doesn't exist #2106

Open chimit opened 5 years ago

chimit commented 5 years ago

Edit by @rsese to clarify the problem

Prerequisites

Description

If you set a commit template in your Git config but the template doesn't exist, there's no visible error and the commit button doesn't work.

Console output:

Uncaught (in promise) Error: Invalid commit template path set in Git config: /Users/me/.stCommitMsg
    at Proxy.fetchCommitMessageTemplate (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:14:2834661)
    at <anonymous>

Steps to Reproduce

For some Git project:

  1. Assuming ~/.gitmessage doesn't exist, add to the project Git config at ./git/config:
[commit]
  template = ~/.gitmessage
  1. Edit and save a file
  2. Stage the file
  3. Write a commit message
  4. Press the Commit button

Expected behavior:

If the commit template doesn't exist, maybe either a error popup that mentions the template doesn't exist or maybe just allow the commit with whatever message is used since there is no template?

Actual behavior:

Commit button doesn't do anything and there's no error popup. Error in console:

Uncaught (in promise) Error: Invalid commit template path set in Git config: /Users/me/.stCommitMsg
    at Proxy.fetchCommitMessageTemplate (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:14:2834661)
    at <anonymous>

Versions

Atom : 1.36.1 Electron: 2.0.18 Chrome : 61.0.3163.100 Node : 8.9.3

apm 2.1.3 npm 6.2.0 node 8.9.3 x64 atom 1.36.1 python 2.7.10 git 2.21.0

macOS Mojave 10.14.4 (18E226)

chimit commented 5 years ago

Apparently, it's a Git problem, but I didn't make any changes to Git on my system.

This should solve the issue:

git config --global --unset-all commit.template
rsese commented 5 years ago

Thanks for the report @chimit - I can reproduce if I tell Git to use a commit template:

[commit]
  template = ~/.gitmessage

But don't actually create ~/.gitmessage.

I'll update the issue to make the problem more clear.

rglynn-dev commented 5 years ago

Apparently, it's a Git problem, but I didn't make any changes to Git on my system.

This should solve the issue:

git config --global --unset-all commit.template

Thanks a lot, this solved the issue for me!