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 @@ -408,6 +408,11 @@ func (o *ResetOptions) Validate(r *Repository) error {
408
408
}
409
409
410
410
o .Commit = ref .Hash ()
411
+ } else {
412
+ _ , err := r .CommitObject (o .Commit )
413
+ if err != nil {
414
+ return fmt .Errorf ("invalid reset option: %w" , err )
415
+ }
411
416
}
412
417
413
418
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