Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65183

Default branch handling is missing in pipeline git step

      Currently many GitHub projects are changing the default branch from master to main.  Some projects have both branches.  The following produce different results:

      Shell:

      git clone url #checks out main
      

      Pipeline:

      git 'url' # checks out master 

      It is certainly possible to specify a branch in both git and checkout step, but the default behavior is unintuitive.  As the default branch switch to main continues, I expect to encounter many (more) projects that have both branches (for better or for worse).

      I noticed that docs were recently updated (JENKINS-64320), but I don't believe that every job referencing a repository (in this way) should change when the upstream default branch configuration changes.

          [JENKINS-65183] Default branch handling is missing in pipeline git step

          Alexander Komarov created issue -
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Mark Waite made changes -
          Remote Link New: This issue links to "JENKINS-65183 verification job definition (Web Link)" [ 26575 ]
          Mark Waite made changes -
          Remote Link New: This issue links to "Working branch with draft changes (Web Link)" [ 26581 ]

            Unassigned Unassigned
            akom Alexander Komarov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: