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
Add functionality for cloning from git in welcome view #232
Conversation
Basics of cloning repository implemented. Pressing clone on welcome view now opens simple window with url input with clone and close buttons For now it clones the repositories in to your home dir. Error handling for now is nada and should be implemented in later commits
Now you can select the folder to which you want to clone the repository. This defaults to home folder. Also added check that the repository isn't empty when trying to clone.
Now after we press `clone` button, we firstly clone the specified repository to given folder. After cloning, we open folder picker for the user to pick folder to open the editor in. However this could be better if we straight up open the editor in the cloned folder, rather than giving user an option to choose the folder in between.
Added error handling for git related errors e.g. when trying to clone non existent repository
CodeEdit/GitClone/GitCloneView.swift
Outdated
import GitClient | ||
import Foundation | ||
|
||
struct GitCloneView: View { |
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.
Consider adding this as a package in Modules
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.
I was just writing this! ahah yeah, it would be awesome to have it on a module and a snapshot test alongside!
Hi @Pythonen , it would be nice to have this this thing this way: the possibility that the program has a menu like this, which by clicking on the button allows you to clone the project (whose http or git address was copied previously) and then to open the program. |
Changed GitClone to be module as discussed in CodeEditApp#232 (comment)
I'm having a couple of 'bugs' in my current implementation. Gif helps to demonstrate.
Mind taking a look at the current implementation and maybe suggesting fixing changes if you happen to immediately notice easy fixes? |
The textfield is too long. |
The git clone dialog needs to be narrower than the welcome dialog. |
Give this view a title and put |
Switched the git clone view folder picking to use NSSavePanel instead of NSOpenPanel. NSSavePanel gives us kind of the same flow as Xcode has, as it's also using NSSavePanel to prompt the target folder for cloning. The view now consist of two separate modals that pop open, and it may seem cumbersome, but it now has kind of the same functionality as Xcode.
Switched a little how the view acts. This is more Xcode-like flow with the repo url and picking the target folder. This way the user now also has an option to clone the repository with some other name Thoughts? newview.mov |
@Pythonen : it works fine even if you put an ssh address, right? Graphics like this would look very nice. It would be helpful if it asks you which branch you want to checkout on. Using the following api, find all reports similar to the search that xcode does. Info: https://docs.github.com/en/rest/reference/search#search-repositories |
Also fix current implementation to use the new ShellClient
@lukepistrol : how about adding such a thing too? Registrazione.schermo.2022-03-28.alle.12.57.04.mov |
Yes, git@github.com:CodeEditApp/CodeEdit.git style addresses work aswell as it just uses Showing repositories from Github when cloning is cool idea, but for the release 1.0 it feels a bit of a |
@Pythonen : I understand, when cloning the report will it allow you to ask which branch you want to checkout on and let you see the cloning progress like Xcode does? |
In the making 👍 |
I really like this dialog... Here are a few minor adjustments that need to be made...
|
@austincondiff So something along these lines UI-wise? |
Repositioning buttons, input and text. Also added app icon to the view
Does Xcode allow cloning of personal repos on the welcome screen? @Pythonen |
You mean private? AFAIK yes if you have (insert your git hosting site) account added to Xcode. |
If you have 'valid' git url in your clipboard when opening the clone view, it now automatically pastes it to the textfield
@Pythonen : Would it be possible to implement the functionality on which branch you want to checkout? |
Yes, wip |
@Pythonen Where are we with this PR? |
Been pretty busy at work so this has been stalling for a bit now, sorry for that. AFAIK it's still not possible to open the editor from modules (?) correct me if I'm wrong. Your thoughts? @austincondiff |
@Pythonen totally understand! Let's get this figured out so it doesn't get too stale. I'd hate for your awesome work to go to waste. Make sure you rebase every now and then to prevent this. @lukepistrol @MarcoCarnevali what do you think? Would this be a good idea to merge what we have here to allow others to finish? Who is able to help to finish this effort? |
i agree, if @MarcoCarnevali approves the pull request, it's better to merge it, and open a issue or so, so that other people can also work on it. |
Fixed indentation in WelcomeView and moved the logic of cloning repository into it's own private function
* Git Clone: Add basic functionality of cloning repository Basics of cloning repository implemented. Pressing clone on welcome view now opens simple window with url input with clone and close buttons For now it clones the repositories in to your home dir. Error handling for now is nada and should be implemented in later commits * Git Clone: Select target folder and clone the repository Now you can select the folder to which you want to clone the repository. This defaults to home folder. Also added check that the repository isn't empty when trying to clone. * Git Clone: Open cloned folder Now after we press `clone` button, we firstly clone the specified repository to given folder. After cloning, we open folder picker for the user to pick folder to open the editor in. However this could be better if we straight up open the editor in the cloned folder, rather than giving user an option to choose the folder in between. * Git Clone: Add error handling Added error handling for git related errors e.g. when trying to clone non existent repository * Git Clone: Implementation as a module Changed GitClone to be module as discussed in #232 (comment) * Git Clone: Uncomment dependency from Package.swift * Git Clone: Switch to use NSSavePanel Switched the git clone view folder picking to use NSSavePanel instead of NSOpenPanel. NSSavePanel gives us kind of the same flow as Xcode has, as it's also using NSSavePanel to prompt the target folder for cloning. The view now consist of two separate modals that pop open, and it may seem cumbersome, but it now has kind of the same functionality as Xcode. * Git Clone: Remove .git only if the url has it. * Git Clone: Reposition UI Repositioning buttons, input and text. Also added app icon to the view * Git Clone: Change clone view to be sheet Changed git clone view to be sheet instead of normal window. This is better for UX as you can't click anywhere else than the clone view until you either cancel or clone the repository * Git Clone: Validate url and more error handling Naive Xcode-like check for the url implemented. For now if the url does not start with certain string, the clone button is disabled, just like in Xcode. Also added check for when user decides to press cancel on folder selection #232 (comment) * Git Clone: Add automatic pasting If you have 'valid' git url in your clipboard when opening the clone view, it now automatically pastes it to the textfield * GitClone: Fix some force unwrappings and make vars private * GitClone: Make shellClient constant * GitClone: Fix indentation and make logic private func Fixed indentation in WelcomeView and moved the logic of cloning repository into it's own private function * GitClone: Add CheckoutBranchModal Added modal to checkout to other branches after cloning the repository * GitClone: Make checkout button defaultAction * GitClone: Add possibility to checkout to remote branches Showing all branhes to make it possible to checkout to remote branches as well as local * GitClone: Make the modal wider * GitClone: Open checkout branch modal only if there's multiple branches * GitClone: Refactor extension to separate file.
Description
This patch adds functionality for cloning a repository from the welcome view. Feel free to point out obvious mistakes as I am taking first touches with Swift world at the same time.
Related Issue
Checklist (for drafts):
Screenshots (if appropriate):