mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
parent
55f54a8aa2
commit
68a58102cb
3 changed files with 22 additions and 2 deletions
|
@ -381,11 +381,18 @@ var commandConfig = {
|
|||
|
||||
merge: {
|
||||
regex: /^git +merge($|\s)/,
|
||||
options: [
|
||||
'--no-ff'
|
||||
],
|
||||
execute: function(engine, command) {
|
||||
var commandOptions = command.getOptionsMap();
|
||||
var generalArgs = command.getGeneralArgs();
|
||||
command.validateArgBounds(generalArgs, 1, 1);
|
||||
|
||||
var newCommit = engine.merge(generalArgs[0]);
|
||||
var newCommit = engine.merge(
|
||||
generalArgs[0],
|
||||
{ noFF: !!commandOptions['--no-ff'] }
|
||||
);
|
||||
|
||||
if (newCommit === undefined) {
|
||||
// its just a fast forwrard
|
||||
|
|
|
@ -2005,7 +2005,8 @@ GitEngine.prototype.mergeCheck = function(targetSource, currentLocation) {
|
|||
return this.isUpstreamOf(targetSource, currentLocation) || sameCommit;
|
||||
};
|
||||
|
||||
GitEngine.prototype.merge = function(targetSource) {
|
||||
GitEngine.prototype.merge = function(targetSource, options) {
|
||||
options = options || {};
|
||||
var currentLocation = 'HEAD';
|
||||
|
||||
// first some conditions
|
||||
|
@ -2016,6 +2017,11 @@ GitEngine.prototype.merge = function(targetSource) {
|
|||
}
|
||||
|
||||
if (this.isUpstreamOf(currentLocation, targetSource)) {
|
||||
if (options.noFF) {
|
||||
throw new GitError({
|
||||
msg: intl.todo('Merge aborted because no-fast-forward was specified!')
|
||||
});
|
||||
}
|
||||
// just set the target of this current location to the source
|
||||
this.setTargetLocation(currentLocation, this.getCommitFromRef(targetSource));
|
||||
// get fresh animation to happen
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue