Skip to content
Permalink
Browse files

Merge pull request #9 from cruise-automation/collin/filetree_cond_cur…

…rent_path

only include current path if .new file written
  • Loading branch information
crmulliner committed Nov 18, 2019
2 parents ba18427 + cf7ec4e commit c1dfcd7251a765dcb0d1705f711d70a8c34f9ba9
Showing with 9 additions and 2 deletions.
  1. +9 −2 pkg/analyzer/filetree/filetree.go
@@ -232,11 +232,13 @@ func (state *fileTreeType) Finalize() string {
}
}

treeUpdated := false
if len(added) > 0 || len(removed) > 0 || (len(changed) > 0 && state.config.CheckPermsOwnerChange) {
err := state.saveTree()
if err != nil {
panic("saveTree failed")
}
treeUpdated = true
}

for _, fi := range added {
@@ -259,9 +261,14 @@ func (state *fileTreeType) Finalize() string {
if state.config.OldTreeFilePath != "" {
type reportData struct {
OldFileTreePath string `json:"old_file_tree_path"`
CurrentFileTreePath string `json:"current_file_tree_path"`
CurrentFileTreePath string `json:"current_file_tree_path,omitempty"`
}
data := reportData{state.config.OldTreeFilePath, state.config.OldTreeFilePath + newFileTreeExt}
newPath := ""
if treeUpdated {
newPath = state.config.OldTreeFilePath + newFileTreeExt
}

data := reportData{state.config.OldTreeFilePath, newPath}
jdata, _ := json.Marshal(&data)
return string(jdata)
}

0 comments on commit c1dfcd7

Please sign in to comment.
You can’t perform that action at this time.