Skip to content

git: reject remote names invalid in fetch refspecs#9334

Closed
lawrence3699 wants to merge 1 commit into
jj-vcs:mainfrom
lawrence3699:fix/reject-invalid-remote-names
Closed

git: reject remote names invalid in fetch refspecs#9334
lawrence3699 wants to merge 1 commit into
jj-vcs:mainfrom
lawrence3699:fix/reject-invalid-remote-names

Conversation

@lawrence3699
Copy link
Copy Markdown

Fixes #9099

jj git remote add currently panics if the symbolic remote name can't be used in the generated fetch refspec.
For example, jj git remote add 'this also fails' https://github.com/jj-vcs/jj.git aborts with ReferenceName(InvalidByte { byte: " " }) instead of returning a user-facing error.

This validates symbolic remote names with gix::remote::name::validated() before writing the remote config, so invalid names fail cleanly instead of panicking.
I also added CLI coverage for empty, whitespace-containing, and whitespace-only remote names.

Validation:

  • cargo test -q -p jj-cli --test runner test_git_remote

Checklist

If applicable:

  • [n/a] I have updated CHANGELOG.md
  • [n/a] I have updated the documentation (README.md, docs/, demos/)
  • [n/a] I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes
  • I fully understand the code that I am submitting (what it does,
    how it works, how it's organized), including any code drafted by an LLM.
  • For any prose generated by an LLM, I have proof-read and copy-edited with
    an eye towards deleting anything that is irrelevant, clarifying anything
    that is confusing, and adding details that are relevant. This includes,
    for example, commit descriptions, PR descriptions, and code comments.

@lawrence3699 lawrence3699 requested a review from a team as a code owner April 19, 2026 12:17
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 19, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@PhilipMetzger
Copy link
Copy Markdown
Contributor

Can you please move the PR description into the commit message to adhere to our style, thanks.

@yuja
Copy link
Copy Markdown
Contributor

yuja commented Apr 20, 2026

Dup of #9155?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Remote name with whitespace causes a panic

3 participants