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
62 stars 9 forks source link

Add a debug/verbose flag to print paths during discovery #52

Closed BapRx closed 7 months ago

BapRx commented 1 year ago

That'd would be helpful to identify what path triggers an error before a panic happens, a debug println!("{path}") could be added here https://github.com/hakoerber/git-repo-manager/blob/9b4ed2837eca5b9775983aff8871cab31aea7065/src/lib.rs#L27-L28

I needed this because of these lines: https://github.com/hakoerber/git-repo-manager/blob/9b4ed2837eca5b9775983aff8871cab31aea7065/src/repo.rs#L490-L495

Another option would be to return an error and handle it correctly in this block https://github.com/hakoerber/git-repo-manager/blob/9b4ed2837eca5b9775983aff8871cab31aea7065/src/lib.rs#L65-L75

hakoerber commented 1 year ago

If I understand you correctly, you are getting a panic because you're using a git:// or http:// URL, but it's not obvious which repo/remote caused the error because there is no output of its name?

I'd prefer your second approach (having repo::detect_remote_type() return a proper Result and handling the error code on the call site). The unimplemented!() part was just a quick hack during initial development. So the concrete TODOs would be:

What do you think? Feel free to open a PR with the changes.

BapRx commented 1 year ago

That's exactly what I had was looking for, I'll try to open a PR when I have the time. Thanks for the TODO :slightly_smiling_face: