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

Git commit comment field should pre-populate with git-commit template #74222

Closed
ghost opened this issue May 23, 2019 · 12 comments
Closed

Git commit comment field should pre-populate with git-commit template #74222

ghost opened this issue May 23, 2019 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues help wanted Issues identified as good community contribution opportunities
Milestone

Comments

@ghost
Copy link

ghost commented May 23, 2019

If empty, the text field for a Git commit message should pre-load the appropriate git-commit template (as specified in the local or global .gitconfig).

@vscodebot vscodebot bot added the git GIT issues label May 23, 2019
@ghost ghost changed the title Git checkin comment field should pre-populate git-commit template Git commit comment field should pre-populate with git-commit template May 23, 2019
@joaomoreno
Copy link
Member

This is implemented. Are you sure you have your git commit template correctly configured?

@joaomoreno joaomoreno added the info-needed Issue requires more information from poster label May 24, 2019
@ghost
Copy link
Author

ghost commented May 24, 2019

I thought it was already implemented. It's not working correctly in my VSCode environment.
If I invoke git from the command line in the directory I am working in, the template is properly imported into the commit text editor.
Launching VSCode, if I stage changes, the commit text field is blank.
If I open the VSCode terminal and do a git config -l, it does show the commit.template is populated. I've tried with both absolute and relative paths (/Users/cweiss/.git_commit_template.txt and ~/.git_commit_template).
I've tried with VSCode loaded with all extensions disabled.

git version 2.20.1 (Apple Git-117)

vscode version 1.34.0
a622c65b2c713c890fcf4fbf07cf34049d5fe758
x64

From the VSCode terminal:

git config -l
credential.helper=osxkeychain
user.name=Weiss, Chris
user.email=Chris.Weiss@nike.com
core.excludesfile=~/.gitignore_global
core.autocrlf=input
alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
alias.tree=log --oneline --decorate --all --graph
diff.tool=bc4
difftool.bc4.trustexitcode=true
merge.tool=bc4
mergetool.bc4.trustexitcode=true
color.ui=true
commit.template=~/.git_commit_template.txt
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
include.path=~/.gitconfig_local
user.name=Weiss, Chris
user.email=Chris.Weiss@nike.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true

@joaomoreno
Copy link
Member

Hm... this seems to work for me.

Can you try disabling other extensions? code --disable-extensions.

@joaomoreno
Copy link
Member

joaomoreno commented May 27, 2019

I've tried with VSCode loaded with all extensions disabled.

Hm... Can you try on another machine?

@ChrisWeiss
Copy link

Tested at home, seeing the same results. I should see the template in the field in the attached photo?
Screenshot_5_30_19__7_11_PM

VSCode is looking for it, I see the following in the output window:

Using git 2.20.1 (Apple Git-117) from /usr/bin/git
> git rev-parse --show-toplevel
> git config --get commit.template
Open repository: /Users/chrisweiss/workspace/test
> git status -z -u
> git symbolic-ref --short HEAD```

@mliq
Copy link

mliq commented Jun 1, 2019

Possibly related to #71550 ?

@joaomoreno
Copy link
Member

@ChrisWeiss Yeah the template should appear... not really sure what is happening there. 🤔

@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities and removed info-needed Issue requires more information from poster labels Jun 3, 2019
@joaomoreno joaomoreno added this to the Backlog milestone Jun 3, 2019
@YisraelV
Copy link
Contributor

I'm checking this.

@joaomoreno
Copy link
Member

@ChrisWeiss, #71550 turned out to be a user error. Can you triple check?

@YisraelV
Copy link
Contributor

YisraelV commented Jun 12, 2019

@ChrisWeiss just trying something out: vscode removes all lines that are commented out before populating the textbox, which is quite different than viewing the template in vim, for example.

Does your template contain any non commented out lines?

(@joaomoreno correct me if this is not the intended behavior.

@ChrisWeiss
Copy link

Ah! That's the issue! My template is all commented lines providing content guidance.
I'd expect the complete raw template to be visible in the commit editor.

@joaomoreno
Copy link
Member

Yeah we take those out, since everything in the input box is taken literally, so the comments would be a part of the commit message. I'm merging this together with #30562

@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

4 participants