@@ -505,12 +505,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context,
505
505
506
506
c , err := r .gitCheckout (ctx , obj , repositoryURL , authOpts , dir , optimizedClone )
507
507
if err != nil {
508
- e := serror .NewGeneric (
509
- fmt .Errorf ("failed to checkout and determine revision: %w" , err ),
510
- sourcev1 .GitOperationFailedReason ,
511
- )
512
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e .Err .Error ())
513
- return sreconcile .ResultEmpty , e
508
+ return sreconcile .ResultEmpty , err
514
509
}
515
510
// Assign the commit to the shared commit reference.
516
511
* commit = * c
@@ -544,12 +539,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context,
544
539
// optimization.
545
540
c , err := r .gitCheckout (ctx , obj , repositoryURL , authOpts , dir , false )
546
541
if err != nil {
547
- e := serror .NewGeneric (
548
- fmt .Errorf ("failed to checkout and determine revision: %w" , err ),
549
- sourcev1 .GitOperationFailedReason ,
550
- )
551
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e .Err .Error ())
552
- return sreconcile .ResultEmpty , e
542
+ return sreconcile .ResultEmpty , err
553
543
}
554
544
* commit = * c
555
545
}
@@ -773,7 +763,16 @@ func (r *GitRepositoryReconciler) gitCheckout(ctx context.Context,
773
763
// Checkout HEAD of reference in object
774
764
gitCtx , cancel := context .WithTimeout (ctx , obj .Spec .Timeout .Duration )
775
765
defer cancel ()
776
- return checkoutStrategy .Checkout (gitCtx , dir , repoURL , authOpts )
766
+ commit , err := checkoutStrategy .Checkout (gitCtx , dir , repoURL , authOpts )
767
+ if err != nil {
768
+ e := serror .NewGeneric (
769
+ fmt .Errorf ("failed to checkout and determine revision: %w" , err ),
770
+ sourcev1 .GitOperationFailedReason ,
771
+ )
772
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e .Err .Error ())
773
+ return nil , e
774
+ }
775
+ return commit , nil
777
776
}
778
777
779
778
// fetchIncludes fetches artifact metadata of all the included repos.
0 commit comments