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

Show file when staged to add but deleted in working tree #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

westbury
Copy link

@westbury westbury commented Jun 2, 2020

This is the fix for eclipse-theia/theia#7789 .

If a file is created, then staged, then deleted, it is still staged for add (being in the index) and will be included in the commit. Changes that have been made to the working tree but not staged will not be included in the commit, this includes the deletion of the file.

In this screenshot Untitled2.txt is now shown added in the staged area and deleted in the unstaged area. Before it was not shown in either area, even though the add was being included in the commit.

Screenshot from 2020-06-02 11-46-19

@westbury
Copy link
Author

westbury commented Jun 2, 2020

I've pushed a second commit to also fix the problem where a file is deleted, staged, then re-created in the working tree. It now shows as D in the staged area and U in the unstaged area. See CONTRIBUTING.md

Screenshot from 2020-06-02 15-12-01

@kittaakos
Copy link
Contributor

This is the fix for eclipse-theia/theia#7789 .

Can you add a test for it?

Also, aligning the implementation with GitHub Desktop would make sense: https://github.com/desktop/desktop/blob/3551d3742753b85084a165c46ac582a4be5fd090/app/src/lib/git/status.ts#L255-L297

@westbury
Copy link
Author

westbury commented Jun 4, 2020

I was wondering where the offending code came from. It looked like it was fixing someone's bug but it certainly was not fixing any bug in Theia.

aligning the implementation with GitHub Desktop would make sense

Not really. GitHub Desktop presents a simpler interface to the user. It does not show staged changes and unstaged changes. It just presents all the changes in a single list, each file listed once only, and has check-boxes to select which files will be committed. My 14 year old son says he won't use GitHub Desktop because it is too simple for his needs. Theia, however, is designed to show staged and unstaged changes correctly, like vs-code, git-gui and git-kraken.

Definitely best to return the status information as git does. Consumers can do this funky merging of staged and unstaged states if they want, but dugite-extra should not do this because then the information is lost and consumers can't present staged and unstaged states correctly

I'll get the test done tomorrow.

@westbury
Copy link
Author

westbury commented Jun 8, 2020

I said I would get the tests done last week but the tests have shown up more work. I'll get back to this as time permits, hopefully this week.

@kittaakos
Copy link
Contributor

Excellent, please name me here when it's ready for the review, and we roll out a new release. Thank you!

@RDIL
Copy link

RDIL commented Jul 2, 2020

Hey @westbury any updates on this? :)

@westbury
Copy link
Author

Hey @westbury any updates on this? :)

@RDIL sorry, it has been a while. I'll put something in on Wednesday, in a couple of days.

@westbury
Copy link
Author

See eclipse-theia/theia#8221 . That PR may obsolete this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants