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

Git plugin: show conflicting files if pre-build merge fails

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None

      The pre-build merge feature of the git plugin is really useful - we use it to help minimise the extent to which feature branches drift away from master. However, when the build fails, the message is pretty uninformative - it just says "did not merge cleanly", but that gives no hint as to how unclean the merge was, and how long it might take to fix, and therefore how to prioritise fixing the merge.

      It would be great if Jenkins could report which files were in conflict after a failed merge: that would make it much easier to distinguish between a simple conflict of one or two files, and a major divergence.

      I believe this could be done by parsing the output of the "git merge" command itself - sample output with the relevant part emphasised:

      $ git merge master
      Auto-merging app/controllers/contacts_controller.rb
      Auto-merging app/controllers/widgets_controller.rb
      CONFLICT (content): Merge conflict in app/controllers/widgets_controller.rb
      Removing js/clients/widgets/gadgets.js
      Auto-merging lib/authenticated_system.rb
      Auto-merging spec/controllers/widgets_controller_spec.rb
      Recorded preimage for 'app/controllers/widgets_controller.rb'
      Automatic merge failed; fix conflicts and then commit the result.

      Alternatively, running "git status" after the failed merge should also show the files in conflict in the "Unmerged paths" section, e.g.:

      $ git status
      # On branch wip.cors.phase2
      # Changes to be committed:
      #
      #	modified:   app/controllers/contacts_controller.rb
      #       ... <blah>
      #
      # Unmerged paths:
      #   (use "git add/rm <file>..." as appropriate to mark resolution)
      #
      #	both modified:      app/controllers/widgets_controller.rb
      #
      

            Unassigned Unassigned
            samstokes Sam Stokes
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: