Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-20159

Automatic branch merging fails when using Git LFS

    XMLWordPrintable

Details

    Description

      Summary
      When using repositories with Git Large File Storage (LFS) and a merging scheme such as Branch Updater, the merge fails with the following error in server logs:

      2018-11-01 10:20:16,361 WARN [6-DelayedChangeDetectionThread:pool-12-thread-65] [ChainExecutionManagerImpl] Merge command error: com.atlassian.bamboo.plugins.git.GitCommandException: command [/bin/git merge --no-commit 370affcfbe4f62d50ecf04fb64ab7c559f093b62] failed with code 128. Working directory was [/bamboo-home/xml-data/build-dir/serverSide/PROJ-BRAN10-1/mergeWorkspace]., stderr:
      error: Your local changes to the following files would be overwritten by merge:
      

      Steps to Reproduce

      1. Setup repository with LFS and 2 branches: master and develop
      2. Create plan at Bamboo and link to this repository
         final Plan plan = new Plan(new Project()
                        .key(new BambooKey("TEST"))
                        .name("Test"),
                    "LFS",
                    new BambooKey("LFS"))
                    .pluginConfigurations(new ConcurrentBuilds()
                            .useSystemWideDefault(false))
                    .stages(new Stage("Default Stage")
                            .jobs(new Job("Default Job",
                                    new BambooKey("JOB1"))
                                    .tasks(new VcsCheckoutTask()
                                            .description("Checkout Default Repository")
                                            .checkoutItems(new CheckoutItem().defaultRepository()))))
                    .linkedRepositories("Mvnrepos")
                    .triggers(new RepositoryPollingTrigger())
                    .planBranchManagement(new PlanBranchManagement()
                            .createForPullRequest()
                            .delete(new BranchCleanup()
                                .whenRemovedFromRepositoryAfterDays(7)
                                .whenInactiveInRepositoryAfterDays(30))
                            .branchIntegration(new BranchIntegration()
                                    .integrationBranch(new PlanBranchIdentifier(new BambooKey("LFS"))))
                            .issueLinkingEnabled(false));
        
      3. Do a commit to develop branch which affects file under LFS control, e.g. sample.zip which should exists in both branches
      4. Do a commit to master branch which creates another file under LFS control, e.g. sample2.zip which exists only at master branch
      5. Create pull request at repository develop -> master and wait for build.

      Expected Results

      The branch merging succeed and the build will be sent to the queue

      Actual Results

      It will fail to merge develop and master branches with error message

      error: Your local changes to the following files would be overwritten by checkout:
      	sample.zip
      Please commit your changes or stash them before you switch branches.
      Aborting
      

      Workaround

      There is no verified workaround.

      Attachments

        Activity

          People

            Unassigned Unassigned
            gribeiro Gabriel Ribeiro
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated: