Skip to content

Commit b4ef6fb

Browse files
fix: short sha has at least four digits (#2540)
Currently it is not very unlikly to have a false match for tag `0` with sha `0XXXXXXXXXXXXXXXXXXXXXXX`, 1 to 16 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 7172fc3 commit b4ef6fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/common/git/git.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor {
330330
logger.Errorf("Unable to resolve %s: %v", input.Ref, err)
331331
}
332332

333-
if hash.String() != input.Ref && strings.HasPrefix(hash.String(), input.Ref) {
333+
if hash.String() != input.Ref && len(input.Ref) >= 4 && strings.HasPrefix(hash.String(), input.Ref) {
334334
return &Error{
335335
err: ErrShortRef,
336336
commit: hash.String(),

0 commit comments

Comments
 (0)