InitContainer: Do not copy if init is run from siteWar

If init is run from siteWar it makes no sense to copy the file since
source = destination.

Change-Id: I2c7f287b32669537e009082ec6cab823021223d4
This commit is contained in:
Sven Selberg
2020-03-06 09:33:35 +01:00
parent 3a2038670e
commit 71f14f5e12

View File

@@ -75,7 +75,11 @@ class InitContainer implements InitStep {
final boolean copy;
final Path siteWar = site.gerrit_war;
if (Files.exists(siteWar)) {
copy = ui.yesno(true, "Upgrade %s", siteWar);
if (Files.isSameFile(siteWar, myWar)) {
copy = false;
} else {
copy = ui.yesno(true, "Upgrade %s", siteWar);
}
} else {
copy = ui.yesno(true, "Copy %s to %s", myWar.getFileName(), siteWar);
if (copy) {