Don't add duplicate comment on cherry-picked commits

Gunnlaugur's Avatar

Gunnlaugur

20 Sep, 2010 07:59 PM

When I do this:

git checkout onebranch
git commit -m 'Fix stuff [#123 state:resolved]'
git checkout anotherbranch
# cherry-pick latest commit from onebranch:
git cherry-pick -x onebranch
git push origin onebranch anotherbranch

then our github service hook will post both commits to Lighthouse, and Lighthouse will comment twice on ticket 123 with the exact same comment text, except that the commit SHAs differ, and the comment for the cherry-picked commit will end with “(cherry picked from commit [sha-of-original-commit])” (because I passed the -x parameter to `git cherry-pick).

The comment for the cherry-pick commit comes before the comment for the original commit (at least in my case, project 48730, ticket 543), but the main problems are:

a) that the duplication is noisy, and
b) attribute changes in the commit message are reapplied

To address a), either the cherry-pick comment should be omitted entirely, or it should appear after the original commit and should be truncated to be just something like:

(from [sha-of-cherry-picked-commit]) … (cherry picked from commit sha-of-original-commit)

(Ideally the branch names should be included, but I guess Github does not supply that information in the commit notification.)

To address b), Lighthouse attribute changes like [#ticketnum state:resolved] should not be re-applied when duplicated in a cherry-pick commit, because this is probably not correct for the workflow. In our case, a commit message said [state:resolved], then QA tested and put the ticket in [state:verified], and then a cherry-pick reverted the ticket back to [state:resolved].

  1. Nicole closed this discussion on 02 Jul, 2012 08:55 PM.

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac