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

Get specific project from forge? #62

Open theherk opened 1 year ago

theherk commented 1 year ago

Say I have a working configuration like:

provider = "gitlab"
api_url = "https://gitlab.private"
token_command = "security find-generic-password -w -s gitlab.private -a theherk"
root = "."

[filters]
owner = true
groups = [
  "foo",
]

This gets all the projects from group foo, but what if I want to get a specific project from bar? For example, this doesn't work:

provider = "gitlab"
api_url = "https://gitlab.private"
token_command = "security find-generic-password -w -s gitlab.private -a theherk"
root = "."

[filters]
owner = true
groups = [
  "foo",
]

[[trees]]
root = "./bar"

[[trees.repos]]
name = "bar"
worktree_setup = false

[[trees.repos.remotes]]
name = "origin"
url = "ssh://git@gitlab.private/bar/baz.git"
type = "ssh"

It yields expected struct ConfigProvider.

hakoerber commented 1 year ago

Yeah, you currently cannot use both a tree configuration (which specifies the repos explicitly) and a forge integration at the same time.

To understand your use case: You want to get all projects from group foo, but only the project baz from the group bar, correct?

This is currently not possible with the forge integration. Take a look at the available filters here. There is simply no filter to look for a single project. I guess that if you know that there is a certain project in the forge, it's simpler to use an explicit tree configuration (as you did).

I think that the proper way to handle that would be to allow both a forge and a tree config in the same configuration file (the way you did). I'm sure there are going to be a few edge cases regarding conflicts that need to be handled, but I don't see why it should not be possible.

I will leave this issue open as a tracking issue for allowing both trees and forges in the same config, but I will not get around to implementing this in the near future. If you want, feel free to give it a shot. We can also discuss the implementation & approach beforehand in this issue.

theherk commented 1 year ago

Makes sense, and sounds good. You have my use case understood. If the time arises, I may take a swing at it, but time is hard to come by. Thank you for the response. Will follow up when the time comes if guidance is needed.