MCPcopy
hub / github.com/docker/compose / tarArchive

Function tarArchive

internal/sync/tar.go:321–339  ·  view source on GitHub ↗
(ops []PathMapping)

Source from the content-addressed store, hash-verified

319}
320
321func tarArchive(ops []PathMapping) io.ReadCloser {
322 pr, pw := io.Pipe()
323 go func() {
324 ab := NewArchiveBuilder(pw)
325 err := ab.ArchivePathsIfExist(ops)
326 if err != nil {
327 _ = pw.CloseWithError(fmt.Errorf("adding files to tar: %w", err))
328 } else {
329 // propagate errors from the TarWriter::Close() because it performs a final
330 // Flush() and any errors mean the tar is invalid
331 if err := ab.Close(); err != nil {
332 _ = pw.CloseWithError(fmt.Errorf("closing tar: %w", err))
333 } else {
334 _ = pw.Close()
335 }
336 }
337 }()
338 return pr
339}
340
341// Dedupe the entries with last-entry-wins semantics.
342func dedupeEntries(entries []archiveEntry) []archiveEntry {

Callers 1

SyncMethod · 0.85

Calls 4

ArchivePathsIfExistMethod · 0.95
CloseMethod · 0.95
NewArchiveBuilderFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected