mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-13 04:19:44 +02:00
feat(git): allow custom merge commit ids
Currently, merge commits can have a git tag, but they cannot have a
custom git commit ID.
This commit allows modifying the default merge commit id.
It also displays all merge commits IDs, which undoes
3ccf027f42
This commit is contained in:
@@ -148,8 +148,17 @@ export const branch = function (name, order) {
|
||||
}
|
||||
};
|
||||
|
||||
export const merge = function (otherBranch, tag) {
|
||||
/**
|
||||
* Creates a merge commit.
|
||||
*
|
||||
* @param {string} otherBranch - Target branch to merge to.
|
||||
* @param {string} [tag] - Git tag to use on this merge commit.
|
||||
* @param {string} [id] - Git commit id.
|
||||
*/
|
||||
export const merge = function (otherBranch, tag, id) {
|
||||
otherBranch = common.sanitizeText(otherBranch, configApi.getConfig());
|
||||
id = common.sanitizeText(id, configApi.getConfig());
|
||||
|
||||
const currentCommit = commits[branches[curBranch]];
|
||||
const otherCommit = commits[branches[otherBranch]];
|
||||
if (curBranch === otherBranch) {
|
||||
@@ -219,7 +228,7 @@ export const merge = function (otherBranch, tag) {
|
||||
// } else {
|
||||
// create merge commit
|
||||
const commit = {
|
||||
id: seq + '-' + getId(),
|
||||
id: id || seq + '-' + getId(),
|
||||
message: 'merged branch ' + otherBranch + ' into ' + curBranch,
|
||||
seq: seq++,
|
||||
parents: [head == null ? null : head.id, branches[otherBranch]],
|
||||
|
Reference in New Issue
Block a user