@@ -50,8 +50,8 @@ const maxNameLength = 63
50
50
// ValidateRepository checks that the current working directory is a valid git repository,
51
51
// and returns nil if valid.
52
52
type Git interface {
53
- FileExistsOnBranch (file string , remote string , branch string ) bool
54
- Show (file string , remote string , branch string ) (string , error )
53
+ FileExistsOnBranch (commit string , file string ) bool
54
+ Show (file string , commit string ) (string , error )
55
55
AddWorktree (path string , ref string ) error
56
56
RemoveWorktree (path string ) error
57
57
MergeBase (commit1 string , commit2 string ) (string , error )
@@ -820,15 +820,18 @@ func (t *Testing) checkBreakingChangeAllowed(chart *Chart) (allowed bool, err er
820
820
821
821
// GetOldChartVersion gets the version of the old Chart.yaml file from the target branch.
822
822
func (t * Testing ) GetOldChartVersion (chartPath string ) (string , error ) {
823
- cfg := t .config
823
+ mergeBase , err := t .computeMergeBase ()
824
+ if err != nil {
825
+ return "" , err
826
+ }
824
827
825
828
chartYamlFile := filepath .Join (chartPath , "Chart.yaml" )
826
- if ! t .git .FileExistsOnBranch (chartYamlFile , cfg . Remote , cfg . TargetBranch ) {
827
- fmt .Printf ("Unable to find chart on %s. New chart detected.\n " , cfg . TargetBranch )
829
+ if ! t .git .FileExistsOnBranch (mergeBase , chartYamlFile ) {
830
+ fmt .Printf ("Unable to find chart on commit %s. New chart detected.\n " , mergeBase )
828
831
return "" , nil
829
832
}
830
833
831
- chartYamlContents , err := t .git .Show (chartYamlFile , cfg . Remote , cfg . TargetBranch )
834
+ chartYamlContents , err := t .git .Show (mergeBase , chartYamlFile )
832
835
if err != nil {
833
836
return "" , fmt .Errorf ("failed reading old Chart.yaml: %w" , err )
834
837
}
0 commit comments