mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +02:00
more push madness
This commit is contained in:
parent
d3c0fc40a3
commit
3dd5102e2a
2 changed files with 16 additions and 1 deletions
|
@ -177,5 +177,12 @@ describe('Git Remotes', function() {
|
|||
);
|
||||
});
|
||||
|
||||
it('will prune the origin tree when deleting branches', function() {
|
||||
expectTreeAsync(
|
||||
'git checkout -b foo; git commit; git clone; git push :foo',
|
||||
'{"branches":{"master":{"target":"C1","id":"master","remoteTrackingBranchID":"o/master"},"foo":{"target":"C2","id":"foo","remoteTrackingBranchID":null},"o/master":{"target":"C1","id":"o/master","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"foo","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C1","id":"master","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"}},"HEAD":{"target":"master","id":"HEAD"}}}'
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -1011,6 +1011,7 @@ GitEngine.prototype.pushDeleteRemoteBranch = function(
|
|||
}, this);
|
||||
|
||||
// animation needs to be triggered on origin directly
|
||||
this.origin.pruneTree();
|
||||
this.origin.externalRefresh();
|
||||
};
|
||||
|
||||
|
@ -1562,7 +1563,9 @@ GitEngine.prototype.pruneTree = function() {
|
|||
// the switch sync
|
||||
return;
|
||||
}
|
||||
if (this.command) {
|
||||
this.command.addWarning(intl.str('hg-prune-tree'));
|
||||
}
|
||||
|
||||
_.each(toDelete, function(commit) {
|
||||
commit.removeFromParents();
|
||||
|
@ -2241,6 +2244,11 @@ GitEngine.prototype.deleteBranch = function(branch) {
|
|||
this.branchCollection.remove(branch);
|
||||
this.refs[branch.get('id')] = undefined;
|
||||
delete this.refs[branch.get('id')];
|
||||
// also in some cases external engines call our delete, so
|
||||
// verify integrity of HEAD here
|
||||
if (this.HEAD.get('target') === branch) {
|
||||
this.HEAD.set('target', this.refs['master']);
|
||||
}
|
||||
|
||||
if (branch.get('visBranch')) {
|
||||
branch.get('visBranch').remove();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue