Cannot use lab in .wiki repo
Trying to use lab from within a cloned .wiki repo fails to find the gitlab project.
$ git clone <gitlab-host>:<...>/<...>/wiki.wiki
$ cd wiki.wiki/
$ lab issue ls
issue_list.go:38: gitlab project not found, verify you have access to the requested resource
$ lab version
git version 2.30.1
lab version 0.19.0.r46.g27f0557
Hey @Tcc100 -- could you point me to a wiki project that causes this to happen? I'm 100% sure there's a bug but just want to be able to reproduce so I can debug the problem a bit better :) TIA
Hi, I mostly work on a private server, but I found this one and it should be sufficient for a test:
https://gitlab.com/gnutls/gnutls.wiki.git
Thanks @Tcc100 . I just wanted to confirm that was the type of wiki you were looking at.
lab currently does not support editing of wiki pages. I'm not sure it's on anyone's list. It looks like the API supports wiki page actions, for example,
https://docs.gitlab.com/ee/api/wikis.html#list-wiki-pages
and go-gitlab also has support for wiki page actions.
The specific command you executed, 'lab issue list', would not work as it is an action against the project and not the wiki repo. Does that make sense?
Hi @prarit, thanks for looking into it.
In my understanding, a project consists of several parts, including the main repo, the issue list, and the wiki repo.
So, the action of listing issues should be the same whether it uses the main repo or the wiki repo as reference to find the project.
So, I am not sure what difference you would expect from using issue ls in a wiki repo than the main repo.
However, some projects do not contain a main repo to use lab from, so, you are left to the wiki repo only.
In fact, you can just use lab as usual by temporarily editing the git config -e of the wiki repo to point to the (possibly non-existent) main repo by removing the wiki part.
This is sufficient for lab to manage the issues.
Just to be clear (don't mind me if it's already clear): I edit the wiki pages by cloning the wiki repo, without lab (see the initial post). I only want to manage the issues with lab from that clone, not a clone of the main repo.
P.S.: You can even duplicate the url config to first point to the wiki repo and then to the main repo. This makes lab find the issues, git-fetch to fetch the wiki, and git-push to push to both (but one should be rejected). However, I'm not sure if this is documented anyhow, so I wouldn't advise this as a workaround.
[remote "origin"]
url = <gitlab-host>:<...>/<...>/wiki.wiki
url = <gitlab-host>:<...>/<...>/wiki
I wonder if it's just a matter of getting PathWithNamespace to be aware of the .wiki suffix and to find the project accordingly. If all it'll take is a TrimSuffix command, that's an easy tweak
https://github.com/zaquestion/lab/blob/master/internal/git/git.go#L204-L233
I agree with @zaquestion... You just have to be aware of the .wiki.git suffix and trim it