Skip to content

Commit 4f883e9

Browse files
earl-warrenChristopherHX
andcommitted
fix: short sha has at least four digits (#820)
Refs nektos/act#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> (cherry picked from commit 4dc67f6ba28f888328a2568bbcacf49e552650da) <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/820): <!--number 820 --><!--line 0 --><!--description Zml4OiBzaG9ydCBzaGEgaGFzIGF0IGxlYXN0IGZvdXIgZGlnaXRz-->fix: short sha has at least four digits<!--description--> <!--end release-notes-assistant--> Co-authored-by: ChristopherHX <[email protected]> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/820 Reviewed-by: Gusted <[email protected]>
1 parent e100e30 commit 4f883e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

act/common/git/git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor {
340340
logger.Errorf("Unable to resolve %s: %v", input.Ref, err)
341341
}
342342

343-
if hash.String() != input.Ref && strings.HasPrefix(hash.String(), input.Ref) {
343+
if hash.String() != input.Ref && len(input.Ref) >= 4 && strings.HasPrefix(hash.String(), input.Ref) {
344344
return &Error{
345345
err: ErrShortRef,
346346
commit: hash.String(),

0 commit comments

Comments
 (0)