Skip to content

Commit a1d518c

Browse files
author
Ahmed Bilal
committed
[IO] Fix rootcp --replace flag not working with recursive copy
The --replace flag was not being checked when copying regular objects (non-tree, non-collection) in recursive mode. This caused objects to be written with new cycles instead of replacing existing ones. Added replaceOption check in the else block of copyRootObjectRecursive() to delete existing objects before writing replacements. Fixes #7052
1 parent 4c59740 commit a1d518c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main/python/cmdLineUtils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def copyRootObjectRecursive(sourceFile, sourcePathSplit, destFile, destPathSplit
694694
obj = key.ReadObj()
695695
if replaceOption and isExisting(destFile, destPathSplit + [setName]):
696696
changeDirectory(destFile, destPathSplit)
697-
otherObj = getFromDirectory(setName)
697+
# Delete existing object before writing replacement
698698
retcodeTemp = deleteObject(destFile, destPathSplit + [setName])
699699
if retcodeTemp:
700700
retcode += retcodeTemp

0 commit comments

Comments
 (0)