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

Function join

src/utils/join.js:126–147  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

124}
125
126export function join(...args) {
127 if (args.length === 0) return '.'
128 let joined
129 for (let i = 0; i < args.length; ++i) {
130 // Normalise separators before processing.
131 const arg = args[i].replace(/\\/g, '/')
132 if (arg.length === 0) continue
133
134 // A Windows drive-letter path (e.g. "C:/worktrees/foo") cannot be
135 // meaningfully appended to any base, so it resets the accumulator.
136 // Unix absolute paths (leading '/') are NOT reset here — that would be
137 // path.resolve() semantics; path.join('foo', '/bar') must yield 'foo/bar'.
138 if (/^[a-zA-Z]:\//.test(arg)) {
139 joined = arg
140 } else {
141 if (joined === undefined) joined = arg
142 else joined += '/' + arg
143 }
144 }
145 if (joined === undefined) return '.'
146 return normalize(joined)
147}

Callers 15

rmRecursiveFunction · 0.90
mergeTreeFunction · 0.90
_resolveFileIdFunction · 0.90
discoverGitdirFunction · 0.90
checkAndWriteBlobFunction · 0.90
applyTreeChangesFunction · 0.90
accumulateFilesFromOidFunction · 0.90
_initFunction · 0.90
_fetchFunction · 0.90
listObjectsFunction · 0.90
uploadPackFunction · 0.90
_indexPackFunction · 0.90

Calls 1

normalizeFunction · 0.85

Tested by 2

makeFixtureAsSubmoduleFunction · 0.72
useTempDirFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…