From d007bd255d779eb5d14e475606305398bcd674de Mon Sep 17 00:00:00 2001 From: Cyril Jouve Date: Wed, 4 Oct 2023 01:15:10 +0200 Subject: [PATCH] use the same ref to check branch existance and merge-base calculation fix #577 Signed-off-by: Cyril Jouve --- pkg/chart/chart.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/chart/chart.go b/pkg/chart/chart.go index 352c8298..5f2907bf 100644 --- a/pkg/chart/chart.go +++ b/pkg/chart/chart.go @@ -722,11 +722,12 @@ func (t *Testing) computeMergeBase() (string, error) { return "", errors.New("must be in a git repository") } - if !t.git.BranchExists(t.config.TargetBranch) { - return "", fmt.Errorf("targetBranch '%s' does not exist", t.config.TargetBranch) + branch := fmt.Sprintf("%s/%s", t.config.Remote, t.config.TargetBranch) + if !t.git.BranchExists(branch) { + return "", fmt.Errorf("targetBranch '%s' does not exist", branch) } - return t.git.MergeBase(fmt.Sprintf("%s/%s", t.config.Remote, t.config.TargetBranch), t.config.Since) + return t.git.MergeBase(branch, t.config.Since) } // ComputeChangedChartDirectories takes the merge base of HEAD and the configured remote and target branch and computes a