MCPcopy Index your code
hub / github.com/devspace-sh/devspace / recursiveTar

Function recursiveTar

helper/server/tar.go:173–193  ·  view source on GitHub ↗
(basePath, relativePath string, writtenFiles map[string]bool, tw *tar.Writer, skipFolderContents bool)

Source from the content-addressed store, hash-verified

171}
172
173func recursiveTar(basePath, relativePath string, writtenFiles map[string]bool, tw *tar.Writer, skipFolderContents bool) error {
174 absFilepath := path.Join(basePath, relativePath)
175 if _, ok := writtenFiles[relativePath]; ok {
176 return nil
177 }
178
179 // We skip files that are suddenly not there anymore
180 stat, err := os.Stat(absFilepath)
181 if err != nil {
182 // File is suddenly not here anymore is ignored
183 return nil
184 }
185
186 fileInformation := createFileInformationFromStat(relativePath, stat)
187 if stat.IsDir() {
188 // Recursively tar folder
189 return tarFolder(basePath, fileInformation, writtenFiles, stat, tw, skipFolderContents)
190 }
191
192 return tarFile(basePath, fileInformation, writtenFiles, stat, tw)
193}
194
195func tarFolder(basePath string, fileInformation *fileInformation, writtenFiles map[string]bool, stat os.FileInfo, tw *tar.Writer, skipContents bool) error {
196 filepath := path.Join(basePath, fileInformation.Name)

Callers 3

tarFolderFunction · 0.70
TestUpstreamServerFunction · 0.70
compressMethod · 0.70

Calls 4

tarFolderFunction · 0.85
tarFileFunction · 0.85
IsDirMethod · 0.45

Tested by 1

TestUpstreamServerFunction · 0.56