Back to Codeberg

fix(checkout): don't include port in refspec #510

forgejo-contrib-forgejo-cli-pulls-510.md

latest17.6 KB
Original Source

forgejo-contrib/forgejo-cli

Watch20

Star402

Fork

You've already forked forgejo-cli

51

CodeIssues 44Pull requests 8Releases 11Packages 2WikiActivity

fix(checkout): don't include port in refspec #510

Merged

Cyborusmerged 1 commit from no-port-in-refspec into main 2026-06-22 21:46:10 +02:00

Conversation 4Commits 1Files changed 1 +4 -10

Cyborus commented 2026-06-20 17:28:53 +02:00

Member

Copy link

Changes Made

The : character in the URL that marks the port is disallowed in git refspecs, so trying to checkout a PR on a non-default port would fail.

This fixes that by only using the host of the URL, excluding the port.

Closes #483

Code of Conduct

  • I agree to act in accordance with the CoC & AI Agreement.
  • This contribution was not generated by an LLM, even in part.

Changes Made The : character in the URL that marks the port is disallowed in git refspecs, so trying to checkout a PR on a non-default port would fail. This fixes that by only using the host of the URL, excluding the port. Closes #483 ### Code of Conduct - [x] I agree to act in accordance with the CoC & AI Agreement. - [x] This contribution was not generated by an LLM, even in part.

Cyborus added 4 commits 2026-06-20 17:29:00 +02:00

docs: outline of CONTRIBUTING.md adcd583f36

docs(contributing): add greeting 2f2a7823f0

docs(contributing): add CoC section 8b85c56a3f

fix(checkout): don't include port in refspec...

Some checks are pending

ci/woodpecker/pr/check-clippy Pipeline is pending

Details

ci/woodpecker/pr/check-typos Pipeline is pending

Details

ci/woodpecker/pr/check Pipeline is pending

Details

bfd1e12d5a

The `:` character in the URL that marks the port is
disallowed in git refspecs, so trying to checkout
a PR on a non-default port would fail.

Cyborus force-pushed no-port-in-refspec from bfd1e12d5a

Some checks are pending

ci/woodpecker/pr/check-clippy Pipeline is pending

Details

ci/woodpecker/pr/check-typos Pipeline is pending

Details

ci/woodpecker/pr/check Pipeline is pending

Details

to d0a3c0d879

Some checks failed

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline failed

Details

2026-06-20 17:30:08 +02:00 Compare

LordMZTE reviewed 2026-06-22 09:13:32 +02:00

src/prs.rs Outdated

Show resolved Hide resolved

| | | | @ -1510,4 +1511,3 @@ | | | | | | let branch_name = branch_name.unwrap_or_else(|| { | | | | | | format!( | | | | | | "pr-{}-{}-{}", | | | | | | crate::repo_url_host_name(url), |

LordMZTE commented 2026-06-22 09:13:32 +02:00

Collaborator

Copy link

Is there any reason we're keeping this function around? Guessing by the name, it'd be easiert to use url.host_str() wherever it's used. It only seems to be referenced in a couple other places and what exactly it does also seems quite unclear, looking at the code.

Is there any reason we're keeping this function around? Guessing by the name, it'd be easiert to use url.host_str() wherever it's used. It only seems to be referenced in a couple other places and what exactly it does also seems quite unclear, looking at the code.

Fluffinity commented 2026-06-22 15:46:28 +02:00

Contributor

Copy link

Took a look at it and this function gets used only 4 times in the entire codebase. All 4 calls are in src/prs.rs and the function itself really is nothing more than a manual implementation of the host_str() method. That one can go for sure.

Took a look at it and this function gets used only 4 times in the entire codebase. All 4 calls are in src/prs.rs and the function itself really is nothing more than a manual implementation of the host_str() method. That one can go for sure.

Cyborus commented 2026-06-22 16:15:51 +02:00

Author

Member

Copy link

It is subtly different to host_str, as it works on Forgejo instances hosted on a sub-path. i.e. for https://example.com/forgejo/org/repo, it will return example.com/forgejo

It is subtly different to host_str, as it works on Forgejo instances hosted on a sub-path. i.e. for https://example.com/forgejo/org/repo, it will return example.com/forgejo

👍 2

LordMZTE commented 2026-06-22 21:24:16 +02:00

Collaborator

Copy link

I see. That definitely needs to be documented, as the intent was completely unclear to me.

I see. That definitely needs to be documented, as the intent was completely unclear to me.

Cyborus commented 2026-06-22 21:45:39 +02:00

Author

Member

Copy link

Agreed

Agreed

LordMZTE marked this conversation as resolved

Fluffinity commented 2026-06-22 16:10:16 +02:00

Contributor

Copy link

Why do we have commits concerning contributor documentation in this PR? These 3 commits should be rebased out of this branch and form their own PR

Why do we have commits concerning contributor documentation in this PR? These 3 commits should be rebased out of this branch and form their own PR

Cyborus force-pushed no-port-in-refspec from d0a3c0d879

Some checks failed

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline failed

Details

to 770b938cd5

Some checks failed

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline failed

Details

2026-06-22 16:13:28 +02:00 Compare

Cyborus commented 2026-06-22 16:17:23 +02:00

Author

Member

Copy link

@Fluffinity wrote in #510 (comment):

Why do we have commits concerning contributor documentation in this PR?

Dang it, I thought I had fixed that. I had been working on that immediately before doing this and accidentally created this branch based off that instead of main.

@Fluffinity wrote in https://codeberg.org/forgejo-contrib/forgejo-cli/pulls/510#issuecomment-17888888: > Why do we have commits concerning contributor documentation in this PR? Dang it, I thought I had fixed that. I had been working on that immediately before doing this and accidentally created this branch based off that instead of main.

Cyborus force-pushed no-port-in-refspec from 770b938cd5

Some checks failed

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline failed

Details

to 279af486b2

All checks were successful

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

2026-06-22 16:19:06 +02:00 Compare

LordMZTE approved these changes 2026-06-22 21:32:17 +02:00

Cyborus merged commit f38a7cf3b0 into main 2026-06-22 21:46:10 +02:00

Cyborus referenced this pull request from a commit 2026-06-22 22:13:17 +02:00 Merge pull request 'fix(checkout): don't include port in refspec' (#510) from no-port-in-refspec into main

stalecontext referenced this pull request from stalecontext/forgejo-cli-plus 2026-07-02 21:51:40 +02:00 Upstream sync 2026-07-02 #52

Sign in to join this conversation.

Reviewers

No reviewers

LordMZTE

Labels

Clear labels[ Kind/Breaking Breaking change that won't be backward compatible

](#)[ Kind/Bug Something is not working

](#)[ Kind/Design Discussion about UI/UX design

](#)[ Kind/Documentation Documentation changes

](#)[ Kind/Enhancement Improve existing functionality

](#)[ Kind/Feature New functionality

](#)[ Kind/Security This is security issue

](#)[ Kind/Testing Issue or pull request related to testing

](#)[ Kind/Upstream This is an issue with upstream software (Forgejo) that is probably not our fault

](#)

[ Priority

Critical The priority is critical

](#)[ Priority

High The priority is high

](#)[ Priority

Low The priority is low

](#)[ Priority

Medium The priority is medium

](#)

[ Reviewed

Confirmed Issue has been confirmed

](#)[ Reviewed

Duplicate This issue or pull request already exists

](#)[ Reviewed

Invalid Invalid issue

](#)[ Reviewed

Won't Fix This issue won't be fixed

](#)

[ Status

Abandoned Somebody has started to work on this but abandoned work

](#)[ Status

Blocked Something is blocking this issue or pull request

](#)[ Status

Need More Info Feedback is required to reproduce issue or to continue work

](#)

[ Suspicious

](#)

No labels Kind/Breaking Kind/Bug Kind/Design Kind/Documentation Kind/Enhancement Kind/Feature Kind/Security Kind/Testing Kind/Upstream [ Priority

Critical ](/forgejo-contrib/forgejo-cli/pulls?labels=173012) [ Priority

High ](/forgejo-contrib/forgejo-cli/pulls?labels=173013) [ Priority

Low ](/forgejo-contrib/forgejo-cli/pulls?labels=173015) [ Priority

Medium ](/forgejo-contrib/forgejo-cli/pulls?labels=173014) [ Reviewed

Confirmed ](/forgejo-contrib/forgejo-cli/pulls?labels=173007) [ Reviewed

Duplicate ](/forgejo-contrib/forgejo-cli/pulls?labels=173005) [ Reviewed

Invalid ](/forgejo-contrib/forgejo-cli/pulls?labels=173006) [ Reviewed

Won't Fix ](/forgejo-contrib/forgejo-cli/pulls?labels=173008) [ Status

Abandoned ](/forgejo-contrib/forgejo-cli/pulls?labels=173011) [ Status

Blocked ](/forgejo-contrib/forgejo-cli/pulls?labels=173010) [ Status

Need More Info ](/forgejo-contrib/forgejo-cli/pulls?labels=173009) Suspicious

Milestone

Clear milestone

No items

No milestone

Projects

Clear projects

No items

No project

Assignees

Clear assignees

No assignees

3 participants

Notifications Subscribe

Due date

The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference

forgejo-contrib/forgejo-cli!510

WritePreview

Loading…

Add table

| Rows | | | Columns | |

CancelOK

Add a link

Url Description Hint: With a URL in your clipboard, you can paste directly into the editor to create a link.

CancelOK

CancelSave

Reference in a new issue

Repository

forgejo-contrib/forgejo-cli

Title

Body

Create issue

No description provided.

Delete branch "no-port-in-refspec"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?

No Yes