Skip to content

Commit

Permalink
Debug hound-search#407 branch can't be determined
Browse files Browse the repository at this point in the history
  • Loading branch information
dereckson committed Jan 16, 2022
1 parent 26eee07 commit 1c99508
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion vcs/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ type headBranchDetector struct {
func newGit(b []byte) (Driver, error) {
var d GitDriver

if b != nil {
if b == nil {
log.print("[DEBUG-407] JSON payload is nil.")
} else {
if err := json.Unmarshal(b, &d); err != nil {
log.Printf("[DEBUG-407] Error parsing JSON: %v", err)
return nil, err
}
}
Expand Down Expand Up @@ -114,16 +117,22 @@ func (g *GitDriver) Pull(dir string) (string, error) {

func (g *GitDriver) targetRef(dir string) string {
var targetRef string

if g.Ref != "" {
log.Print("[DEBUG-407] We've got a winner!")
targetRef = g.Ref
} else if g.DetectRef {
log.Print("[DEBUG-407] No ref explicitly set, let's autodetect")
targetRef = g.refDetetector.detectRef(dir)
}

if targetRef == "" {
log.Printf("[DEBUG-407] targetRef is an empty string, defaulting to %s", defaultRef)
targetRef = defaultRef
}

log.Printf("[DEBUG-407] targetRef final value is %s", targetRef)

return targetRef
}

Expand Down

0 comments on commit 1c99508

Please sign in to comment.