File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,11 @@ func (o *ResetOptions) Validate(r *Repository) error {
427
427
}
428
428
429
429
o .Commit = ref .Hash ()
430
+ } else {
431
+ _ , err := r .CommitObject (o .Commit )
432
+ if err != nil {
433
+ return fmt .Errorf ("invalid reset option: %w" , err )
434
+ }
430
435
}
431
436
432
437
return nil
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ func (s *OptionsSuite) TestCommitOptionsParentsFromHEAD(c *C) {
23
23
c .Assert (o .Parents , HasLen , 1 )
24
24
}
25
25
26
+ func (s * OptionsSuite ) TestResetOptionsCommitNotFound (c * C ) {
27
+ o := ResetOptions {Commit : plumbing .NewHash ("ab1b15c6f6487b4db16f10d8ec69bb8bf91dcabd" )}
28
+ err := o .Validate (s .Repository )
29
+ c .Assert (err , NotNil )
30
+ }
31
+
26
32
func (s * OptionsSuite ) TestCommitOptionsCommitter (c * C ) {
27
33
sig := & object.Signature {}
28
34
You can’t perform that action at this time.
0 commit comments