From 9fa93b08610d50cd4108df15699e1ee4bb36e200 Mon Sep 17 00:00:00 2001 From: Yang Zhao Date: Tue, 14 Jul 2026 03:42:17 +0800 Subject: [PATCH] perf(fish): migrate FORGIT_ vars without spawning subprocesses (#543) The backwards-compatibility block that exports unexported FORGIT_ config variables ran `set | awk | grep` plus a `set -x | grep` for every variable, forking multiple external processes on every interactive fish startup. Replace the pipeline with fish's built-in `set -n`/`set -xn` and `string match`, which run in-process. Behavior is unchanged: unexported FORGIT_ variables are still detected, warned about, and exported; nothing is emitted when all variables are already exported. Co-authored-by: AllanZyne Co-authored-by: Claude Opus 4.8 --- conf.d/forgit.plugin.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf.d/forgit.plugin.fish b/conf.d/forgit.plugin.fish index 4b30d25..431295a 100644 --- a/conf.d/forgit.plugin.fish +++ b/conf.d/forgit.plugin.fish @@ -15,8 +15,8 @@ end # backwards compatibility: # export all user-defined FORGIT variables to make them available in git-forgit set unexported_vars 0 -set | awk -F ' ' '{ print $1 }' | grep FORGIT_ | while read var - if not set -x | grep -q "^$var\b" +for var in (set -n | string match -er '^FORGIT_') + if not set -xn | string match -qr "^$var\$" if test $unexported_vars = 0 forgit::warn "Config options have to be exported in future versions of forgit." forgit::warn "Please update your config accordingly:"