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

Fix #1798 - Disable UndoLastCommit when no commits #12583

Merged
merged 1 commit into from
Oct 14, 2016
Merged

Fix #1798 - Disable UndoLastCommit when no commits #12583

merged 1 commit into from
Oct 14, 2016

Conversation

Krzysztof-Cieslak
Copy link
Contributor

This makes Undo Last Commit action in Git Integration if there are no commits (usually just after git init)

Unfortunately UndoLastCommit will also fail if there is only one commit (HEAD~ is not defined in such case). But it looks like that currently git integration doesn't provide information about HEAD parent (or commit list, or anything like that) so it would require more "deep" changes.

CC: @joaomoreno as assignee to #1798

@msftclas
Copy link

Hi @Krzysztof-Cieslak, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@coveralls
Copy link

Coverage Status

Coverage remained the same at 61.185% when pulling 51e4376 on Krzysztof-Cieslak:fix_1798 into 8911a6a on Microsoft:master.

@joaomoreno joaomoreno added this to the October 2016 milestone Sep 27, 2016
@bjtucker
Copy link

bjtucker commented Oct 5, 2016

This makes Undo Last Commit action in Git Integration if there are no commits (usually just after git init)

Cool, thank you! This bug held a special place in my heart, since it lost me a little bit of data in my first hour or two of trying vscode.

Unfortunately UndoLastCommit will also fail if there is only one commit (HEAD~ is not defined in such case).

Does gitservice throw an error that you can trap if HEAD~ is not available? I see an IGitServiceError defined in https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/git/common/git.ts
but I can't dig in right now...

In such a case (deleting the first and only commit), I think the right thing to do would be to fall back to delete the branch. Perhaps with a confirmation prompt. Thoughts?

@joaomoreno joaomoreno merged commit 51e4376 into microsoft:master Oct 14, 2016
@joaomoreno
Copy link
Member

Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants