mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-06 10:08:47 +00:00
Update exports when an exported universal variable changes
Fixes #6612
(cherry picked from commit 7517128b68
)
This commit is contained in:
parent
3882a2ffb3
commit
971a837031
2 changed files with 11 additions and 3 deletions
|
@ -346,11 +346,12 @@ void env_universal_t::generate_callbacks_and_update_exports(const var_table_t &n
|
|||
|
||||
bool old_exports = (existing != this->vars.end() && existing->second.exports());
|
||||
bool export_changed = (old_exports != new_entry.exports());
|
||||
if (export_changed) {
|
||||
bool value_changed = existing != this->vars.end() && existing->second != new_entry;
|
||||
if (export_changed || value_changed) {
|
||||
export_generation += 1;
|
||||
}
|
||||
if (existing == this->vars.end() || export_changed || existing->second != new_entry) {
|
||||
// Value has changed.
|
||||
if (existing == this->vars.end() || export_changed || value_changed) {
|
||||
// Value is set for the first time, or has changed.
|
||||
callbacks.push_back(callback_data_t(key, new_entry.as_string()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -480,4 +480,11 @@ $FISH -c 'set -S EDITOR' | string match -r -e 'global|universal'
|
|||
# CHECK: $EDITOR: set in universal scope, exported, with 2 elements
|
||||
sh -c "EDITOR='vim -g' $FISH -c "'\'set -S EDITOR\'' | string match -r -e 'global|universal'
|
||||
|
||||
while set -e __fish_test_universal_exported_var
|
||||
end
|
||||
set -xU __fish_test_universal_exported_var 1
|
||||
$FISH -c 'set __fish_test_universal_exported_var 2'
|
||||
env | string match -e __fish_test_universal_exported_var
|
||||
#CHECK: __fish_test_universal_exported_var=2
|
||||
|
||||
true
|
||||
|
|
Loading…
Reference in a new issue