Skip to content

Commit 7d46134

Browse files
committed
fix
1 parent 04017f2 commit 7d46134

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

services/asymkey/sign.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,22 @@ Loop:
290290
return false, nil, nil, err
291291
}
292292
defer gitRepo.Close()
293-
commit, err := gitRepo.GetCommit(parentCommit)
293+
isEmpty, err := gitRepo.IsEmpty()
294294
if err != nil {
295295
return false, nil, nil, err
296296
}
297-
if commit.Signature == nil {
298-
return false, nil, nil, &ErrWontSign{parentSigned}
299-
}
300-
verification := ParseCommitWithSignature(ctx, commit)
301-
if !verification.Verified {
302-
return false, nil, nil, &ErrWontSign{parentSigned}
297+
if !isEmpty {
298+
commit, err := gitRepo.GetCommit(parentCommit)
299+
if err != nil {
300+
return false, nil, nil, err
301+
}
302+
if commit.Signature == nil {
303+
return false, nil, nil, &ErrWontSign{parentSigned}
304+
}
305+
verification := ParseCommitWithSignature(ctx, commit)
306+
if !verification.Verified {
307+
return false, nil, nil, &ErrWontSign{parentSigned}
308+
}
303309
}
304310
}
305311
}

0 commit comments

Comments
 (0)