Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: azure devops add and then modify cannot trigger create issue (#8885)
h3n4l32c37db6502c
diff --git a/backend/plugin/vcs/util.go b/backend/plugin/vcs/util.goindex 89c979c013..239899f1b7 100644--- a/backend/plugin/vcs/util.go+++ b/backend/plugin/vcs/util.go@@ -58,6 +58,7 @@ type DistinctFileItem struct {}// GetDistinctFileList gets the distinct files from push event commits.+// The caller should ensure the commit list is logically organized.func (p PushEvent) GetDistinctFileList() []DistinctFileItem {// Use list instead of map because we need to maintain the relative commit order in the source branch.var distinctFileList []DistinctFileItem@@ -80,7 +81,14 @@ func (p PushEvent) GetDistinctFileList() []DistinctFileItem {if item.FileName != file.FileName {continue}- if file.CreatedTs < commit.CreatedTs {+ isPreviousCommit := file.CreatedTs >= commit.CreatedTs+ if isPreviousCommit {+ // The VCS may reverse the commit order in the commit list, so the index of modified file commit is less than the added file commit.+ // In this case, we should modified the existing distinctFileList item's ItemType to modified.+ if item.ItemType == FileItemTypeAdded {+ distinctFileList[i].ItemType = FileItemTypeAdded+ }+ } else {// A file can be added and then modified in a later commit. We should consider the item as added.if file.ItemType == FileItemTypeAdded {item.ItemType = FileItemTypeAdded