Skip to content

completion: no directory completion for repository URLs, fixes #10460 - #10472

Open
ThomasWaldmann wants to merge 1 commit into
borgbackup:masterfrom
ThomasWaldmann:completion-repo-url-10460
Open

ThomasWaldmann wants to merge 1 commit into
borgbackup:masterfrom
ThomasWaldmann:completion-repo-url-10460

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Fixes #10460.

-r/--repo and --other-repo completed local directories even when the value already started with a URL scheme:

  • fish: borg repo-create --repo=ssh://<TAB> offered ssh://etc/, ssh://usr/, ... and --repo rclone:<TAB> offered rclone:bin/, ... (fish completes the part after the : as a path).
  • tcsh: attempted directory completion and printed ssh:// not found.
  • bash and zsh showed no candidates, but only because the typed text did not literally match a directory name.

Now, once the value starts with a URL scheme other than file: (the ones Location parses as a URL: ssh, sftp, http, https, s3, b2, rclone), there is no completion in any shell. Local paths (and file:// in fish) still complete directories as before.

  • bash, zsh, fish: new _borg_complete_repo_dirs helper: nothing for a URL, else the previous directory completion (fish also handles the attached -rURL form).
  • tcsh: can not make a rule depend on the current word, so a leading rule 'c/{--repo=,-r=,--other-repo=,}{ssh,sftp,...}:/n/' completes nothing for a URL; tcsh uses the first matching rule, so it wins over the directory rules. Side effect: any word starting with such a scheme gets no completion in tcsh.

Tested interactively in all four shells, plus new regression tests per shell (they fail without the fix).

Not included: completing hostnames from /etc/hosts / ~/.ssh/config for ssh:// (could be a follow-up).

🤖 Generated with Claude Code

…ckup#10460

-r/--repo and --other-repo completed local directories even when the value
already started with a URL scheme like ssh:// or rclone:. In fish, this
offered e.g. "ssh://etc/" (fish completes the part after the ":" as a path),
tcsh printed "ssh:// not found".

Now, a URL scheme other than file: (the ones Location parses as a URL) gets
no completion in any shell, while local paths still complete directories:

- bash, zsh, fish: new _borg_complete_repo_dirs helper
- tcsh: a leading completion rule completing nothing for a URL, it is used
  before the directory rules of the repository options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.73%. Comparing base (b03b096) to head (fd71c9e).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10472      +/-   ##
==========================================
+ Coverage   88.71%   88.73%   +0.01%     
==========================================
  Files         103      103              
  Lines       19392    19399       +7     
  Branches     3024     3025       +1     
==========================================
+ Hits        17204    17214      +10     
+ Misses       1518     1515       -3     
  Partials      670      670              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

This branch has not been deployed

No deployments
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.

fish shell completions tests (thread)

1 participant