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 #44776 - Error on "Undo Last Commit" if executed against the initial commit #47578

Merged
merged 9 commits into from
Jul 6, 2018

Conversation

ryu1kn
Copy link
Contributor

@ryu1kn ryu1kn commented Apr 10, 2018

Fix for the issue #44776. Why I fixed this way is written in #44776 (comment).

Please have a look 😉

@msftclas
Copy link

msftclas commented Apr 10, 2018

CLA assistant check
All CLA requirements met.

@joaomoreno
Copy link
Member

@ryu1kn While tests are great, I'm not too happy in having stubs in the git tests. Either make them not use stubs, or remove them.

@joaomoreno joaomoreno added this to the Backlog milestone Apr 11, 2018
@joaomoreno joaomoreno added the git GIT issues label Apr 11, 2018
@joaomoreno joaomoreno self-assigned this Apr 11, 2018
@ryu1kn
Copy link
Contributor Author

ryu1kn commented Apr 11, 2018

Repository’s getCommit and deleteRef are not pure functions and behave differently depending on the outer world or make side effects; so to test them, i need to stub dependency or record the call from the repository. If you don’t want stub, i think i have to remove the tests i wrote...

@ryu1kn
Copy link
Contributor Author

ryu1kn commented Apr 11, 2018

@joaomoreno Can you think of better way of writing those tests? I believe those tests, especially the ones for Repository#getCommit are showing what you can expect from the method and so valuable. I wonder if we want to keep them.

@ryu1kn
Copy link
Contributor Author

ryu1kn commented Apr 11, 2018

Or I can test not the whole Repository#getCommit but only the logic of parsing git output by extracting it as an exported function. I usually don't export things from a module only for testing purpose, but looks like this is how we do it.

ryu1kn added 2 commits April 11, 2018 20:02
* Instead of testing it through `getCommit` as we don't use stub in test
@ryu1kn
Copy link
Contributor Author

ryu1kn commented Apr 11, 2018

@joaomoreno I've updated the PR. How does it look now?

@ryu1kn
Copy link
Contributor Author

ryu1kn commented Apr 18, 2018

@joaomoreno Haven't had a chance to look at it again?

@joaomoreno
Copy link
Member

Thanks! 🍻

@joaomoreno joaomoreno merged commit a028238 into microsoft:master Jul 6, 2018
@ryu1kn ryu1kn deleted the fix-git-reset branch July 7, 2018 07:33
@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
git GIT issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants