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 fails to register deletion of new staged files #7789

Open
RDIL opened this issue May 11, 2020 · 7 comments
Open

Git fails to register deletion of new staged files #7789

RDIL opened this issue May 11, 2020 · 7 comments
Labels
bug bugs found in the application git issues related to git help wanted issues meant to be picked up, require help

Comments

@RDIL
Copy link
Contributor

RDIL commented May 11, 2020

Bug Description

I'm going to do my best to explain this confusing bug.

Say you are in a git repository.

If you add a file called file.txt, head to the git tab, and then stage it, it switches to the staged section as expected.

However, if you delete this file, it disappears from the staged section - again, as expected.

But once you do commit, you will see that one pending change which was not visible before is now showing itself - the deletion of file.txt!

Steps to Reproduce

  1. Init a git repo
  2. Create a file
  3. Stage the addition of this file through the Git GUI
  4. Head back to files and delete the new file
  5. Return to git tab and commit
  6. See bug

Additional Information

  • Operating System: ubuntu focal
  • Theia Version: gitpod
@vince-fugnitto vince-fugnitto added the git issues related to git label May 11, 2020
@vince-fugnitto
Copy link
Member

@RDIL do you mind confirming the same behavior in vscode?
Eventually support for @theia/git will be dropped in favor of vscode-builtin-git and vscode-builtin-git-ui.

@akosyakov
Copy link
Member

@vince-fugnitto In Gitpod @theia/git is used.

@vince-fugnitto
Copy link
Member

@vince-fugnitto In Gitpod @theia/git is used.

Yes I know, just wanted to confirm if it also an issue in vscode and with the builtins.
My reasoning was if it is a bug only with @theia/git and that it is a small corner case that the bug is not a big priority.

@TravisEz13
Copy link

for me at step 5 I see this:
image
but it commits the addition of the file which is what I would expect.
and in the git tab, I still have the deletion of the file as a change, yet to be staged/commited.

@RDIL
Copy link
Contributor Author

RDIL commented May 13, 2020

Alright so this is only in Theia

@akosyakov akosyakov added bug bugs found in the application help wanted issues meant to be picked up, require help labels May 14, 2020
@westbury
Copy link
Contributor

westbury commented Jun 1, 2020

However, if you delete this file, it disappears from the staged section - again, as expected.

No, that is not as expected. Deleting the file deletes it in the working tree. It does not affect the index. Seeing the deletion after one has committed is correct because the file was added in the commit.

The error is in fact that the file does not show at all after the deletion and before the commit. It should show as added in the staged changes and deleted in the unstaged changes. The problem is caused by these lines:

https://github.com/theia-ide/dugite-extra/blob/815ff1886b3e1f159d670b9c8ed619e4addb2e57/src/command/status.ts#L109-L117

The comment is incorrect. Those lines just need to be removed. One will then see the file added in the staged changes and deleted in the unstaged changes as expected (i.e. as vscode does and as git-gui does).

@westbury
Copy link
Contributor

westbury commented Jun 2, 2020

Pull-request created eclipse-theia/dugite-extra#36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application git issues related to git help wanted issues meant to be picked up, require help
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants