Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase update #1090

Merged
merged 2 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions __tests__/git.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ describe('Git', function() {
);
});

it('Rebases reordered commits in their new order', function() {
return expectTreeAsync(
'gc;gc;gc;gc;git branch one C1;git branch two C1;git branch three C1;git rebase C2 three;git checkout one;git cherry-pick C4 C3 C2; git checkout two; git cherry-pick C5; git rebase two one',
'%7B%22branches%22%3A%7B%22main%22%3A%7B%22target%22%3A%22C5%22%2C%22id%22%3A%22main%22%2C%22remoteTrackingBranchID%22%3Anull%7D%2C%22one%22%3A%7B%22target%22%3A%22C2%27%27%22%2C%22id%22%3A%22one%22%2C%22remoteTrackingBranchID%22%3Anull%7D%2C%22two%22%3A%7B%22target%22%3A%22C5%27%22%2C%22id%22%3A%22two%22%2C%22remoteTrackingBranchID%22%3Anull%7D%2C%22three%22%3A%7B%22target%22%3A%22C2%22%2C%22id%22%3A%22three%22%2C%22remoteTrackingBranchID%22%3Anull%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22parents%22%3A%5B%5D%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C1%22%7D%2C%22C2%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C2%22%7D%2C%22C3%22%3A%7B%22parents%22%3A%5B%22C2%22%5D%2C%22id%22%3A%22C3%22%7D%2C%22C4%22%3A%7B%22parents%22%3A%5B%22C3%22%5D%2C%22id%22%3A%22C4%22%7D%2C%22C5%22%3A%7B%22parents%22%3A%5B%22C4%22%5D%2C%22id%22%3A%22C5%22%7D%2C%22C4%27%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C4%27%22%7D%2C%22C3%27%22%3A%7B%22parents%22%3A%5B%22C4%27%22%5D%2C%22id%22%3A%22C3%27%22%7D%2C%22C2%27%22%3A%7B%22parents%22%3A%5B%22C3%27%22%5D%2C%22id%22%3A%22C2%27%22%7D%2C%22C5%27%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C5%27%22%7D%2C%22C4%27%27%22%3A%7B%22parents%22%3A%5B%22C5%27%22%5D%2C%22id%22%3A%22C4%27%27%22%7D%2C%22C3%27%27%22%3A%7B%22parents%22%3A%5B%22C4%27%27%22%5D%2C%22id%22%3A%22C3%27%27%22%7D%2C%22C2%27%27%22%3A%7B%22parents%22%3A%5B%22C3%27%27%22%5D%2C%22id%22%3A%22C2%27%27%22%7D%7D%2C%22tags%22%3A%7B%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22one%22%2C%22id%22%3A%22HEAD%22%7D%7D'
);
})

it('Switch branch and execute interactive rebase', function() {
return expectTreeAsync(
'git branch test;git rebase -i C0 test --interactive-test',
Expand Down
2 changes: 1 addition & 1 deletion src/js/git/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2190,7 +2190,7 @@ GitEngine.prototype.getUpstreamDiffSetFromSet = function(stopSet, location) {

GitEngine.prototype.getUpstreamDiffFromSet = function(stopSet, location) {
var result = Graph.bfsFromLocationWithSet(this, location, stopSet);
result.sort(this.dateSortFunc);
result.reverse();
return result;
};

Expand Down