aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMikhail Uvarov <[email protected]>2019-08-12 01:49:59 +0200
committerMikhail Uvarov <[email protected]>2019-08-12 01:56:01 +0200
commite644d7c078c9b75edf1ba513a030d33921af8192 (patch)
tree8979a309de94132d354017e21819d659e73e99fe /src
parentf6bdffcd9bff0b62f3b7fd7bbf3db034f05fbd66 (diff)
downloadrelx-e644d7c078c9b75edf1ba513a030d33921af8192.tar.gz
relx-e644d7c078c9b75edf1ba513a030d33921af8192.tar.bz2
relx-e644d7c078c9b75edf1ba513a030d33921af8192.zip
Correctly render redefined variable
Rendering of variables behaves differently for already defined variables. Values of such variables are rendered in the wrong order, ignoring any variables above from the same file.
Diffstat (limited to 'src')
-rw-r--r--src/rlx_prv_overlay.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index 87fa91f..75608b3 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -187,9 +187,11 @@ merge_overlay_vars(State, FileNames) ->
%% to the current one being read
OverlayRelativeRoot = filename:dirname(FileName),
NewTerms = check_overlay_inclusion(State, OverlayRelativeRoot, Terms),
+ %% Remove already defined variables from Acc,
+ %% append NewTerms, preserving order
lists:foldl(fun(NewTerm, A) ->
- lists:keystore(element(1, NewTerm), 1, A, NewTerm)
- end, Acc, NewTerms);
+ lists:keydelete(element(1, NewTerm), 1, A)
+ end, Acc, NewTerms) ++ NewTerms;
{error, Reason} ->
ec_cmd_log:warn(rlx_state:log(State),
format_error({unable_to_read_varsfile, FileName, Reason})),