9
310
Fork
You've already forked codeberg-cli
33

feat: add git2 integration for more robust git support #123

Merged
Aviac merged 1 commit from feat/git2-integration into main 2024年05月08日 22:58:38 +02:00
Owner
Copy link

This kind of prepares for solving #77 since this issue needs robust handling of remotes and I don't trust myself enough with writing that code. It's also a nice refactor and actually makes the current workflows more robust as well. This is the case since we will consider the existing remotes now more carefully when searching for the local owner/repo name.

This kind of prepares for solving #77 since this issue needs robust handling of remotes and I don't trust myself enough with writing that code. It's also a nice refactor and actually makes the current workflows more robust as well. This is the case since we will consider the existing remotes now more carefully when searching for the local owner/repo name.
Aviac deleted branch feat/git2-integration 2024年05月08日 22:58:41 +02:00
@ -0,0 +52,4 @@
repo_name
.chars()
.take_while(|c|c.is_alphanumeric()||'-'.eq(c))
.collect::<String>()
Contributor
Copy link

What about repo_name.strip_suffix(".git").to_owned().unwrap_or(repo_name)?

What about `repo_name.strip_suffix(".git").to_owned().unwrap_or(repo_name)`?
Author
Owner
Copy link

Might also make sense. I don't really know much about how git remotes can look like in general. But yeah, stripping the .git away should handle the general case and for anything else there are issues that can be opened here. Thanks for the reminder to KISS! I'll make the change on my next session

Might also make sense. I don't really know much about how git remotes can look like in general. But yeah, stripping the `.git` away should handle the general case and for anything else there are issues that can be opened here. Thanks for the reminder to KISS! I'll make the change on my next session
Aviac marked this conversation as resolved
@ -0,0 +40,4 @@
.remotes()?
.into_iter()
.filter_map(|remote|{
letmutgit_url=remote.url().map(PathBuf::from)?;
Contributor
Copy link

I'd suggest using the url crate instead of PathBuf

I'd suggest using the `url` crate instead of `PathBuf`
Author
Owner
Copy link

I think I already added the crate in the mean time so this should be a no-brainer as well. Thanks for catching that!

I think I already added the crate in the mean time so this should be a no-brainer as well. Thanks for catching that!
Author
Owner
Copy link

Nevermind. I just remembered that I don't like the url crate since it fails to parse stuff like git@codeberg.org/aviac/codeberg-cli.git and errors out. So I won't use this.

Nevermind. I just remembered that I don't like the `url` crate since it fails to parse stuff like `git@codeberg.org/aviac/codeberg-cli.git` and errors out. So I won't use this.
Contributor
Copy link

Ohh right, I ran into that issue with the ssh_url fields in forgejo_api. Been meaning to find or make a crate that handles ssh urls.

Ohh right, I ran into that issue with the `ssh_url` fields in `forgejo_api`. Been meaning to find or make a crate that handles ssh urls.
Author
Owner
Copy link

I think this here might be relevant. We would probably have to parse and adjust the "URL" coming from the API

https://github.com/servo/rust-url/issues/599

I think this here might be relevant. We would probably have to parse and adjust the "URL" coming from the API https://github.com/servo/rust-url/issues/599
Contributor
Copy link

oh, whoops. didn't see it was already merged

oh, whoops. didn't see it was already merged
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Aviac/codeberg-cli!123
Reference in a new issue
Aviac/codeberg-cli
No description provided.
Delete branch "feat/git2-integration"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?