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

Include owner in default path when cloning a repository #1906

Merged
merged 13 commits into from
Sep 13, 2018

Conversation

jcansdale
Copy link
Collaborator

@jcansdale jcansdale commented Sep 10, 2018

What this PR does

Rather than suggesting a flat folder structure when cloning a repository, suggest a folder structure that includes the repositories owner

  • Suggest a default clone location of DefaultClonePath/Owner/RepoName
  • Allow user to change DefaultClonePath portion of path (keep when new repo is selected)

How to test

Immediately change default clone path

  1. Change the DefaultClonePath before selecting a repository
  2. Select a repository
  3. Check that owner\repo has been added to path

Change directory name after selecting repository

  1. Select a repository
  2. Change name of repository in path
  3. Select another repository
  4. Check the owner\repo in path has changed

Remove repository name from path

  1. Select a repository
  2. Remove name of repository in path
  3. Select another repository
  4. Check the repo has been added to path

Remove owner and repository name from path

  1. Select a repository
  2. Remove owner and name of repository from path
  3. Select another repository
  4. Check that owner\repo has been added to path

Clear the path

  1. Clear the path
  2. Select a repository
  3. Check that default path has been restored and owner\repo added to path

Remove owner from path

  1. Select a repository
  2. Remove owner from path
  3. Select another repository
  4. Check that previous repository name isn't included in path

Expect test to fail until functionality implemented.
Keep the base path consistent if user edits the fully qualified path.
Check different combinations of repository and path changes.
@meaghanlewis
Copy link
Contributor

meaghanlewis commented Sep 11, 2018

👋 @jcansdale I just had a look at how this works.

Question:
What was your motivation for adding this functionality? Do you usually have more structure in the way your organize your repositories? Just curious here 😄

Feedback:
Thanks for all the test scenarios! Those all work how you describe. A couple other scenarios that stuck out for me were:

  • removing the full path : select a repository, remove the path, select another repository the path is only populated as owner\repo
  • removing only the owner name select a repository, remove just the owner and keep the repo name, select another repository and notice the path gets appended with another owner\repo so the full path becomes default clone path\repo\owner\repo

Both of which are fine as they are since a user will likely select a new local clone path they're happy with if something undesired happened.

I think this works really nicely and will be helpful at providing more structure for those who have lots of repositories from different owners or organizations.

@jcansdale
Copy link
Collaborator Author

@meaghanlewis,

Thanks for taking a 👀

What was your motivation for adding this functionality? Do you usually have more structure in the way your organize your repositories? Just curious here 😄

Yup, I always organize my folders in a way that mirrors GitHub. I'll often clone a few repositories from the same owner. It's the only way I can keep any kind of order!

removing the full path : select a repository, remove the path, select another repository the path is only populated as owner\repo

It would be easy enough to reset back to the default clone location if the user removes the full path. I think if someone was to do this, that is what they'd be hoping for?

removing only the owner name select a repository, remove just the owner and keep the repo name, select another repository and notice the path gets appended with another owner\repo so the full path becomes default clone path\repo\owner\repo

I'll see if this can be fixed as well without any undesirable consequences. I think its okay for the reason you mentioned, but maybe it could be better. 😄

Test that if the target Path is cleared, DefaultClonePath will be used
as the base path on next selection.
If Path is cleared, restore the DefaultClonePath on next selection.
Test that we don't duplicate the repo on next selection.
Don't include old the repository name when next repository is selected.
@jcansdale
Copy link
Collaborator Author

@meaghanlewis,

I've fixed the two scenarios that you mentioned and added them to the list.

I've also fixed an an edge case where the owner and repository had the same name. Previously it would only delete the repository rather than both.

@jcansdale jcansdale changed the base branch from refactor/clone to master September 11, 2018 11:12
@meaghanlewis
Copy link
Contributor

This LGTM! ✨ ✨

Copy link
Contributor

@grokys grokys left a comment

Choose a reason for hiding this comment

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

Just one tiny thing, but other than that looks good!

@@ -114,12 +114,10 @@ public async Task Path_Is_Initialized()
public async Task Repository_Name_Is_Appended_To_Base_Path()
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to update test name.

@jcansdale jcansdale merged commit d0ae1d5 into master Sep 13, 2018
@jcansdale jcansdale deleted the refactor/clone-include-owner-in-path branch September 13, 2018 11:03
@meaghanlewis meaghanlewis added this to the 2.5.6 milestone Sep 13, 2018
Copy link

@saidi6882 saidi6882 left a comment

Choose a reason for hiding this comment

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

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.

4 participants