Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

[SPIKE] Don't do "clean" check before attempting to check-out PR #1304

Closed
wants to merge 19 commits into from

Conversation

jcansdale
Copy link
Collaborator

@jcansdale jcansdale commented Nov 8, 2017

NOTE: This PR is intended for experimenting with functionality rather than necessarily merging.

In previous versions, the PR Checkout link was only active if the working directory and latest commit where exactly the same. There isn't this restriction when checking out using command line Git.

In #1302 this restriction is relaxed a bit to allow untracked files in the staging area (often build artifacts or log files). This PR changes it to behave more like the command line. It will always attempt a checkout and inform the user if it fails.

  • For example, if the user makes a local change.

image

The Checkout command will work and bring that change to the PR branch. There currently isn't any indication that there are local changes when using the PR pane.

  • If there are local changes that conflict with the PR being checked out, an error message will be displayed.

image

It doesn't currently give any hints how to fix the conflicts. Maybe we should offer the user a link to the Team Explorer - Changes pane?

Fixes #1271.

If the PR can't be checked out, an informative error will be displayed.
No need to double guess what can/can't be checked out.
We no longer check to see if a repo is dirty before attempting a checkout.
@grokys
Copy link
Contributor

grokys commented Nov 9, 2017

It doesn't currently give any hints how to fix the conflicts. Maybe we should offer the user a link to the Team Explorer - Changes pane?

Yes, I think that would be the best solution.

@grokys grokys changed the title Don't do "clean" check before attempting to check-out PR WIP: Don't do "clean" check before attempting to check-out PR Nov 13, 2017
@jcansdale
Copy link
Collaborator Author

jcansdale commented Nov 13, 2017

Here are some related issues:

Initially thought to be related, but maybe this PR is a simpler solution:

Also related:

@meaghanlewis
Copy link
Contributor

Hey @jcansdale thanks for making these changes! I was testing this and have a few questions.

  • Where does the message 1 conflict prevents checkout come from? I can't find it in the codebase anywhere.
  • I get the conflict message sometimes even when I've changed files that aren't related to a PR. For example, I changed a file (src\GitHub.UI\GitHub.UI.csproj) that wasn't included in the files changed in this PR and then tried to check out this branch fixes/1271-just-try-PR-checkout. This is unexpected, right?
  • Is clicking [GitChanges] supposed to take me to Team Explorer - Changes? Currently it's not doing anything for me.

git changes

  • Unrelated to functionality, but I noticed that tests were removed for this PR but no new ones were added. Should they be added? I'd be up to pair to add a test or two (especially because I currently have no idea how to write tests for this project)!

@jcansdale
Copy link
Collaborator Author

Where does the message 1 conflict prevents checkout come from? I can't find it in the codebase anywhere.

This is a the message from a libgit2sharp exception that gets thrown when it fails to checkout (kind of like when command line Git can't do a checkout).

I get the conflict message sometimes even when I've changed files that aren't related to a PR. For example, I changed a file (src\GitHub.UI\GitHub.UI.csproj) that wasn't included in the files changed in this PR and then tried to check out this branch fixes/1271-just-try-PR-checkout. This is unexpected, right?

I think changing files that are included in the PR might be okay, it's changing files that are changed on the target branch that is an issue.

Is clicking [GitChanges] supposed to take me to Team Explorer - Changes? Currently it's not doing anything for me.

Yup, that is how it's supposed to work! I'll check.

Unrelated to functionality, but I noticed that tests were removed for this PR but no new ones were added. Should they be added?

In this case the tests were for a method that has been removed. To test the new functionality, we would need to do integration tests against a real Git repo. This might be a little involved, so I think it would make sense to flesh out exactly how we want it to work before tackling this. It definitely makes sense to add them though.

@jcansdale jcansdale force-pushed the fixes/1271-just-try-PR-checkout branch from ba859ce to 905f3e1 Compare November 30, 2017 15:48
@jcansdale jcansdale changed the title WIP: Don't do "clean" check before attempting to check-out PR [SPIKE] Don't do "clean" check before attempting to check-out PR Dec 5, 2017
@jcansdale
Copy link
Collaborator Author

This PR was an experiment at addressing #1271. This has since been fixed by the following PRs:

@jcansdale jcansdale closed this Feb 9, 2018
@jcansdale jcansdale deleted the fixes/1271-just-try-PR-checkout branch February 9, 2018 09:37
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.

Can't checkout PR when there are untracked files
3 participants