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

Empty commit can't be squashed (Praqma case 13298)

XMLWordPrintable

      Squash commit commands fails if only one commit, that is empty, is tried to be integrated. Squash will do a fast-forward.

      Not sure if this really is something we should handle, or it is a git problem. Squash shouldn't allow fast-forward according to docs.

      Example on git commands

      $ git init emptyCommitTest
      Initialized empty Git repository in /home/user/gitlab-repos/github/pretested-integration-plugin/src/test/resources/emptyCommitTest/.git/

      $ cd emptyCommitTest/
      $ date > date.log
      $ git add date.log
      $ git commit -m "initial commit"
      [master (root-commit) 01f7627] initial commit
      1 file changed, 1 insertion
      create mode 100644 date.log

      $ git checkout -b dev
      Switched to a new branch 'dev'

      $ git commit -m "empty commit" --allow-empty
      [dev be7178f] empty commit

      $ git checkout master
      Switched to branch 'master'

      $ git merge --squash dev
      Updating 01f7627..be7178f
      Fast-forward
      Squash commit – not updating HEAD

      *The fast-forward is a problem, as the plugin do squash as a two-step process to allow settings author*:

      Example:

      git merge --squash origin/ready/JENKINS-27662_doublequotes
      git commit -no-edit "-author=Praqma Support <support@praqma.net> 1433315668 +0200"

            praqma Praqma Support
            bue Bue Petersen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: