From df4452290b231984520208c91607b26f78b7b7db Mon Sep 17 00:00:00 2001 From: Aaron Schrab Date: Wed, 20 Feb 2013 21:40:57 -0500 Subject: [PATCH 1/2] Target branch can't be second argument to merge Remove instances in tutorial where the target branch for a merge is supplied as a second argument to `git merge`. The target branch for merge is always the current branch. --- src/levels/intro/3.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/levels/intro/3.js b/src/levels/intro/3.js index 54dde492..705f9bd3 100644 --- a/src/levels/intro/3.js +++ b/src/levels/intro/3.js @@ -37,7 +37,7 @@ exports.level = { "", "So here we see that the `master` branch color is blended into all the commits, but the `bugFix` color is not. Let's fix that..." ], - "command": "git merge bugFix master", + "command": "git merge bugFix", "beforeCommand": "git checkout -b bugFix; git commit; git checkout master; git commit" } }, @@ -52,8 +52,8 @@ exports.level = { "", "Now all the commits are the same color, which means each branch contains all the work in the repository! Woohoo" ], - "command": "git merge master bugFix", - "beforeCommand": "git checkout -b bugFix; git commit; git checkout master; git commit; git merge bugFix master" + "command": "git checkout bugFix; git merge master", + "beforeCommand": "git checkout -b bugFix; git commit; git checkout master; git commit; git merge bugFix" } }, { From 4d6d247d015043a7b1bd8e6c6fbcf9f56a66183f Mon Sep 17 00:00:00 2001 From: Aaron Schrab Date: Wed, 20 Feb 2013 22:20:46 -0500 Subject: [PATCH 2/2] No multiple arguments for merge `git merge` should only be given multiple arguments if doing an octopus merge which isn't currently supported. Require that exactly one argument be given, and always use HEAD as the currentLocation. --- src/js/git/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/git/index.js b/src/js/git/index.js index 8749c720..2177bf26 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -1158,9 +1158,9 @@ GitEngine.prototype.rebaseFinish = function(toRebaseRough, stopSet, targetSource }; GitEngine.prototype.mergeStarter = function() { - this.twoArgsImpliedHead(this.generalArgs); + this.validateArgBounds(this.generalArgs, 1, 1); - var newCommit = this.merge(this.generalArgs[0], this.generalArgs[1]); + var newCommit = this.merge(this.generalArgs[0]); if (newCommit === undefined) { // its just a fast forwrard @@ -1171,7 +1171,9 @@ GitEngine.prototype.mergeStarter = function() { this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; -GitEngine.prototype.merge = function(targetSource, currentLocation) { +GitEngine.prototype.merge = function(targetSource) { + var currentLocation = 'HEAD'; + // first some conditions if (this.isUpstreamOf(targetSource, currentLocation) || this.getCommitFromRef(targetSource) === this.getCommitFromRef(currentLocation)) {