change to headless to support tags and dont break all tests Pull Request #137 Issue #134

This commit is contained in:
Peter Cottle 2013-10-27 12:48:48 -07:00
parent ebfd5e84d2
commit aa39e1af3c
3 changed files with 16 additions and 0 deletions

View file

@ -70,8 +70,10 @@ var expectTreeAsync = function(command, expectedJSON, startJSON) {
console.log('\n<<<<<<<<<<<\nactual', getHeadlessSummary(headless));
console.log('\n<<<<ORIGIN>>>>>\n');
if (expected.originTree) {
console.log('expected origin tree:');
console.log(expected.originTree);
console.log('\n=========\n');
console.log('actual origin tree');
console.log(getHeadlessSummary(headless).originTree);
}
console.log(expectedJSON);

11
spec/simpleRemote.spec.js Normal file
View file

@ -0,0 +1,11 @@
var base = require('./base');
var expectTreeAsync = base.expectTreeAsync;
describe('Git Remote simple', function() {
it('clones', function() {
expectTreeAsync(
'git clone',
'{"branches":{"master":{"target":"C1","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"}},"HEAD":{"target":"master","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"}}}'
);
});
});

View file

@ -11,6 +11,7 @@ var EventBaton = require('../util/eventBaton').EventBaton;
var Collections = require('../models/collections');
var CommitCollection = Collections.CommitCollection;
var BranchCollection = Collections.BranchCollection;
var TagCollection = Collections.TagCollection;
var Command = require('../models/commandModel').Command;
var mock = require('../util/mock').mock;
@ -70,6 +71,7 @@ var HeadlessGit = function() {
HeadlessGit.prototype.init = function() {
this.commitCollection = new CommitCollection();
this.branchCollection = new BranchCollection();
this.tagCollection = new TagCollection();
// here we mock visuals and animation factory so the git engine
// is headless
@ -84,6 +86,7 @@ HeadlessGit.prototype.init = function() {
this.gitEngine = new GitEngine({
collection: this.commitCollection,
branches: this.branchCollection,
tags: this.tagCollection,
gitVisuals: gitVisuals,
animationFactory: animationFactory,
eventBaton: new EventBaton()