Skip to content

Re-download checkout if failing to reset #40

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

Merged
merged 5 commits into from
May 9, 2019

Conversation

fredpi
Copy link
Contributor

@fredpi fredpi commented May 1, 2019

Fixes #27 using a pragmatic approach.

As Accio currently fails to build (maybe only on my machine?) due to a build error in xcodeproj, this is not tested yet.

@fredpi fredpi requested a review from Jeehut May 1, 2019 17:19
Copy link
Contributor

@Jeehut Jeehut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR, basically I'm okay with merging it, but I'd get the two commented questions answered before doing so to keep consistency within the projects. For the same goal, I also have another question:

Given that we have git -C calls elsewhere too (and it's always the same three calls), shouln't we refactor this to a method and do the try-catch for all cases? The method might be throwing so we can handle the error case on the usage side.

@fredpi fredpi force-pushed the work/#27-handle-failing-repo-reset branch from 80bb12a to be4d7dd Compare May 3, 2019 15:12
@fredpi
Copy link
Contributor Author

fredpi commented May 3, 2019

Given that we have git -C calls elsewhere too (and it's always the same three calls), shouln't we refactor this to a method and do the try-catch for all cases? The method might be throwing so we can handle the error case on the usage side.

If I looked it up properly, the other git -C calls happen after Swift PM resolves the dependencies. So if we delete the checked out repo, Swift PM won't come to the rescue and redownload it just afterwards. This is why I think, it's only suitable to apply this handling to the git -C commands run before DependencyResolverService.shared.resolveDependencies() is performed.

@Jeehut
Copy link
Contributor

Jeehut commented May 3, 2019

@fredpi As I've already stated:

The method might be throwing so we can handle the error case on the usage side.

What I mean there is that the refactored method should actually not include a do-catch but instead a try and be throwing. Then whenever we know what to do as an alternative when the reset fails, we could act accordingly (like deleting checkouts in the one case).

@fredpi
Copy link
Contributor Author

fredpi commented May 3, 2019

@Dschee Sorry, I didn't read carefully -.-

@Jeehut
Copy link
Contributor

Jeehut commented May 3, 2019

No problem, I may have been ambiguous or at least not so clear. 😅

@fredpi fredpi force-pushed the work/#27-handle-failing-repo-reset branch from dc3fad8 to c7ec9d9 Compare May 3, 2019 16:30
@fredpi
Copy link
Contributor Author

fredpi commented May 3, 2019

Should be good to merge now

Copy link
Contributor

@Jeehut Jeehut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly finished, but you missed the reset of untracked files (see this commit). See comments above.

@Jeehut
Copy link
Contributor

Jeehut commented May 7, 2019

Please also remove the [WIP] in the title when it's ready for merge. :)

@fredpi fredpi changed the title [WIP] Re-download checkout if failing to reset Re-download checkout if failing to reset May 7, 2019
@Jeehut
Copy link
Contributor

Jeehut commented May 9, 2019

Looks good now, merging. Thanks for the PR! 🎉

@Jeehut Jeehut merged commit c832ef6 into stable May 9, 2019
@Jeehut Jeehut deleted the work/#27-handle-failing-repo-reset branch May 9, 2019 04:15
@Jeehut
Copy link
Contributor

Jeehut commented May 9, 2019

Oh no, we forgot the Changelog entry. 😄

fredpi added a commit that referenced this pull request May 10, 2019
Jeehut added a commit that referenced this pull request May 13, 2019
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.

Error reverting changes in the checkouts directory
2 participants