mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-10 06:34:26 +02:00
bug fix 2, now checks for ID existence
This commit is contained in:
parent
ba07683591
commit
225f3cf635
2 changed files with 8 additions and 4 deletions
10
src/git.js
10
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);
|
||||
|
|
2
todo.txt
2
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue