You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/05/02 22:34:50 UTC
[mynewt-newt] branch master updated: syscfg: Preserve history
during pruning
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
The following commit(s) were added to refs/heads/master by this push:
new 4f0c27e syscfg: Preserve history during pruning
4f0c27e is described below
commit 4f0c27e12d030f7de917846f2afc735d87be2359
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed May 1 11:20:24 2019 -0700
syscfg: Preserve history during pruning
During "imposter pruning", newt makes a temporary copy of each syscfg
entry and manipulates their histories. The entry copy's history slice
points uses the same underlying array as the original, so modifying the
copy makes permanent changes to the original. The result is: the
override history displayed by `newt target config show` is sometimes
incorrect.
The fix is to make a copy of the history slice as well. Then, all
modifications are isolated to the temporary copy.
---
newt/resolve/resolve.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/newt/resolve/resolve.go b/newt/resolve/resolve.go
index 6f5fe38..b9fcbed 100644
--- a/newt/resolve/resolve.go
+++ b/newt/resolve/resolve.go
@@ -664,6 +664,9 @@ func (r *Resolver) detectImposter(rpkg *ResolvePackage) (bool, error) {
// Copy the source entry in full, then check its history for the
// potential imposter.
dst := src
+ dst.History = make([]syscfg.CfgPoint, len(src.History))
+ copy(dst.History, src.History)
+
for i, _ := range dst.History {
if dst.History[i].Source == rpkg.Lpkg {
if i == 0 {