22900 Commits

Author SHA1 Message Date
Peter Ammon
821efeb99c Justify the continued presence of cwd_fd 2026-05-25 22:25:30 -07:00
Peter Ammon
960b96750a Revert "parser: remove unused cwd_fd field"
cwd_fd is crucial to maintain: long-term vision for fish is multiple
threads each with their own CWD with the process-wide CWD used for
nothing at all except transiently (e.g. during fork).

Note this fd is heightenized per open_dir.

This reverts commit 6701b7f6c8.
2026-05-25 22:25:23 -07:00
Henrik Hørlück Berg
79bf53aaa5 Fix Principal topic monitor not initialized panic
Like 1b16d318cc, reproduces with `cargo test test_pthread`

Fix by using stdlib `println!` to avoid interacting with topicMonitor.

Enable `allow-print-in-tests` like with crates/printf, such that there i
no deny-warning.
2026-05-25 18:34:04 -07:00
Henrik Hørlück Berg
8dee291200 Fix threads::init() was not called at startup!
Happens when running `cargo nextest run test_replace_home_directory_with_tilde`, due to process-isolation model.

Backtrace shows:
    EnvStack::set_one(HOME)
    EnvStack::set
    env_dispatch_var_change
    reader_current_data
    reader_data_stack
    assert_is_main_thread
    is_main_thread
    main_thread_id

Fix by using TestEnvironment instead, as this is a unit-test and does
not need anything more.
2026-05-25 18:34:04 -07:00
Henrik Hørlück Berg
8513bb8dc4 Fix Principal topic monitor not initialized
in `test_path_normalize_for_cd`

This happens when running the tests using `cargo nextest run`, where
each test runs in its own process, but does not happen with normal
`cargo test`.

Fix by avoiding eprintf!, which can reach SigChecker::check. Instead use a custom panic-message.
2026-05-25 18:34:04 -07:00
Peter Ammon
17fdd2f153 Clean up "strip control characters" changes
Simplify these and move the sanitization closer to the point of output.

Stop worrying about control characters beyond what PCRE2 reports in
"[[:cntrl:]]" for clarity.
2026-05-25 16:48:30 -07:00
saku0512
cbc3cd21f7 prompts: strip control characters from VCS state and PWD
Strip control characters from VCS branch and state strings before writing them in prompts.

Also route the informative and minimalist sample prompts through prompt_pwd instead of printing PWD directly.
2026-05-25 15:51:41 -07:00
Harry Garrood
7ddc8ee195 git completion: only suggest files/directories with --no-index
Fixes #12773.

Closes #12776
2026-05-24 18:59:08 +08:00
Jonas Natten
0a2879440a completions/terraform: add missing subcommands
Compared against "terraform -help" from v1.15.4.  The completion was
missing the following top-level subcommands:

	force-unlock  Release a stuck lock on the current workspace
	metadata      Metadata related commands
	modules       Show all declared modules in a working directory
	query         Search and list remote infrastructure with Terraform
	stacks        Manage HCP Terraform stack operations

Also add the global "-chdir" option, which switches the working
directory before running the subcommand, and teach
"__fish_terraform_needs_command" to skip past it so subcommands are
still offered after e.g. "terraform -chdir=foo".

While at it, fix two unrelated bugs:

* The "refresh" section conditioned "-compact-warnings" on "$apply"
  instead of "refresh", so it was only offered for apply/destroy
  (where it's already covered).

* The "show" section had a stray "validate -json" completion (a copy
  of the entry in the validate section).  Replace it with the
  actually-missing "show -json".

Closes #12771
2026-05-24 18:56:54 +08:00
Johannes Altmanninger
07b552aa78 Delete unused en.po
Commit 4bdd35b8d1 (feat: stop language fallback at English, 2026-05-11)
rendered en.po unused.  Delete it.

In future, we should replace most single quotes in msgids with
backticks, since Markdown is very popular nowadays.

Closes #12745
2026-05-24 18:11:04 +08:00
Peter Ammon
8067a5c2c8 Fix some clipplies 2026-05-23 18:45:02 -07:00
Peter Ammon
a2bfd93451 Re-apply test_only_suppress_stderr
Fix some obnoxious output during certain tests.
2026-05-23 18:21:07 -07:00
Peter Ammon
068fa42202 Reimplement test_only_suppress_stderr
This parameter is used to suppress certain verbose errors that are
expected during tests. It was awkwardly threaded through multiple call
sites. Just set it (test only) on Parser.
2026-05-23 18:13:16 -07:00
Nahor
ffaa07d687 Fix unused import warning on non-Linux platforms 2026-05-23 12:04:41 -07:00
Johannes Altmanninger
4ad3c48e3f Fix "cargo doc" error 2026-05-23 16:34:16 +08:00
Johannes Altmanninger
19e0c8b6b9 signal: remove duplicate definition of SIGIOT 2026-05-23 10:31:18 +08:00
Johannes Altmanninger
0f81bb0748 signal: extract function for querying SIGHUP disposition 2026-05-23 10:15:37 +08:00
Johannes Altmanninger
cd75d3d3ca proc: remove obsolete NixSignal alias
See parent commit.
2026-05-23 10:14:09 +08:00
Johannes Altmanninger
8250507a0f Rename Signal to RawSignal to make way for nix Signal 2026-05-23 09:24:21 +08:00
Johannes Altmanninger
2c6b76d5fe Remove redundant uses of std::mem::zeroed()
We already use "inode: 0". 

See 7c2c7f5874 (Use uninit instead of zeroed, 2025-05-19).

Part of #12337
2026-05-23 09:24:21 +08:00
xtqqczze
78633cab0f format: reformat TOML files
Format using Tombi with the schema at https://www.schemastore.org/cargo.json.
Some ordering in Cargo.toml is left for later.

Closes #12702
2026-05-23 01:00:27 +08:00
Nahor
954c68c0b1 Fix comment typo (CLO_EXEC -> CLOEXEC)
Closes #12774
2026-05-23 00:59:56 +08:00
Nahor
01b848bbbb Fix formatting of tokenizer.rs
Remove a couple of unhelpful comments that stopped rustfmt for working
(https://github.com/rust-lang/rustfmt/issues/4119)

Part of #12774
2026-05-23 00:59:56 +08:00
Johannes Altmanninger
b6f8a7bf4a Changelog: mention that redundant /usr/share/fish is gone 2026-05-21 12:50:14 +08:00
sorgel
bf59785377 completion: fix du to support both GNU and BSD
The current file has no platform detection, causing GNU-only completions
on macOS/BSD. It also has a factual error: -H is described as "Human
readable sizes, powers of 1000", but -H actually follows command-line
symlinks.

Rewritten using __fish_gnu_complete and GNU detection, following
the same pattern as sed.fish. Platform-specific flags added.

Closes #12767
2026-05-20 18:40:12 +08:00
Drazape
4c30c9ec2d (refactor) default mode prompt: multiple test equality checks → contains
While at it, use early return.

Closes #12766
2026-05-20 18:40:01 +08:00
Johannes Altmanninger
684d360ece completions/cargo: remove xtask completions for now
We source "COMPLETE=fish cargo xtask" at completion load time.

This means that completions will be missing if completions were requested 
before entering a fish-shell worktree.

Also, as reported in [1], this will compile xtask even for non-fish
projects, which is usually fast but not necessarily (it might download
crates etc).

As suggested in the initial revision of #12763, we could
hardcode the output of

	$ COMPLETE=fish cargo xtask
	complete --keep-order --exclusive --command cargo --arguments \
		"(COMPLETE=fish /home/johannes/git/fish-shell/target/debug/xtask --
			(commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"

but that might still be too intrusive because according to [2],
calls to "cargo metadata" can be slow on big repos with hundreds of
Cargo.toml files.

[1]: 959cbb4259 (r185615416)
[2]: 959cbb4259 (r185637424)

FWIW, commit comments are also accessible via

	gh api -H "X-GitHub-Api-Version: 2026-03-10" \
	    /repos/fish-shell/fish-shell/commits/959cbb42597444577d26ed5ba6151ccb1d7f3600/comments
2026-05-19 13:38:51 +08:00
Johannes Altmanninger
30b9cababa completions/cargo: fix spurious error message if jq is not installed
Reported in 959cbb4259 (r185615058)
2026-05-18 16:22:13 +08:00
Johannes Altmanninger
29182dae54 completions/cargo: don't implicitly install cargo via rustup
Set RUSTUP_AUTO_INSTALL=0 for completions, to be consistent with
88d01f7eb8 (completions/cargo: avoid auto-installing toolchain via
rustup, 2026-03-27).
2026-05-18 16:20:40 +08:00
Johannes Altmanninger
f598a7b444 completions/cargo: remove redundant arguments 2026-05-18 16:20:40 +08:00
Johannes Altmanninger
5d317be52c completions/cargo: fix error completing "cargo asm"
"timeout __fish_cargo" doesn't work because "__fish_cargo" is a
fish function.  Work around this.
2026-05-18 16:20:39 +08:00
Johannes Altmanninger
e59a61e5e6 share/config.fish: lazy-load __fish_expand_pid_args
This is only needed when invoking fg/bg/disown/kill.
Trims down share/config.fish a bit more.
2026-05-18 16:20:39 +08:00
Johannes Altmanninger
1284527fac Path component movement to skip all escaped characters
Extend the hack added in ebc140a3ea (Hack path component movement to
skip escaped spaces, 2025-12-16) to apply to all characters, such as
";" that may be part of a file name.
2026-05-18 16:18:52 +08:00
Johannes Altmanninger
ec52a999b3 Use ST (\x1b\\) as OSC terminator
The test balloon in 012007ce7b (Test balloon for ST OSC terminator,
2025-11-18) released in 4.3.0 did not trigger problem reports.
Bravely switch over to the standard ST rather than xterm's BEL.

Closes #12032
2026-05-18 16:18:52 +08:00
David Adam
afd869be2a README: update Actions status badge URL 2026-05-18 06:12:12 +08:00
Johannes Altmanninger
d72e323a6f Replace occasional uses of EN DASH (U+2013) with ASCII HYPHEN MINUS
See #12745
2026-05-14 16:38:08 +08:00
Johannes Altmanninger
d383733747 doc terminal-compatibility: don't call out informative Git prompt's arrows
The up/down arrows (as well as lots of other non-ASCII characters) are
printed by the informative Git prompt, which is not eabled by default.
2026-05-14 16:35:31 +08:00
Johannes Altmanninger
1f18b9715f Fix repeated tab causing repeated smartcase completion insertion
Doing

	firefox --pro TAB TAB TAB

results in

	firefox --profile --ProfileManager

git-bisect points to 3546ffa3ef (reader
handle_completions(): remove dead filtering code, 2026-01-02)
but that regression has already been fixed by 85e76ba356
(Fix option substr completions not being filtered out, 2026-04-16).

However in between those two commits, the above case has also been
broken by 2f6b1eaaf9 (reader handle_completions(): don't consider
odd replacing completions for common prefix, 2026-01-02)

The first TAB inserts "--profile ", including the trailing space.
However it also shows the completion pager, which means that subsequent
TABs will insert after the space.

The trailing space does not make sense unless we navigate the pager.
Remove it in all cases, to fix this smartcase scenario.

Alternatively, we could start navigating the pager in this case
(and keep the trailing space), but that's probably too inconsistent.
2026-05-14 16:17:41 +08:00
Johannes Altmanninger
5876ff66ff fish_git_prompt: fix buggy rename parsing
Commit f86c9af455 (fish_git_prompt: skip rename/copy source paths in
status parsing, 2026-05-12).  filters from "git-status --porcelain"
output all lines that don't look like a status entry.  This is
to filter out the rename source path.  But the filtering has false
positives, e.g. if a rename source path starts with "AA".  Let's only
skip lines immediately after each rename entry.  Also for copy (C)
though I haven't found a test case for that yet.
2026-05-14 14:25:21 +08:00
Johannes Altmanninger
ee4eea51ec fish_git_prompt: extract function 2026-05-14 14:25:21 +08:00
Hans Larsen
a3984ace4a Add git pull/fetch --recurse-submodules to completion
Closes #12746
2026-05-13 19:58:52 +08:00
Daniel Rainer
4bdd35b8d1 feat: stop language fallback at English
Treating `en` the same as any other language is problematic as shown by
#12690. When the language precedence list contains entries after
English and we don't treat English specially, a lack of translations in
`en.po` (or a lack of `en.po`, once we delete it) results in
translations into those subsequent languages being displayed, instead of
the msgid, which is in English, and thus preferable.

By truncating the fallback list when we encounter `en`, this problem is
resolved. As it is implemented now, the `en.po` catalog is never used.
This is intended, as the plan is to delete it (#12745). In any case, its
translations are identical to the msgids modulo some fancy quotes.

While at it, also treat `LANGUAGE` values of `C` and `POSIX` as
referring to the English version of the messages.

Fixes #12690

Closes #12747
2026-05-13 19:58:52 +08:00
June Kim
a93fcd97a7 fish_git_prompt: include T (typechange) in status filter
The status entry filter regex was missing T, which is a valid
porcelain status code for file type changes (e.g. regular file
to symlink). Without it, typechange entries would be silently
dropped from dirty/staged detection.

Closes #12754
2026-05-13 19:58:52 +08:00
June Kim
f86c9af455 fish_git_prompt: skip rename/copy source paths in status parsing
When git status --porcelain -z reports renames or copies, it outputs
the source filename as a separate NUL-delimited field after the status
line. This extra entry was counted as an additional change, inflating
staged/dirty counts when the source filename started with [ACDMRTU].

Filter split results to entries matching a valid two-char status code
prefix, which excludes the bare source filenames.

Fixes #11296

Part of #12754
2026-05-13 19:58:52 +08:00
June Kim
f69f074f66 Add failing test for git prompt rename miscount (issue #11296)
git status --porcelain -z outputs the rename source filename as a
separate NUL-delimited entry after the status line. When the source
filename starts with [ACDMRTU], the informative prompt miscounts it
as an additional staged change.

Part of #12754
2026-05-13 19:58:52 +08:00
Nahor
f0054336ea man-pages: force encoding when reading doc sources
Force the encoding to not be dependent on the environment locale.

In particular on Windows, the encoding could default to an ANSI page
code, which would fail to load any file containing bytes 0x80+, i.e any
multi-byte UTF-8 character.

Closes #12748
2026-05-13 19:58:52 +08:00
Daniel Rainer
959cbb4259 feat: dynamic cargo xtask completions for fish
Use `clap_complete` to generate completions for our xtasks. This comes
with two complications:
- Due to the unusual CLI of the whole xtask CLI definition being itself
  a subcommand under `cargo` (via the `cargo xtask` alias), we need to
  tell `clap_complete` that we're generating completions for `cargo`,
  which is fairly straightforward to do via two new types which are only
  used for generating completions.
- Our completions for `cargo xtask` only make sense within fish's
  workspace, so we need to ensure that they are not active elsewhere.
  `clap_complete` does not support adding such conditions, so we hack
  them together by post-processing its output with sed.

Closes #12739
2026-05-13 19:58:52 +08:00
Collin Styles
fa6cbbdb40 Add completions for git history
This command was added in git 2.54:

94f057755b/Documentation/RelNotes/2.54.0.adoc

Both subcommands (`reword` and `split`) take a commit-ish object to
target. `split` also optionally accepts filenames so I tried to handle
that by copying the pattern from existing completions.

Closes #12737
2026-05-13 19:58:52 +08:00
Daniel Rainer
2b378b9c1f feat: add info how to update outdated PO files
Putting this in the error message makes it easier to find out how to
resolve the problem.

Closes #12735
2026-05-13 19:58:52 +08:00
Milo
2863960836 docs: update Homebrew link to HTTPS
Co-authored-by: KeloYuan <keloyuan@users.noreply.github.com>

Closes #12733
2026-05-13 19:58:52 +08:00