Skip to content

Commit de29db1

Browse files
committed
add debug logging for branch filtering
1 parent b4c97d6 commit de29db1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/cmd/match_criteria.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,28 @@ func PrMatchesCriteria(branch string, prLabels []string) bool {
2828

2929
// checks if a branch matches the branch filtering criteria
3030
func branchMatchesCriteria(branch string) bool {
31+
Logger.Debug("Checking branch criteria", "branch", branch)
3132
// Do not attempt to match on existing branches that were created by this CLI
3233
if branch == combineBranchName {
34+
Logger.Debug("Branch is a combine branch, skipping match")
3335
return false
3436
}
3537

3638
// If no branch filters are specified, all branches pass this check
3739
if branchPrefix == "" && branchSuffix == "" && branchRegex == "" {
40+
Logger.Debug("No branch filters specified, passing match")
3841
return true
3942
}
4043

4144
// Apply branch prefix filter if specified
4245
if branchPrefix != "" && !strings.HasPrefix(branch, branchPrefix) {
46+
Logger.Debug("Branch does not match prefix", "prefix", branchPrefix, "branch", branch)
4347
return false
4448
}
4549

4650
// Apply branch suffix filter if specified
4751
if branchSuffix != "" && !strings.HasSuffix(branch, branchSuffix) {
52+
Logger.Debug("Branch does not match suffix", "suffix", branchSuffix, "branch", branch)
4853
return false
4954
}
5055

@@ -57,10 +62,12 @@ func branchMatchesCriteria(branch string) bool {
5762
}
5863

5964
if !regex.MatchString(branch) {
65+
Logger.Debug("Branch does not match regex", "regex", branchRegex, "branch", branch)
6066
return false
6167
}
6268
}
6369

70+
Logger.Debug("Branch matches all branch criteria", "branch", branch)
6471
return true
6572
}
6673

0 commit comments

Comments
 (0)