diff --git a/src/git.js b/src/git.js index b4050c3d..6b477314 100644 --- a/src/git.js +++ b/src/git.js @@ -439,7 +439,7 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) { GitEngine.prototype.rebaseAltId = function(id) { // this function alters an ID to add a quote to the end, - // indicating that it was rebased. + // indicating that it was rebased. it also checks existence var regexMap = [ [/^C(\d+)[']{0,2}$/, function(bits) { // this id can use another quote, so just add it @@ -459,7 +459,13 @@ GitEngine.prototype.rebaseAltId = function(id) { var func = regexMap[i][1]; var results = regex.exec(id); if (results) { - return func(results); + var newId = func(results); + // if this id exists, continue down the rabbit hole + if (this.refs[newId]) { + return this.rebaseAltId(newId); + } else { + return newId; + } } } throw new Error('could not modify the id ' + id); diff --git a/todo.txt b/todo.txt index eb001aca..72dc3356 100644 --- a/todo.txt +++ b/todo.txt @@ -37,8 +37,6 @@ Bugs to fix: We need some kind of "update everything but this set of nodes" thing... - cannot checkout commits with dashes - -- when generating new ids (C1' or C2''), need to check if they already exist!!! otherwise it wil barf - always grab the maxHeight - debug why typing takes so long with the profiler