mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 20:33:44 +08:00
Fix local-exported vars with "--no-scope-shadowing"
This used to create copies even then, which meant it couldn't modify them.
This commit is contained in:
parent
04205f36be
commit
415c7ebbcc
12
src/env.cpp
12
src/env.cpp
|
@ -182,11 +182,13 @@ void var_stack_t::push(bool new_scope) {
|
|||
|
||||
// Copy local-exported variables
|
||||
auto top_node = top.get();
|
||||
if (!(top_node == this->global_env)) {
|
||||
for (auto& var : top_node->env) {
|
||||
if (var.second.exportv) {
|
||||
// This should copy var
|
||||
node->env.insert(var);
|
||||
if (new_scope) {
|
||||
if (!(top_node == this->global_env)) {
|
||||
for (auto& var : top_node->env) {
|
||||
if (var.second.exportv) {
|
||||
// This should copy var
|
||||
node->env.insert(var);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user