GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove empty directory when clone fails by YuPeiHenry · Pull Request #2241 · github/VisualStudio

This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Conversation

@YuPeiHenry

@YuPeiHenry YuPeiHenry commented Feb 26, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Ready for review.
fixes #2126 . Added unit test to check that directory is removed when clone fails.

The fix deletes the directory when an exception in RepositoryCloneService:Clone is caught.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

meaghanlewis reacted with hooray emoji
All reactions
  • 🎉 1 reaction
YuPeiHenry added 2 commits February 26, 2019 02:04
@YuPeiHenry
Fix residual empty directory when clone fails.
b42e08e
- Currently an empty directory will be created when trying
to clone non-existant remote repo.
- This commit adds an action to delete the repo directory
if an exception occurs while cloning.
@YuPeiHenry
Add test for empty directory on clone fail.
9d4235a
jcansdale
jcansdale suggested changes Feb 26, 2019
View reviewed changes

@jcansdale jcansdale left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks very much for the PR. We definitely need this! 😄

I've requested a few minor changes. 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/GitHub.App.UnitTests/Services/RepositoryCloneServiceTests.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/GitHub.App.UnitTests/Services/RepositoryCloneServiceTests.cs Outdated

operatingSystem.Directory.Received().CreateDirectory(@"c:\dev\bar");
operatingSystem.Directory.Received().DeleteDirectory(@"c:\dev\bar");
await vsGitServices.Received().Clone("https://github.com/failing/url", @"c:\dev\bar", true);

@jcansdale jcansdale Feb 26, 2019

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Could you factor out "https://github.com/failing/url" and @"c:\dev\bar" into something like cloneUrl and clonePath?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/GitHub.App/Services/RepositoryCloneService.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@meaghanlewis

meaghanlewis commented Feb 26, 2019

Copy link
Copy Markdown
Contributor

@YuPeiHenry thank you for your contribution!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@meaghanlewis meaghanlewis added this to the 2.9.0 milestone Feb 26, 2019
YuPeiHenry and others added 3 commits February 27, 2019 09:52
@YuPeiHenry
GitHub.App RepositoryCloneService: Move log error.
894875e
- Delete directory may throw errors, so log.Error should be called first.
@YuPeiHenry
RepositoryCloneServiceTests:Rewrite test for readability.
c6c1437
- Assert.ThrowAsync statement have been shortened.
- failing url and dev bar have been factored into clonePath and cloneUrl.
@YuPeiHenry
Merge branch 'master' into 2126-empty-directory-when-clone-fails
65d7dfb
@YuPeiHenry

YuPeiHenry commented Feb 27, 2019

Copy link
Copy Markdown
Contributor Author

@jcansdale I have updated the PR to adopt your suggestions.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

YuPeiHenry and others added 2 commits February 28, 2019 09:59
@YuPeiHenry
Merge branch 'master' into 2126-empty-directory-when-clone-fails
1bf44a2
@jcansdale
Remove dependency on Substitutes class
72c146d
RepositoryCloneServiceTests and Substitutes were getting too coupled.
This commit makes RepositoryCloneServiceTests self contained.
jcansdale
jcansdale approved these changes Feb 28, 2019
View reviewed changes
StanleyGoldman
StanleyGoldman approved these changes Feb 28, 2019
View reviewed changes
@StanleyGoldman
StanleyGoldman merged commit 0054884 into github:master Feb 28, 2019
@github github deleted a comment Feb 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@jcansdale jcansdale jcansdale approved these changes
@StanleyGoldman StanleyGoldman StanleyGoldman approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

2.9.0

Development

Successfully merging this pull request may close these issues.

Don't leave behind empty directory when a clone fails

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@YuPeiHenry @meaghanlewis @StanleyGoldman @jcansdale
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.