Skip to content

Commit 84ca500

Browse files
authored
Merge pull request moby#4064 from jedevc/refactor-file-backend
chore: clean up file copy logic backend logic
2 parents 659fba6 + 3ac85c9 commit 84ca500

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

solver/llbsolver/file/backend.go

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -215,27 +215,22 @@ func docopy(ctx context.Context, src, dest string, action pb.FileActionCopy, u *
215215
copy.WithXAttrErrorHandler(xattrErrorHandler),
216216
}
217217

218+
var m []string
218219
if !action.AllowWildcard {
219-
if action.AttemptUnpackDockerCompatibility {
220-
if ok, err := unpack(ctx, src, srcPath, dest, destPath, ch, timestampToTime(action.Timestamp)); err != nil {
221-
return err
222-
} else if ok {
223-
return nil
224-
}
220+
m = []string{srcPath}
221+
} else {
222+
var err error
223+
m, err = copy.ResolveWildcards(src, srcPath, action.FollowSymlink)
224+
if err != nil {
225+
return err
225226
}
226-
return copy.Copy(ctx, src, srcPath, dest, destPath, opt...)
227-
}
228-
229-
m, err := copy.ResolveWildcards(src, srcPath, action.FollowSymlink)
230-
if err != nil {
231-
return err
232-
}
233227

234-
if len(m) == 0 {
235-
if action.AllowEmptyWildcard {
236-
return nil
228+
if len(m) == 0 {
229+
if action.AllowEmptyWildcard {
230+
return nil
231+
}
232+
return errors.Errorf("%s not found", srcPath)
237233
}
238-
return errors.Errorf("%s not found", srcPath)
239234
}
240235

241236
for _, s := range m {

0 commit comments

Comments
 (0)