mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 07:28:35 +02:00
PR #196 code cleanup and solution description rather than reordering
This commit is contained in:
parent
ffc974e03f
commit
90c39417bb
4 changed files with 27 additions and 52 deletions
|
@ -2184,26 +2184,19 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation,
|
|||
if (options.initialCommitOrdering && options.initialCommitOrdering.length > 0) {
|
||||
var rebaseMap = {};
|
||||
_.each(toRebase, function(commit) {
|
||||
var id = commit.get('id');
|
||||
rebaseMap[id] = commit;
|
||||
rebaseMap[commit.get('id')] = true;
|
||||
});
|
||||
|
||||
// Verify each chosen commit exists in the list of commits given to the user
|
||||
var extraCommits = [];
|
||||
initialCommitOrdering = [];
|
||||
_.each(options.initialCommitOrdering[0].split(','), function(id) {
|
||||
if (id in rebaseMap) {
|
||||
initialCommitOrdering.push(rebaseMap[id]);
|
||||
} else {
|
||||
extraCommits.push(id);
|
||||
if (!rebaseMap[id]) {
|
||||
throw new GitError({
|
||||
msg: intl.todo('Hey those commits dont exist in the set!')
|
||||
});
|
||||
}
|
||||
initialCommitOrdering.push(id);
|
||||
});
|
||||
|
||||
if (extraCommits.length > 0) {
|
||||
throw new GitError({
|
||||
msg: intl.todo('Hey those commits dont exist in the set!')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// The rebase view expects the commits reversed, so do that here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue