mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
ok sweet progress
This commit is contained in:
parent
db14af2fa7
commit
cdd93a99e0
3 changed files with 22 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
var TreeCompare = require('../src/js/git/treeCompare').TreeCompare;
|
||||
var HeadlessGit = require('../src/js/git/headless').HeadlessGit;
|
||||
|
||||
var fs = require('fs');
|
||||
prompt = require('prompt');
|
||||
|
||||
prompt.start();
|
||||
|
|
|
@ -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"}}}'
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -1135,17 +1135,13 @@ GitEngine.prototype.fetchCore = function(sourceDestPairs, options) {
|
|||
commitsToMake = this.getUniqueObjects(commitsToMake);
|
||||
commitsToMake = this.descendSortDepth(commitsToMake);
|
||||
|
||||
if (commitsToMake.length === 0) {
|
||||
this.command.addWarning(intl.str(
|
||||
'git-error-origin-fetch-uptodate'
|
||||
));
|
||||
// no fetch needed...
|
||||
var d = Q.defer();
|
||||
return {
|
||||
deferred: d,
|
||||
chain: d.promise
|
||||
};
|
||||
}
|
||||
// now here is the tricky part -- the difference between local master
|
||||
// and remote master might be commits C2, C3, and C4, but we
|
||||
// might already have those commits. In this case, we dont need to
|
||||
// make them, so filter these out
|
||||
commitsToMake = _.filter(commitsToMake, function(commitJSON) {
|
||||
return !this.refs[commitJSON.id];
|
||||
}, this);
|
||||
|
||||
var makeCommit = _.bind(function(id, parentIDs) {
|
||||
// need to get the parents first. since we order by depth, we know
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue