ok sweet progress

This commit is contained in:
Peter Cottle 2013-10-26 12:11:10 -07:00
parent db14af2fa7
commit cdd93a99e0
3 changed files with 22 additions and 11 deletions

View file

@ -1,6 +1,7 @@
var TreeCompare = require('../src/js/git/treeCompare').TreeCompare; var TreeCompare = require('../src/js/git/treeCompare').TreeCompare;
var HeadlessGit = require('../src/js/git/headless').HeadlessGit; var HeadlessGit = require('../src/js/git/headless').HeadlessGit;
var fs = require('fs');
prompt = require('prompt'); prompt = require('prompt');
prompt.start(); prompt.start();

View file

@ -283,5 +283,19 @@ describe('Git Remotes', function() {
); );
}); });
it('correctly resolves source during git fetch with params', function() {
expectTreeAsync(
'git clone; git push master:foo; git fakeTeamwork foo 2; git fetch origin foo^:blah',
'{"branches":{"master":{"target":"C1","id":"master","remoteTrackingBranchID":"o/master"},"o/master":{"target":"C1","id":"o/master","remoteTrackingBranchID":null},"o/foo":{"target":"C1","id":"o/foo","remoteTrackingBranchID":null},"blah":{"target":"C2","id":"blah","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":"C3","id":"foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"}},"HEAD":{"target":"foo","id":"HEAD"}}}'
);
});
it('correctly makes a new branch during fetch despite nothing to download', function() {
expectTreeAsync(
'git clone; git push master:foo',
'{"branches":{"master":{"target":"C1","id":"master","remoteTrackingBranchID":"o/master"},"o/master":{"target":"C1","id":"o/master","remoteTrackingBranchID":null},"o/foo":{"target":"C1","id":"o/foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"}},"HEAD":{"target":"master","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C1","id":"master","remoteTrackingBranchID":null},"foo":{"target":"C1","id":"foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"}},"HEAD":{"target":"master","id":"HEAD"}}}'
);
});
}); });

View file

@ -1135,17 +1135,13 @@ GitEngine.prototype.fetchCore = function(sourceDestPairs, options) {
commitsToMake = this.getUniqueObjects(commitsToMake); commitsToMake = this.getUniqueObjects(commitsToMake);
commitsToMake = this.descendSortDepth(commitsToMake); commitsToMake = this.descendSortDepth(commitsToMake);
if (commitsToMake.length === 0) { // now here is the tricky part -- the difference between local master
this.command.addWarning(intl.str( // and remote master might be commits C2, C3, and C4, but we
'git-error-origin-fetch-uptodate' // might already have those commits. In this case, we dont need to
)); // make them, so filter these out
// no fetch needed... commitsToMake = _.filter(commitsToMake, function(commitJSON) {
var d = Q.defer(); return !this.refs[commitJSON.id];
return { }, this);
deferred: d,
chain: d.promise
};
}
var makeCommit = _.bind(function(id, parentIDs) { var makeCommit = _.bind(function(id, parentIDs) {
// need to get the parents first. since we order by depth, we know // need to get the parents first. since we order by depth, we know