test(git-mr): cover Forgejo/Codeberg URLs, regenerate man docs

Add a bats test that exercises the pulls URL branch via a local
insteadOf remote rewrite (no real HTTP endpoint needed), and bring
git-mr.1/git-mr.html in line with the git-mr.md changes.
This commit is contained in:
vjymisal0 2026-08-24 18:00:14 +05:30
parent 8cd8741a3f
commit 6d65f6ba9a
No known key found for this signature in database
GPG key ID: 19904AA4CFDB27F9
3 changed files with 48 additions and 2 deletions

View file

@ -28,7 +28,7 @@ The name of the remote to fetch from\. Defaults to \fBorigin\fR\.
<url>
.
.P
GitLab merge request URL in the format \fBhttps://gitlab\.tld/owner/repository/merge_requests/453\fR\.
GitLab merge request URL in the format \fBhttps://gitlab\.tld/owner/repository/merge_requests/453\fR, or a Forgejo/Codeberg pull request URL in the format \fBhttps://codeberg\.tld/owner/repository/pulls/453\fR\.
.
.SH "EXAMPLES"
This checks out merge request \fB!51\fR from remote \fBorigin\fR to branch \fBmr/51\fR\.
@ -46,6 +46,22 @@ Switched to branch \'mr/51\'
.
.IP "" 0
.
.P
This checks out pull request \fB#51\fR from a Forgejo/Codeberg URL to branch \fBmr/51\fR\.
.
.IP "" 4
.
.nf
$ git mr https://codeberg\.org/owner/repository/pulls/51
From codeberg\.org:owner/repository
* [new ref] refs/pull/51/head \-> mr/51
Switched to branch \'mr/51\'
.
.fi
.
.IP "" 0
.
.SH "AUTHOR"
Written by Étienne BERSAC \fIbersace03@gmail\.com\fR from git\-pr(1)\.
.

View file

@ -94,7 +94,9 @@
<p> &lt;url&gt;</p>
<p> GitLab merge request URL in the format
<code>https://gitlab.tld/owner/repository/merge_requests/453</code>.</p>
<code>https://gitlab.tld/owner/repository/merge_requests/453</code>, or a
Forgejo/Codeberg pull request URL in the format
<code>https://codeberg.tld/owner/repository/pulls/453</code>.</p>
<h2 id="EXAMPLES">EXAMPLES</h2>
@ -106,6 +108,14 @@ From gitlab.com:owner/repository
Switched to branch 'mr/51'
</code></pre>
<p>This checks out pull request <code>#51</code> from a Forgejo/Codeberg URL to branch <code>mr/51</code>.</p>
<pre><code>$ git mr https://codeberg.org/owner/repository/pulls/51
From codeberg.org:owner/repository
* [new ref] refs/pull/51/head -&gt; mr/51
Switched to branch 'mr/51'
</code></pre>
<h2 id="AUTHOR">AUTHOR</h2>
<p>Written by Étienne BERSAC <a href="&#109;&#x61;&#x69;&#x6c;&#116;&#x6f;&#58;&#x62;&#101;&#x72;&#115;&#97;&#x63;&#101;&#48;&#x33;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#x2e;&#99;&#x6f;&#109;" data-bare-link="true">&#x62;&#101;&#114;&#115;&#x61;&#x63;&#101;&#48;&#51;&#64;&#x67;&#109;&#97;&#x69;&#x6c;&#46;&#x63;&#111;&#109;</a> from <a class="man-ref" href="git-pr.html">git-pr<span class="s">(1)</span></a>.</p>

View file

@ -46,3 +46,23 @@ setup() {
run git rev-parse --abbrev-ref HEAD
assert_output 'mr/51'
}
@test "checks out a Forgejo/Codeberg pull request by URL" {
# git-mr only recognizes http(s) URLs, so rewrite the fake Codeberg URL
# to our local bare "remote" via insteadOf rather than needing a real
# HTTP(S) endpoint.
git config --local url."$remote_dir".insteadOf "https://codeberg.org/owner/repository.git"
run git mr "https://codeberg.org/owner/repository/pulls/51"
assert_success
assert_output --partial "refs/pull/51/head"
run git rev-parse --abbrev-ref HEAD
assert_output 'mr/51'
run git config --get branch.mr/51.merge
assert_output 'refs/pull/51/head'
run git config --get branch.mr/51.remote
assert_output 'https://codeberg.org/owner/repository.git'
}