hakoerber / git-repo-manager

A git tool to manage worktrees and integrate with GitHub and GitLab
https://hakoerber.github.io/git-repo-manager/
GNU General Public License v3.0
67 stars 9 forks source link

feat: Return an error if the remote type cannot be detected #54

Closed BapRx closed 1 year ago

BapRx commented 1 year ago

Here's what we discussed in #52, currently the behavior is to skip the remote if the type cannot be detected. That results in possibly empty remote in the config. I don't know if that is an issue or not.

❯ grm repos find local -f yaml ~/work/customer
trees:
- root: ~/work/customer
  repos:
  - name: kubernetes-manifests
    worktree_setup: false
    remotes: []
  - name: gcp-run
    worktree_setup: false
    remotes: []
[!] /home/baptiste/work/customer/kubernetes-manifests: Could not detect remote type of "http://gitlab.local/devops/kubernetes-manifests.git". Reason: Remotes using HTTP protocol are not supported
[!] /home/baptiste/work/customer/gcp-run: Could not detect remote type of "http://gitlab.local/devops/gcp-run.git". Reason: Remotes using HTTP protocol are not supported
hakoerber commented 1 year ago

This looks good! Just one inline comment about the wording, but apart from that, it's ready to be merged.

I will link issue #28 here because this PR shows the limitations of me using String as the error type everywhere. In other projects, I started doing "proper" error handling using Error enums, which is much more ergonomic. It would also make the unit testing easier. You would not have to match against the exact String, but could just check against the enum variant. Turning the error into a user-facing string would happen as high on the stack as possible. </random stream of conciousness>

Anyway, thank you for your (second!) contribution!

(Same note about the CONTRIBUTORS file as in your other PR applies).

BapRx commented 1 year ago

Alright I updated the warning message and added my name to the CONTRIBUTORS :smile:

hakoerber commented 1 year ago

Merged, thanks for the contribution! :)