]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
zsh: stop forcing unit file cache rebuilds
authorRonan Pigott <ronan@rjp.ie>
Mon, 17 Jul 2023 23:06:59 +0000 (16:06 -0700)
committerRonan Pigott <ronan@rjp.ie>
Mon, 17 Jul 2023 23:38:25 +0000 (16:38 -0700)
Rebuilding whenever the cached parameter is not set forces each new
shell to rebuild the cache, which often defeates the purpose of caching
in the first place.

shell-completion/zsh/_systemctl.in

index 98b4d2eb65baeda241734ab50af378faab5aef2e..5a6e7d391db800207e27a141f40c4ee14529413d 100644 (file)
@@ -161,8 +161,7 @@ __systemctl()
 (( $+functions[_systemctl_all_units] )) ||
     _systemctl_all_units()
 {
-    if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS$_sys_service_mgr ) ||
-           ! _retrieve_cache SYS_ALL_UNITS$_sys_service_mgr;
+    if _cache_invalid SYS_ALL_UNITS$_sys_service_mgr || ! _retrieve_cache SYS_ALL_UNITS$_sys_service_mgr;
     then
         _sys_all_units=( ${${(f)"$(__systemctl list-units --all)"}%% *} )
         _store_cache SYS_ALL_UNITS$_sys_service_mgr _sys_all_units
@@ -175,8 +174,7 @@ __systemctl()
 {
     local -a all_unit_files;
     local -a really_all_units;
-    if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS$_sys_service_mgr ) ||
-           ! _retrieve_cache SYS_REALLY_ALL_UNITS$_sys_service_mgr;
+    if _cache_invalid SYS_REALLY_ALL_UNITS$_sys_service_mgr || ! _retrieve_cache SYS_REALLY_ALL_UNITS$_sys_service_mgr;
     then
         all_unit_files=( ${${(f)"$(__systemctl list-unit-files)"}%% *} )
         _systemctl_all_units