eclipse-egit / egit

EGit, the git integration of Eclipse IDE
https://www.eclipse.org/egit/
Eclipse Public License 2.0
13 stars 6 forks source link

Change-Id footer added to merge commit message not separated by empty line from message body/title #4

Closed tomaswolf closed 7 months ago

tomaswolf commented 7 months ago

Version

6.8.0

Operating System

MacOS

Eclipse version

2023-06

Bug description

  1. In a clone of the EGit repository (with Gerrit support enabled), create a branch "foo" on commit 8042ff7e7.
  2. Check out this "foo" branch.
  3. In the repositories view, select the EGit clone and choose "Merge..." from the context menu.
  4. In the dialog, select the "origin/stable-6.8" branch (at commit 91a6ddc55)
  5. Check "If a fast-forward, create a merge commit".
  6. Click the "Merge" button.

Actual behavior

A merge commit is created with commit message

Merge remote-tracking branch 'origin/stable-6.8' into foo
Change-Id: I6992e54ee2e3eb39f015d26b4811cb5660191521

Expected behavior

A merge commit with commit message

Merge remote-tracking branch 'origin/stable-6.8' into foo

Change-Id: I6992e54ee2e3eb39f015d26b4811cb5660191521

is created.

(The commit should have an empty line before the Change-Id footer.)

Relevant log output

No response

Other information

No response

tomaswolf commented 7 months ago

Strange... this happens consistently in my main EGit clone. In an another clone this exact sequence produces a commit message that does include the blank line.

tomaswolf commented 7 months ago

This was caused by having a old Gerrit commit-msg hook in the repository where this occurred. The hook runs before JGit tries to add the Change-Id, and somehow this very old hook script forgot the blank line. Removing that old hook script fixed this problem; using a current version of the hook script also works.

So: problem caused by a misconfiguration. It's not a bug in EGit, JGit, or in Gerrit.