Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions get_git.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ func (g *GitGetter) update(ctx context.Context, dst, sshKeyFile string, u *url.U
return err
}

// If the ref is empty, we need to find the default branch, otherwise fetch command will fail
if ref == "" {
ref = findRemoteDefaultBranch(ctx, u)
}

// Fetch the remote ref
cmd = exec.CommandContext(ctx, "git", "fetch", "origin", "--", ref)
cmd.Dir = dst
Expand Down