-
Notifications
You must be signed in to change notification settings - Fork 287
feat: cloning remote repository #420
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
Conversation
onefetch-clone-repo.mp4That's how it looks like with progress bars |
.arg( | ||
Arg::with_name("remote") | ||
.long("remote") | ||
.help("Clone repository from remote"), | ||
) |
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 think it would be useful if this arg either
- Had another arg that required this arg
- Took a second value
So that the user could specify whether the cloned repo should be deleted or kept.
e.g. onefetch --remote <my URL> --keep
to keep the repo after cloning it.
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 think it would be useful if this arg either
* Had another arg that [required](https://docs.rs/clap/2.33.3/clap/struct.Arg.html#method.requires) this arg * Took a second value
So that the user could specify whether the cloned repo should be deleted or kept.
e.g.
onefetch --remote <my URL> --keep
to keep the repo after cloning it.
Where would you like to keep this repository?
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.
You could probably just clone it to the current directory if it's being kept.
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.
You could probably just clone it to the current directory if it's being kept.
I think it does not make much sense, because you could just do git clone
and then run onefetch there.
Purpose of this feature is to quickly look up information about repository while not caring at all about the repository itself, but just about statistics.
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.
Purpose of this feature is to quickly look up information about repository while not caring at all about the repository itself, but just about statistics.
Yes, that makes sense, but, since it is not doing a shallow clone, you're getting the whole repository anyway. For example, if this feature was used on the Linux repo, it would take a long time. Worse if the user uses this feature and then decides to clone it to do some work on it. It is hardly "quickly looking up information."
For example, somebody could use this feature, and then decide it's a repository that they would want to work on based on the stats. If this feature doesn't support keeping the repository, they would have to clone it a second time.
Although I agree that it is unnecessary to add a --keep
option if the repo is cloned with a shallow depth, since onefetch's clone would take less time, and a shallow clone isn't that useful for actual work. 🙂
🤔 I'm a bit worried about clone depth not being set. Perhaps at least a warning could be documented somewhere, like in the arg's help? |
While I look into this, could someone run
I'm curious what the time difference is between onefetch cloning a repository and the user manually performing a shallow clone. |
Well done @gbaranski 👍 , I took the liberty with bd3abbf to remove the
As @spenserblack mentionned, the Can we handle SSH? Or do we stick to HTTPS, in which case the the "ssh" and "ssh_key_from_memory" features in git2-rs should be disabled. |
Yeah I also thought about that, we could check if it starts by Or maybe just use
I think we could add |
For the URL validation, you can make use of the
I would prefer to keep the default behaviour of the tool as is, which is to run locally and be 100% offline.
Or we can simply try with |
Yeah but some people might not want to use their SSH Key for that. And what if someone has multiple keys and wants to use specific one? |
I've mostly used default behavior when using SSH to clone, and I know little about SSH beyond that, so I may be mistaken. But wouldn't Somewhat related:
Git users can use these to override the SSH key used (e.g. |
I think most people don't even have ~/.ssh/config file, because that's not necessary |
In that case, an additional CLI arg for SSH key path would probably be best, as you suggested earlier. I think the arg should require the |
Still not sure about the necessity of this feature, though. It is very easy to accomplish this with a small script. See this bash script, which is run with I appreciate the work you've done on this PR, but are we sure that this feature should be added? |
So far I've been kinda neutral about this feature overall - as it doesn't really "harm" the project to have it -, but the bash script does seem to be the best option for this 😕. |
🤔 This PR has been in stasis for a while. Perhaps we should ask another collaborator or frequent contributor to offer their opinion? |
@HallerPatrick @yoichi @ebroto @erikgaal @CephalonRho @Luke-zhang-04 |
so... this is kinda like https://github.com/spenserblack/repofetch? |
Hm, ok interesting. I'm just gonna say, I personally don't see myself using this feature, but it's cool nonetheless. |
closes #419
Improve performance by fetching with depth = 1I can't find option in git2 library