MCPcopy Create free account
hub / github.com/isomorphic-git/isomorphic-git / mkdir

Function mkdir

src/utils/flatFileListToDirectoryStructure.js:17–34  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

15export function flatFileListToDirectoryStructure(files) {
16 const inodes = new Map()
17 const mkdir = function (name) {
18 if (!inodes.has(name)) {
19 const dir = {
20 type: 'tree',
21 fullpath: name,
22 basename: basename(name),
23 metadata: {},
24 children: [],
25 }
26 inodes.set(name, dir)
27 // This recursively generates any missing parent folders.
28 // We do it after we've added the inode to the set so that
29 // we don't recurse infinitely trying to create the root '.' dirname.
30 dir.parent = mkdir(dirname(name))
31 if (dir.parent && dir.parent !== dir) dir.parent.children.push(dir)
32 }
33 return inodes.get(name)
34 }
35
36 const mkfile = function (name, metadata) {
37 if (!inodes.has(name)) {

Callers 2

mkfileFunction · 0.85

Calls 5

basenameFunction · 0.90
dirnameFunction · 0.90
hasMethod · 0.45
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…