-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat!(clone): Use better cloning policy #148
Conversation
Added a new function IsPushable to check if a user has push permissions based on the viewerPermission API query. Added new util file in the github package to include helper functions and facilitate unit testing on command outputs.
- Deprecated the `nofork` flag in favour of a `fork` one - Default Clone behaviour is branching instead of forking - Modified tests to reflect the changes in the clone command.
Updated the README to clarify the usage of the `turbolift clone` command.
This commit fixes the logic for forking and cloning repositories. Also changed the testing logic to include the type of call for GH. This is because the testing was just on the argument and was missing context when running the unit test.
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.
Provisional 👍 !
Updated the IsPushable function to use the full repository name instead of the repository directory path. The gh command now uses a repository as a parameter, since the clone has not taken place yet.
Added a new test to verify behavior when permission check fails. Updated the log message to correctly display the repository name when determining push permissions.
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.
LGTM
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.
LGTM
Co-authored-by: Richard North <[email protected]>
Description of the change
BREAKING CHANGE
--no-fork
flag in favour of--fork
to force forking.Context
The all-or-nothing approach of Turbolift around the clone policy (either forking or branching) is causing a lot of friction and requires the user to think about it.
gh
goes around the problem by cloning normally but checking at push time whether the user has write permission on the target repository and prompt the user what to do.We use a similar mechanism to decide at clone time what the clone policy should be, branching or forking.
The user still has the option to force the forking if they desire.
Change content
Related to
Fixes #146.