From 71f14f5e128e82a57a7050db1eba43d049f5102d Mon Sep 17 00:00:00 2001 From: Sven Selberg Date: Fri, 6 Mar 2020 09:33:35 +0100 Subject: [PATCH] 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 --- java/com/google/gerrit/pgm/init/InitContainer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/com/google/gerrit/pgm/init/InitContainer.java b/java/com/google/gerrit/pgm/init/InitContainer.java index dea45a710a..0b19ca3b98 100644 --- a/java/com/google/gerrit/pgm/init/InitContainer.java +++ b/java/com/google/gerrit/pgm/init/InitContainer.java @@ -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) {