mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +02:00
better structure
This commit is contained in:
parent
4e9e48ab4b
commit
d485120f44
1 changed files with 9 additions and 2 deletions
11
src/git.js
11
src/git.js
|
@ -48,6 +48,7 @@ GitEngine.prototype.init = function() {
|
|||
GitEngine.prototype.exportTree = function() {
|
||||
// need to export all commits, their connectivity / messages, branches, and state of head.
|
||||
// this would be simple if didn't have circular structures.... :P
|
||||
// thus, we need to loop through and "flatten" our graph of objects referencing one another
|
||||
var totalExport = {
|
||||
branches: {},
|
||||
commits: {},
|
||||
|
@ -62,8 +63,10 @@ GitEngine.prototype.exportTree = function() {
|
|||
});
|
||||
|
||||
_.each(this.commitCollection.toJSON(), function(commit) {
|
||||
commit.visNode = undefined;
|
||||
commit.children = [];
|
||||
// clear out the fields that reference objects and create circular structure
|
||||
_.each(Commit.prototype.constants.circularFields, function(field) {
|
||||
commit[field] = undefined;
|
||||
}, this);
|
||||
|
||||
// convert parents
|
||||
var parents = [];
|
||||
|
@ -1450,6 +1453,10 @@ var Commit = Backbone.Model.extend({
|
|||
gitVisuals: null
|
||||
},
|
||||
|
||||
constants: {
|
||||
circularFields: ['gitVisuals', 'visNode', 'children']
|
||||
},
|
||||
|
||||
getLogEntry: function() {
|
||||
// for now we are just joining all these things with newlines which
|
||||
// will get placed by paragraph tags. Not really a fan of this, but
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue