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.
feat: add git2 integration for more robust git support #123
feat/git2-integration into main @ -0,0 +52,4 @@
repo_name
.chars()
.take_while(|c|c.is_alphanumeric()||'-'.eq(c))
.collect::<String>()
What about repo_name.strip_suffix(".git").to_owned().unwrap_or(repo_name)?
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
@ -0,0 +40,4 @@
.remotes()?
.into_iter()
.filter_map(|remote|{
letmutgit_url=remote.url().map(PathBuf::from)?;
I'd suggest using the url crate instead of PathBuf
I think I already added the crate in the mean time so this should be a no-brainer as well. Thanks for catching that!
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.
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.
I think this here might be relevant. We would probably have to parse and adjust the "URL" coming from the API
oh, whoops. didn't see it was already merged
Something is not working
Contributions are very welcome, get started here
No description
This issue or pull request already exists
Interested in contributing? Get started here.
Need some help
Something is wrong
More information is needed
No description
Related to an upstream repository, already reported there
No due date set.
No dependencies set.
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?