diff --git a/src/git.js b/src/git.js index 2e945888..f100f41c 100644 --- a/src/git.js +++ b/src/git.js @@ -488,6 +488,10 @@ GitEngine.prototype.commit = function() { }; GitEngine.prototype.resolveID = function(idOrTarget) { + if (idOrTarget === null || idOrTarget === undefined) { + throw new Error('Dont call this with null / undefined'); + } + if (typeof idOrTarget !== 'string') { return idOrTarget; } @@ -538,6 +542,7 @@ GitEngine.prototype.resolveStringRef = function(ref) { GitEngine.prototype.getCommitFromRef = function(ref) { var start = this.resolveID(ref); + // works for both HEAD and just a single layer. aka branch while (start.get('type') !== 'commit') { start = start.get('target'); @@ -644,7 +649,12 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) { while (pQueue.length && numBack !== 0) { var popped = pQueue.shift(0); - pQueue = pQueue.concat(popped.get('parents')); + var parents = popped.get('parents'); + + if (parents && parents.length) { + pQueue = pQueue.concat(parents); + } + pQueue.sort(this.idSortFunc); numBack--; } diff --git a/src/miscViews.js b/src/miscViews.js index b1beeba9..128821c0 100644 --- a/src/miscViews.js +++ b/src/miscViews.js @@ -16,6 +16,7 @@ var InteractiveRebaseView = Backbone.View.extend({ this.rebaseMap = {}; this.entryObjMap = {}; + this.rebaseArray.reverse(); // make basic models for each commit _.each(this.rebaseArray, function(commit) { var id = commit.get('id'); @@ -51,7 +52,7 @@ var InteractiveRebaseView = Backbone.View.extend({ _.each(uiOrder, function(id) { // the model if (this.entryObjMap[id].get('pick')) { - toRebase.push(this.rebaseMap[id]); + toRebase.lshift(this.rebaseMap[id]); } }, this); diff --git a/src/style/main.css b/src/style/main.css index 666ca9f3..ef0ac483 100644 --- a/src/style/main.css +++ b/src/style/main.css @@ -328,6 +328,11 @@ p.commandLine span.prompt { li.rebaseEntry { margin: 10px; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.5); + cursor: move; +} + +li.rebaseEntry a#toggleButton { + cursor: pointer; } li.rebaseEntry.notPicked { @@ -478,3 +483,4 @@ li.rebaseEntry.notPicked { border-top-color: #9bcbeb; background: #9bcbeb; } + diff --git a/src/visuals.js b/src/visuals.js index 885877cd..4e68d322 100644 --- a/src/visuals.js +++ b/src/visuals.js @@ -468,6 +468,7 @@ GitVisuals.prototype.addEdge = function(idTail, idHead) { GitVisuals.prototype.collectionChanged = function() { console.log('git visuals... collection was changed'); // redo stuff + // TODO }; GitVisuals.prototype.zIndexReflow = function() {