Skip to content

Commit

Permalink
Updating the logging message for clear understanding
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohit Sharma committed Dec 4, 2023
1 parent 1b75206 commit 906c4b3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cmd/update-rules/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ func UpdateRules(rules *config.RepositoryRules, branch, goVer string, deleteRule
if deleteRule {
for i, br := range r.Branches {
if br.Name == branch {
glog.Infof("Remove rule %s for %s", branch, r.DestinationRepository)
r.Branches = append(r.Branches[:i], r.Branches[i+1:]...)
glog.Infof("remove rule %s for %s", branch, r.DestinationRepository)
rules.Rules[j].Branches = append(rules.Rules[j].Branches[:i], rules.Rules[j].Branches[i+1:]...)
deletedBranch = true
break
}
}
if !deletedBranch {
glog.Infof("Trying to delete branch %s that doesn't exists for %s", branch, r.DestinationRepository)
glog.Infof("skipping delete of branch rule %s that doesn't exists for %s", branch, r.DestinationRepository)
}
continue
}
Expand All @@ -162,11 +162,11 @@ func UpdateRules(rules *config.RepositoryRules, branch, goVer string, deleteRule
continue
}

var branchRuleExists bool
// if the target branch rules already exists, update it
// update the rules for branch and its dependencies
updateBranchRules(&newBranchRule, branch, goVer)

var branchRuleExists bool
// if the target branch rules already exists, update it
for i, br := range r.Branches {
if br.Name == branch {
glog.Infof("found branch %s rules for destination repo %s, updating it", branch, r.DestinationRepository)
Expand All @@ -175,7 +175,6 @@ func UpdateRules(rules *config.RepositoryRules, branch, goVer string, deleteRule
break
}
}

// new rules, append to destination's branches
if !branchRuleExists {
r.Branches = append(r.Branches, newBranchRule)
Expand Down

0 comments on commit 906c4b3

Please sign in to comment.