Skip to content

Commit 74e01d6

Browse files
if they are the same and dest is a directory, should error like cp behavior Signed-off-by: zhangguanzhang <[email protected]>
1 parent 69ef37b commit 74e01d6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*.test
1010
.*.swp
1111
.DS_Store
12+
.idea*
1213
# a .bashrc may be added to customize the build environment
1314
.bashrc
1415
.gopath/

pkg/archive/archive.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -1247,10 +1247,11 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
12471247
}()
12481248

12491249
options := &TarOptions{
1250-
UIDMaps: archiver.UntarIDMappings.UIDs(),
1251-
GIDMaps: archiver.UntarIDMappings.GIDs(),
1252-
ChownOpts: archiver.ChownOpts,
1253-
InUserNS: rsystem.RunningInUserNS(),
1250+
UIDMaps: archiver.UntarIDMappings.UIDs(),
1251+
GIDMaps: archiver.UntarIDMappings.GIDs(),
1252+
ChownOpts: archiver.ChownOpts,
1253+
InUserNS: rsystem.RunningInUserNS(),
1254+
NoOverwriteDirNonDir: true,
12541255
}
12551256
err = archiver.Untar(r, filepath.Dir(dst), options)
12561257
if err != nil {

0 commit comments

Comments
 (0)