Repository: vscode
Issue: Git - Saving/closing COMMIT_EDITMSG during a git commit randomly does not complete the commit
Labels: bug,git


Type: <b>Bug</b>

This is a random issue. I have not found a sequence that specificly makes this fail.

This issue is that when I use the editor's COMMIT_EDITMSG file to write my commit message, (click Commit button with and empty Message input) the message saves, but the commit does not complete.

The commit messages are usually somewhat extensive (several paragraphs). I review diffs of the files I'm committing as I write the commit message so  I am in and out of focus on the file. But it has also happend when I simply paste a commit message in and immediately close the file.

I have tried several versions of closing out of the file to submit the commit:
- Save then close the file (I don't remember if I get a prompt in this case)
- Close (cmd-W or click the close button) the file and click the save button in the prompt
- Close (cmd-W or click the close button) the file and click enter to select the default (save) button in the prompt.

All three of these have successfully submitted the commit, and failed to do so. The edited content appears to save into `.git/COMMIT_EDITMSG`.

I have checked the git output and don't see any consistent error messages. There are lines that seem to be associated with commiting when the commit works, and they are simply missing when it doesn't. The only thing close to an error is when the commit works there are two similar warnings:

```
2025-01-01 17:44:08.866 [info] > git ls-files --stage -- /Users/trinkel/Development/DevOps/_Training/Kevin Powell/240922-HeadlessCMS.stack/.git/COMMIT_EDITMSG [27ms]
2025-01-01 17:44:08.866 [info] > git show --textconv :.git/COMMIT_EDITMSG [28ms]
2025-01-01 17:44:22.044 [info] > git -c user.useConfigOnly=true commit --quiet [15570ms]
2025-01-01 17:44:22.046 [info] [Git][getRemotes] No remotes found in the git config file
2025-01-01 17:44:22.077 [info] > git config --get commit.template [31ms]
2025-01-01 17:44:22.086 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [39ms]
2025-01-01 17:44:22.129 [info] > git status -z -uall [41ms]
2025-01-01 17:44:22.131 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [42ms]
2025-01-01 17:44:22.165 [info] > git config --local branch.main.github-pr-owner-number [29ms]
2025-01-01 17:44:22.166 [warning] [Git][config] git config failed: Failed to execute git
2025-01-01 17:44:22.182 [info] [Git][getRemotes] No remotes found in the git config file
2025-01-01 17:44:22.195 [info] > git config --local branch.main.remote [28ms]
2025-01-01 17:44:22.195 [warning] [Git][config] git config failed: Failed to execute git
2025-01-01 17:44:22.209 [info] > git config --get commit.template [28ms]
2025-01-01 17:44:22.213 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [31ms]
2025-01-01 17:44:22.216 [info] > git log --format=%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B -z --shortstat --diff-merges=first-parent -n50 --skip=0 --topo-order --decorate=full --stdin [75ms]
2025-01-01 17:44:22.257 [info] > git config --local branch.main.merge [61ms]
2025-01-01 17:44:22.258 [warning] [Git][config] git config failed: Failed to execute git
```

There is no upstream remote for this project. I have tried to clip out what seems to be the significant section of the logs for brevity, but have saved the all of the log if you need it.
  

VS Code version: Code 1.96.2 (Universal) (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z)
OS version: Darwin arm64 24.1.0
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M1 Pro (10 x 2400)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|3, 3, 5|
|Memory (System)|16.00GB (0.08GB free)|
|Process Argv|--crash-reporter-id 9dc43c00-8bab-4a00-8174-e85d64b2a5cd|
|Screen Reader|yes|
|VM|0%|
</details><details><summary>Extensions (44)</summary>

Extension|Author (truncated)|Version
---|---|---
better-comments|aar|3.0.2
dark-synthwave-vscode|Aar|1.0.3
codewhisperer-for-command-line-companion|ama|1.5.1
astro-vscode|ast|2.15.4
vscode-intelephense-client|bme|1.12.6
vscode-toggle-quotes|Bri|0.3.6
vscode-zonefile|Com|0.0.4
jsdoc-generator|cry|2.2.0
postcss|css|1.0.9
vscode-eslint|dba|3.0.10
gitlens|eam|16.1.1
prettier-vscode|esb|11.0.0
nunjucks-template|ese|0.5.1
csv-editor|est|0.2.2
auto-rename-tag|for|0.1.10
code-runner|for|0.12.2
vscode-pull-request-github|Git|0.102.0
live-sass|gle|6.1.2
vscode-graphql-syntax|Gra|1.3.8
applescript|idl|0.26.1
vscode-edit-csv|jan|0.11.1
vscode-text-pastry|jkj|1.3.1
rainbow-csv|mec|3.13.0
pieces-vscode|Mes|2.0.0
git-graph|mhu|1.30.0
diff-merge|mos|0.7.0
vscode-scss|mrm|0.10.0
vscode-docker|ms-|1.29.3
remote-containers|ms-|0.394.0
remote-ssh|ms-|0.116.1
remote-ssh-edit|ms-|0.87.0
remote-explorer|ms-|0.4.3
laravel-blade|one|1.36.1
cssvar|pho|2.6.4
material-icon-theme|PKi|5.16.0
prisma|Pri|6.1.0
LiveServer|rit|5.7.9
vs-code-prettier-eslint|rve|6.0.0
code-spell-checker|str|4.0.21
svelte-vscode|sve|109.4.0
vscode-conventional-commits|viv|1.26.0
volar|Vue|2.2.0
vscode-postcss|vun|2.0.2
material-theme|zhu|3.17.7

(3 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupytercf:31046870
2f103344:31071589
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc2:31192216
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624

```

</details>

<!-- generated by issue reporter -->