On 20/8/26 10:33, Wilko Meyer via Development of GNU Guix and the GNU System distribution. wrote:
My .git/config in my guix checkout has an additional
remote configured:

[remote "codeberg.org"]
        url = [email protected]:guix/guix.git
        fetch = +refs/pull/*/head:refs/remotes/codeberg.org/guix/guix/pulls/*
        skipFetchAll = true
         prune = true
[alias]
        pr = log --no-decorate --source --remotes=codeberg.org* --oneline

Thank you, that is very useful!

A possible improvement: many team branches are long-lived before they get a pull request, and it is good to check those too. I'm now using this command:

git log --no-decorate --source --remotes=* --oneline

E.g.:

git log --no-decorate --source --remotes=* --oneline --grep=git-spice

currently shows

e4d6cbe23ca     origin/go-team gnu: git-spice: Update to 0.31.2.
e780df642ce codeberg.org/guix/guix/pulls/9360 gnu: git-spice: Use git-minimal/pinned. b1e7a24a8a4 codeberg.org/guix/guix/pulls/6741 gnu: git-spice: Use git-minimal/pinned. af566bc06c2 codeberg.org/guix/guix/pulls/3134 gnu: git-spice: Update to 0.23.0. 0f3094d226e codeberg.org/guix/guix/pulls/4223 gnu: git-spice: Update to 0.15.2.

where your original command would not show the go-team commit.

The 'pr' alias is then perhaps a bit misplaced, but I re-used it anyway. Note that `--all` would also work in place of `--remotes="*"` but that breaks your nice URL's.

Oh! That output is kinda broken! See those two 'Use git-minimal/pinned' commits. The second commit listed (oldest) is attributed to the correct P.R. (6741). However, the other one is the (newer) manual merge commit to master, which is incorrectly associated to a completely irrelevant P.R. (9360).

I guess technically that second commit on master is indeed also in the branch corresponding to that other P.R., so it is not 'wrong' per se, but that is not particularly useful information. Oh well, I suppose the command still serves the purpose discussed here.

it's awfully hacky but it allows me to quickly search for PRs containing
a specific package (the naming of the remote and refspec is intentional,
as it doubles as URL to the corresponding PR) and also works offline.

The only hacky part is perhaps the name of the remote, but otherwise this is exactly one of the benefits of using git / a forge.

Hugo


Reply via email to