Skip to content

Commit 2a85947

Browse files
committed
use correct git merge message
1 parent 20df09b commit 2a85947

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/utils/MergeUtils.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
const MergeUtils = {
22
getMergeMessage(toBranch, fromBranch) {
3-
return `Merged ${fromBranch.shorthand()} into ${toBranch.shorthand()}`;
3+
let mergeDecorator;
4+
if (fromBranch.isTag()) {
5+
mergeDecorator = 'tag';
6+
} else if (fromBranch.isRemote()) {
7+
mergeDecorator = 'remote-tracking branch';
8+
} else {
9+
mergeDecorator = 'branch';
10+
}
11+
12+
const message = `Merge ${mergeDecorator} '${fromBranch.shorthand()}'`;
13+
14+
// https://github.com/git/git/blob/master/builtin/fmt-merge-msg.c#L456-L459
15+
return toBranch.shorthand() !== 'master'
16+
? `${message} into ${toBranch.shorthand()}`
17+
: message;
418
}
519
};
620

0 commit comments

Comments
 (0)