mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-12 15:44:25 +02:00
more remote tests
This commit is contained in:
parent
04ce98fd7f
commit
d3c0fc40a3
3 changed files with 32 additions and 1 deletions
|
@ -149,6 +149,27 @@ describe('Git Remotes', function() {
|
|||
);
|
||||
});
|
||||
|
||||
it('pushes new branch onto server', function() {
|
||||
expectTreeAsync(
|
||||
'git clone; git commit; git push origin foo',
|
||||
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":"o/master"},"o/master":{"target":"C1","id":"o/master","remoteTrackingBranchID":null},"o/foo":{"target":"C2","id":"o/foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"master","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C1","id":"master","remoteTrackingBranchID":null},"foo":{"target":"C2","id":"foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"master","id":"HEAD"}}}'
|
||||
);
|
||||
});
|
||||
|
||||
it('does not push for HEAD', function() {
|
||||
expectTreeAsync(
|
||||
'git clone; git commit; git checkout C2; git push',
|
||||
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":"o/master"},"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":"C2","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"}}}'
|
||||
);
|
||||
});
|
||||
|
||||
it('does push for HEAD as a source though to a new branch', function() {
|
||||
expectTreeAsync(
|
||||
'git clone; git commit; git checkout C2; git push HEAD:foo',
|
||||
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":"o/master"},"o/master":{"target":"C1","id":"o/master","remoteTrackingBranchID":null},"o/foo":{"target":"C2","id":"o/foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"C2","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C1","id":"master","remoteTrackingBranchID":null},"foo":{"target":"C2","id":"foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"master","id":"HEAD"}}}'
|
||||
);
|
||||
});
|
||||
|
||||
it('but it cant delete master on remote', function() {
|
||||
expectTreeAsync(
|
||||
'git branch foo; git clone; git push :master',
|
||||
|
|
|
@ -167,7 +167,6 @@ var commandConfig = {
|
|||
// B) specify no args, in which case it figures out
|
||||
// the branch to fetch from the remote tracking
|
||||
// and merges those in.
|
||||
|
||||
// so lets switch on A/B here
|
||||
|
||||
var commandOptions = command.getOptionsMap();
|
||||
|
|
|
@ -876,6 +876,8 @@ GitEngine.prototype.descendSortDepth = function(objects) {
|
|||
|
||||
GitEngine.prototype.push = function(options) {
|
||||
options = options || {};
|
||||
var didMakeBranch;
|
||||
|
||||
if (options.source === "") {
|
||||
// delete case
|
||||
this.pushDeleteRemoteBranch(
|
||||
|
@ -887,6 +889,7 @@ GitEngine.prototype.push = function(options) {
|
|||
|
||||
var sourceBranch = this.refs[options.source];
|
||||
if (!this.origin.refs[options.destination]) {
|
||||
didMakeBranch = true;
|
||||
this.makeBranchOnOriginAndTrack(
|
||||
options.destination,
|
||||
'HEAD'
|
||||
|
@ -940,6 +943,14 @@ GitEngine.prototype.push = function(options) {
|
|||
var deferred = Q.defer();
|
||||
var chain = deferred.promise;
|
||||
|
||||
if (didMakeBranch) {
|
||||
chain = chain.then(_.bind(function() {
|
||||
// play something for both
|
||||
this.animationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
||||
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
||||
}, this));
|
||||
}
|
||||
|
||||
_.each(commitsToMake, function(commitJSON) {
|
||||
chain = chain.then(_.bind(function() {
|
||||
return this.animationFactory.playHighlightPromiseAnimation(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue