mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
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:
parent
8cd8741a3f
commit
6d65f6ba9a
18
man/git-mr.1
18
man/git-mr.1
|
|
@ -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)\.
|
||||
.
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@
|
|||
<p> <url></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 -> mr/51
|
||||
Switched to branch 'mr/51'
|
||||
</code></pre>
|
||||
|
||||
<h2 id="AUTHOR">AUTHOR</h2>
|
||||
|
||||
<p>Written by Étienne BERSAC <a href="mailto:bersace03@gmail.com" data-bare-link="true">bersace03@gmail.com</a> from <a class="man-ref" href="git-pr.html">git-pr<span class="s">(1)</span></a>.</p>
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue