stalecontext/forgejo-cli-plus
2
4
Fork
You've already forked forgejo-cli-plus
1

pr create crashes when branch has no tracking remote #46

Closed
opened 2026年03月31日 02:17:48 +02:00 by stalecontext · 0 comments

Bug

fj pr create crashes with a git2 config error when the current branch does not have a tracking remote configured, even when repo detection succeeds via other means (e.g., the origin fallback from #44).

Error

Error: config value 'branch.<name>.remote' was not found; class=Config (7); code=NotFound (-3)
Location:
 src\prs.rs:941:31

Steps to reproduce

git checkout -b new-branch # no upstream tracking
git push origin new-branch # push without -u (or -u fails to set tracking)
fj pr create "Title" --base main
# Error: config value 'branch.new-branch.remote' was not found

Expected behavior

fj pr create should fall back to the resolved remote from RepoInfo::get_current() (or to origin) when the branch has no tracking remote, rather than crashing.

Workaround

Set tracking manually before creating the PR:

git branch --set-upstream-to=origin/new-branch
fj pr create "Title" --base main

Location

src/prs.rs:941 -- reads branch.<name>.remote from git config without handling the not-found case.

## Bug `fj pr create` crashes with a git2 config error when the current branch does not have a tracking remote configured, even when repo detection succeeds via other means (e.g., the origin fallback from #44). ### Error ``` Error: config value 'branch.<name>.remote' was not found; class=Config (7); code=NotFound (-3) Location: src\prs.rs:941:31 ``` ### Steps to reproduce ```sh git checkout -b new-branch # no upstream tracking git push origin new-branch # push without -u (or -u fails to set tracking) fj pr create "Title" --base main # Error: config value 'branch.new-branch.remote' was not found ``` ### Expected behavior `fj pr create` should fall back to the resolved remote from `RepoInfo::get_current()` (or to `origin`) when the branch has no tracking remote, rather than crashing. ### Workaround Set tracking manually before creating the PR: ```sh git branch --set-upstream-to=origin/new-branch fj pr create "Title" --base main ``` ### Location `src/prs.rs:941` -- reads `branch.<name>.remote` from git config without handling the not-found case.
Sign in to join this conversation.
No Branch/Tag specified
main
feature/issue-batch-2026-07
upstream-sync/2026-07-02
feat/repo-create-org
projects
v2.0.0
upstream-reviewed/2026-07-02
v1.1.0
upstream-reviewed/2026-03-31
v1.0.0
upstream-reviewed/2026-03-16
v0.4.0
v0.3.0
v0.2.0
v0.1.1
v0.1.0
v0.0.4
v0.0.3
v0.0.2
v0.0.1
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
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
stalecontext/forgejo-cli-plus#46
Reference in a new issue
stalecontext/forgejo-cli-plus
No description provided.
Delete branch "%!s()"

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?