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.promptToSaveFilesBeforeCommit should not warn on unstaged files. #66296

Closed
maslade opened this issue Jan 9, 2019 · 10 comments · Fixed by #67953
Closed

git.promptToSaveFilesBeforeCommit should not warn on unstaged files. #66296

maslade opened this issue Jan 9, 2019 · 10 comments · Fixed by #67953
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities verified Verification succeeded
Milestone

Comments

@maslade
Copy link

maslade commented Jan 9, 2019

Issue Type: Feature Request

This 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 A.js and am committing only file A.js, I should not receive a warning that B.js is unsaved. Ideally it will only consider staged files unless I am committing all staged and unstaged.

VS Code version: Code 1.30.2 (61122f8, 2019-01-07T22:54:13.295Z)
OS version: Windows_NT x64 10.0.17763

@vscodebot vscodebot bot added the new release label Jan 9, 2019
@RMacfarlane RMacfarlane added the git GIT issues label Jan 11, 2019
@vscodebot vscodebot bot removed the new release label Jan 13, 2019
@joaomoreno joaomoreno added help wanted Issues identified as good community contribution opportunities good first issue Issues identified as good for first-time contributors labels Jan 14, 2019
@joaomoreno joaomoreno added this to the Backlog milestone Jan 14, 2019
@joaomoreno joaomoreno added the bug Issue identified by VS Code Team member as probable bug label Jan 14, 2019
@flurmbo
Copy link
Contributor

flurmbo commented Jan 15, 2019

Hi, can I work on this one?

@joaomoreno
Copy link
Member

@flurmbo Sure!

@rkeithhill
Copy link

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.

@maslade
Copy link
Author

maslade commented Mar 24, 2019

@rkeithhill 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.

@diablodale
Copy link

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:

  1. The rules triggering the dialog
  2. The dialog itself

Rules triggering dialog

In my scenario today, this was triggered by me having an untracked file named badges.md open in VSCode. Badges.md 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.

Dialog itself

This is the dialog I was presented:

The following file is unsaved: badges.md
Would you like to save it before committing?
(save all & commit)  (commit anyway)  (cancel)

I kept clicking cancel. Because I equated cancel with no. I wanted to answer no to the question Would you like to save it?. On my 3rd time, I read again the dialog and every choice. I finally clicked commit anyway 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 yes or no. 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.

Setup

Version: 1.36.0-insider (user setup)
Commit: fe0c3e785c22c3ed2d5caa7178488c92d62bdb08
Date: 2019-06-28T12:34:35.956Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362

@joaomoreno
Copy link
Member

@diablodale I've rephrased it to The following staged file is unsaved and will not be included in the commit if you proceed.

@maslade Changed the git.promptToSaveFilesBeforeCommit to support staged for your use case.

@diablodale
Copy link

@joaomoreno , 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 The following staged and/or unstaged file(s) are unsaved and... 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.

@joaomoreno
Copy link
Member

joaomoreno commented Aug 8, 2019

I see what you mean now. I simply removed the staged 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.

@roblourens roblourens added the verified Verification succeeded label Aug 28, 2019
@roblourens
Copy link
Member

roblourens commented Aug 28, 2019

One more small thing, the warning says

The following file is unsaved and will not be included in the commit if you proceed: file.ts.

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.

@joaomoreno
Copy link
Member

Changed to The following file has unsaved changes which won't be included in the commit if you proceed.

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 good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities verified Verification succeeded
Projects
None yet
7 participants