Code change:
Issue Type: <bFeature Request</bThis new feature is over-eager and triggers on unsaved files that are not part of the commit, which I don't think makes sense. If I have staged file and am committing only file , I should not receive a warning that is unsaved. Ideally it will only consider staged files unless I am committing all staged and unstaged. VS Code version: Code 1.30.2 (, 2019-01-07T22:54:13.295Z) OS version: Windows_NT x64 10.0. <!-- generated by issue reporter --
Hi, can I work on this one?
Sure!
I'm not in favor of changing this. Or if it is changed, perhaps give finer grain control over when it prompts. I always want a prompt because I'm a bit lazy and usually let VSCode add the files to staging for me when I commit.
I see the value in your use case, but I don't think it makes sense in this feature. If you committed with a file that was untracked but saved this warning wouldn't help you. I think it would make more sense as a separate feature that warns on commit if there are untracked files regardless of save state.
Experienced this today. I had to loop on this experience 3 times before I finally groked what was occurring and my choices in the dialog. I believe there are two issues here: rules triggering the dialog dialog itself In my scenario today, this was triggered by me having an untracked file named open in VSCode. was previously saved to disk. It continues to be untracked. I had made some more changes to this file, but not yet saved those to disk. The key concern here for me is that this is an untracked file. I do not want to have any dialogs given to me by VSCode for untracked files when I attempt to commit. This is the dialog I was presented: I kept clicking cancel. Because I equated with . I wanted to answer to the question . On my 3rd time, I read again the dialog and every choice. I finally clicked and got the effect I desired. This dialog is poorly designed. The question proposed is a yes/no question "Would you like to save it before committing?". Unfortunately, the three buttons are not or . Instead they are answers to a question not asked...something like "What would you like to do now?". Naturally, that's a poor question and instead, this dialog needs to be reworked.
I've rephrased it to . Changed the to support for your use case.
, The text you proposed doesn't address the situation. Referencing the post I made, the file in question was unstaged. Therefore the text you propose doesn't address the unstaged files that are triggering this dialog box. You could change the text to but that's messy. Having two dialog boxes (one for unsaved staged, one for unsaved unstaged) is also messy. And one dialog box for each file is equally messy. All of this suggests to me that the feature itself needs rethinking, not just text in the dialog box. Personally (as a focus group of one), I don't want the feature. But someone somewhere though this feature was cool. So exploring with that group can perhaps surface a better mechanism to address their needs.
I see what you mean now. I simply removed the qualification for now. Thanks for the ping. I don't really think this small feature warrants such a big investment as a user study group, though.
One more small thing, the warning says But if the file has saved changes and also some unsaved changes, then the file will be included, it's just the unsaved changes that won't be included. This seems like it would be a common case so maybe it could say "will be incomplete in the commit" or "is unsaved and those changes will not be included" or "has unsaved changed that won't be included in the commit" something.
Changed to .

Related discussion:
text: if (stagedUnsavedTextDocuments.length > 0) { const message = stagedUnsavedTextDocuments.length === 1 <del> ? localize('unsaved files single', "The following file is unsaved: {0}.nnWould you like to save it before committing?", path.basename(stagedUnsavedTextDocuments[0].uri.fsPath)) : localize('unsaved files', "There are {0} unsaved files.nnWould you like to save them before committing?", stagedUnsavedTextDocuments.length); </del> <ins> ? localize('unsaved files single', "The following staged file is unsaved: {0}.nnWould you like to save it before committing?", path.basename(stagedUnsavedTextDocuments[0].uri.fsPath)) : localize('unsaved files', "There are {0} unsaved staged files.nnWould you like to save them before committing?", stagedUnsavedTextDocuments.length); </ins> const saveAndCommit = localize('save and commit', "Save All & Commit"); const commit = localize('commit', "Commit Anyway"); const pick = await window.showWarningMessage(message, { modal: true }, saveAndCommit, commit);