Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including tag on a merge commit #22

Closed
tlimpanont opened this issue Aug 2, 2016 · 5 comments
Closed

Including tag on a merge commit #22

tlimpanont opened this issue Aug 2, 2016 · 5 comments

Comments

@tlimpanont
Copy link

Please show me a way to include a tag on a merge commit. How do I do that with gitRawCommit.opts?

@tlimpanont tlimpanont changed the title Including tag on the merge commit Including tag on a merge commit Aug 2, 2016
@stevemao stevemao closed this as completed Aug 2, 2016
@hutson
Copy link
Contributor

hutson commented Aug 10, 2016

I actually ran into this issue myself on Monday while using semantic-release-gitlab.

Because the last commit will always be a merge commit (it's the default configuration for new GitLab projects), and because semantic-release-gitlab always creates the tag on the last commit, its the merge commit that contains the tag.

A very simple repository (Using a standard git merge branch/name --no-ff to create a merge commit) is able to demonstrate this issue:

(22:37 CDT)-(git::master)--> git log --graph
*   commit 084f9029663eb5fdb28108194d95a6c47f95e851
|\  Merge: 8c9780a ab55557
| | Author: Hutson Betts <hutson@hyper-expanse.net>
| | Date:   Tue Aug 9 21:31:38 2016 -0500
| |
| |     Merge branch 'feat/package/author'
| |
| * commit ab55557244b20a0186bc1d5f3125e23afc415808
|/  Author: Hutson Betts <hutson@hyper-expanse.net>
|   Date:   Tue Aug 9 21:25:46 2016 -0500
|
|       feat(package): add author
|
|       Add myself to the author list.
|
* commit 8c9780a0e0929681b7d097568a05f3222fafe5cd
| Author: Hutson Betts <hutson@hyper-expanse.net>
| Date:   Tue Aug 9 21:24:30 2016 -0500
|
|     feat(package): add descriptive project keyword
|
|     Add a descriptive project keyword to project's `package.json` file.
|
* commit f41ceb7792b7d545ed61284e6d3458b0dcebf41e
  Author: Hutson Betts <hutson@hyper-expanse.net>
  Date:   Tue Aug 9 21:23:51 2016 -0500

      chore(package): initial commit

      Initial project commit.

@stevemao you suggested setting noMerges to null, but it seems that doesn't actually work.

I ended up needing to set the option merges to null to have merge commits included. (Props to @tlimpanont for demonstrating that option in part-up/part-up#622)

Turns out, though, that you can't pass merges or noMerges to conventional-github-releaser or conventional-gitlab-releaser because if releaseCount is set to anything but 0, gitRawCommitsOpts will be replaced: https://github.com/conventional-changelog/conventional-github-releaser/blob/73c27d93958a4cdf5ed857a3c2819ad804d7d17f/index.js#L76

I will be releasing a new version of conventional-gitlab-releaser with the gitRawCommitsOpts assigned in the following manner:

gitRawCommitsOpts = assign(gitRawCommitsOpts, {
  from: tags[releaseCount]
});

That allows for merges to be set to null by consumers of conventional-gitlab-releaser.

@hutson
Copy link
Contributor

hutson commented Aug 10, 2016

This is the change I eventually made to conventional-gitlab-releaser: https://gitlab.com/hutson/conventional-gitlab-releaser/compare/c0e50b1a7b18410323961b0badc11af8ea8119a9...master

@stevemao
Copy link
Member

Turns out, though, that you can't pass merges or noMerges

It bit me too. I'm fine to make that change.

@tlimpanont
Copy link
Author

@hbetts ahh very nice, thanks guys!

@hutson hutson added the defect label May 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants