Microsoft/vscode
View on GitHubGit - "Stage selected ranges" sometimes stages a revert of changes in the previous commit
Open
#64,027 opened on Nov 29, 2018
buggithelp wanted
Description
I am not able to test with the insiders build as I don't have permission to install unauthorized software versions on my workstation here.
- VSCode Version: 1.29.1
- OS Version: Windows 10.0.15063
Steps to Reproduce:
(Since this seems to be kind of finicky, I've added more details about how I select things and so on than I would ordinarily provide.)
- Change two different locations in a file.
- Select the changed lines in one location (with the mouse) and choose Git: Stage Selected Ranges from the palette (I open it with Ctrl-Shift-P).
- Fill in a commit message and commit the change by pressing Ctrl-Enter.
- Click off the previous selection and select the other change. Again choose Git: Stage Selected Ranges from the palette. Do not do anything else in between (sometimes the issue does not occur if you do other things).
- View the staged changes. In addition to the newly staged lines, an exact revert of the previous changes is present. This does get committed if you then commit, and it shows up in
git diff --cached.
This happens pretty reliably, but only happened 75% of the times I was trying to reproduce it -- I assume I was doing something else in between or selecting something in a slightly different way the times it didn't happen.
Does this issue occur when all extensions are disabled?: Yes
Git output
VSCode appears to be doing a lot of extra stuff the second time!
On staging the first change:
> git show HEAD:git training/Activities/activities.md
> git hash-object --stdin -w --path git training/Activities/activities.md
> git ls-tree -l HEAD -- git training/Activities/activities.md
> git update-index --cacheinfo 100644 3592ee3adb9657ed0ef318abc491cbc19969d7b5
git training/Activities/activities.md
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse pilot/master
> git rev-parse --symbolic-full-name pilot/master@{u}
> git rev-list --left-right pilot/master...refs/remotes/origin/pilot/master
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
> git show :git training/Activities/activities.md
On staging the second change:
> git hash-object --stdin -w --path git training/Activities/activities.md
> git ls-tree -l HEAD -- git training/Activities/activities.md
> git update-index --cacheinfo 100644 a4df3ae5acc9dfee9d7b33e8608581ca640715eb
git training/Activities/activities.md
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse pilot/master
> git rev-parse --symbolic-full-name pilot/master@{u}
> git rev-list --left-right pilot/master...refs/remotes/origin/pilot/master
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
> git show :git training/Activities/activities.md
> git ls-tree -l HEAD -- c:\Workspaces\Temp\toolslang_tfs_training\git training\Activities\activities.md
> git ls-tree -l HEAD -- c:\Workspaces\Temp\toolslang_tfs_training\git training\Activities\activities.md
> git show 29fdbfdab2573936bf25f93dc9d00e36c3079920
> git ls-files --stage -- c:\Workspaces\Temp\toolslang_tfs_training\git training\Activities\activities.md
> git show 29fdbfdab2573936bf25f93dc9d00e36c3079920
> git ls-files --stage -- c:\Workspaces\Temp\toolslang_tfs_training\git training\Activities\activities.md
> git cat-file -s a4df3ae5acc9dfee9d7b33e8608581ca640715eb
> git cat-file -s a4df3ae5acc9dfee9d7b33e8608581ca640715eb
> git show a4df3ae5acc9dfee9d7b33e8608581ca640715eb
> git show a4df3ae5acc9dfee9d7b33e8608581ca640715eb
> git show HEAD:git training/Activities/activities.md
> git show :git training/Activities/activities.md