MCPcopy
hub / github.com/creationix/js-git / decodeTree

Function decodeTree

lib/object-codec.js:131–154  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

129}
130
131function decodeTree(body) {
132 var i = 0;
133 var length = body.length;
134 var start;
135 var mode;
136 var name;
137 var hash;
138 var tree = {};
139 while (i < length) {
140 start = i;
141 i = indexOf(body, 0x20, start);
142 if (i < 0) throw new SyntaxError("Missing space");
143 mode = parseOct(body, start, i++);
144 start = i;
145 i = indexOf(body, 0x00, start);
146 name = bodec.toUnicode(body, start, i++);
147 hash = bodec.toHex(body, i, i += 20);
148 tree[name] = {
149 mode: mode,
150 hash: hash
151 };
152 }
153 return tree;
154}
155
156function decodeCommit(body) {
157 var i = 0;

Callers

nothing calls this directly

Calls 2

indexOfFunction · 0.85
parseOctFunction · 0.85

Tested by

no test coverage detected