Creat hardlink if active apexes are in the same partition

Before the code compare the dev of the source, and target file.
However, since the target file hasn't been created at this time, the
code will always copy the source file instead of hard linkking.

Test: sideload train, and check whether the apex in rollback folder is a
hardlink. Run presubmit
Bug: 168562373

Change-Id: I6e5c6e0d35e4fa44d41d3d2d6fc564e5213e0092
This commit is contained in:
zhidou
2022-12-30 23:07:49 +00:00
committed by Zhi Dou
parent 6964ec7ba2
commit d1904e4b9c

View File

@@ -249,7 +249,7 @@ class RollbackStore {
targetDir.mkdirs();
File targetFile = new File(targetDir, sourceFile.getName());
boolean fallbackToCopy = !isLinkPossible(sourceFile, targetFile);
boolean fallbackToCopy = !isLinkPossible(sourceFile, targetDir);
if (!fallbackToCopy) {
try {
// Create a hard link to avoid copy