Merge of Pull Request #136 Issue #136

This commit is contained in:
Peter Cottle 2013-10-09 14:26:57 -07:00
parent 55f54a8aa2
commit 68a58102cb
3 changed files with 22 additions and 2 deletions

View file

@ -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

View file

@ -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