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

Function _writeObject

src/storage/writeObject.js:6–26  ·  view source on GitHub ↗
({
  fs,
  gitdir,
  type,
  object,
  format = 'content',
  oid = undefined,
  dryRun = false,
})

Source from the content-addressed store, hash-verified

4import { shasum } from '../utils/shasum.js'
5
6export async function _writeObject({
7 fs,
8 gitdir,
9 type,
10 object,
11 format = 'content',
12 oid = undefined,
13 dryRun = false,
14}) {
15 if (format !== 'deflated') {
16 if (format !== 'wrapped') {
17 object = GitObject.wrap({ type, object })
18 }
19 oid = await shasum(object)
20 object = Buffer.from(await deflate(object))
21 }
22 if (!dryRun) {
23 await writeObjectLoose({ fs, gitdir, object, format: 'deflated', oid })
24 }
25 return oid
26}

Callers 5

checkAndWriteBlobFunction · 0.90
writeBlobFunction · 0.90
writeObjectFunction · 0.90
updateIndexFunction · 0.90
addToIndexFunction · 0.90

Calls 5

shasumFunction · 0.90
deflateFunction · 0.90
writeObjectLooseFunction · 0.90
wrapMethod · 0.80
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…