mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
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 <AllanZyne@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
a8e9d8bf57
commit
9fa93b0861
|
|
@ -15,8 +15,8 @@ end
|
||||||
# backwards compatibility:
|
# backwards compatibility:
|
||||||
# export all user-defined FORGIT variables to make them available in git-forgit
|
# export all user-defined FORGIT variables to make them available in git-forgit
|
||||||
set unexported_vars 0
|
set unexported_vars 0
|
||||||
set | awk -F ' ' '{ print $1 }' | grep FORGIT_ | while read var
|
for var in (set -n | string match -er '^FORGIT_')
|
||||||
if not set -x | grep -q "^$var\b"
|
if not set -xn | string match -qr "^$var\$"
|
||||||
if test $unexported_vars = 0
|
if test $unexported_vars = 0
|
||||||
forgit::warn "Config options have to be exported in future versions of forgit."
|
forgit::warn "Config options have to be exported in future versions of forgit."
|
||||||
forgit::warn "Please update your config accordingly:"
|
forgit::warn "Please update your config accordingly:"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue