Uploaded image for project: 'Shared Source: Build'
  1. RMSRCBUILD-105

Checking if an ancestor is starting with one of the expected ancestors is not working as expected

    Details

      Description

      The Get-Ancestor ($ExpectedAncestors) function in git_base_functions.ps1 contains the following (shortened for brevity):

      $ExpectedAncestors = "release/", "develop" # Function parameter
      $Ancestors = "master", "develop", "release/v2.0.0" # Got this array by invoking git, replaced for brevity
      
      $ReturnAncestor = $NULL
      foreach ($Ancestor in $Ancestors)
      {
        if ($ExpectedAncestors.Contains($Ancestor) -or $Ancestor.StartsWith($ExpectedAncestors))
        {
          # ...
        }
      }

      The part $Ancestor.StartsWith($ExpectedAncestors) (l.7) always returns $false, because of $Ancestor being a string, and $ExpectedAncestors being an array.

      This causes the function to not find expected ancestors when they are not an exact match.

        Attachments

          Activity

            People

            • Assignee:
              Marcel Holle
              Reporter:
              Marcel Holle
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: