From 86517c6ac3f78f7f2917ece7d0a7f5fd49dca59b Mon Sep 17 00:00:00 2001 From: ghidra1 Date: Thu, 14 Nov 2024 15:10:03 -0500 Subject: [PATCH] GP-5123 Corrected versioning update bug. Checked-out version recorded on server was not properly updated. --- .../ghidra/framework/data/GhidraFileData.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/data/GhidraFileData.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/data/GhidraFileData.java index 17b258fb66..de9689b451 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/data/GhidraFileData.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/data/GhidraFileData.java @@ -1522,6 +1522,8 @@ public class GhidraFileData { monitor.setMessage("Updating local checkout file..."); } folderItem.updateCheckout(versionedFolderItem, !quickCheckin, monitor); + versionedFolderItem.updateCheckoutVersion(folderItem.getCheckoutId(), + folderItem.getCheckoutVersion(), ClientUtil.getUserName()); success = true; } finally { @@ -1929,11 +1931,14 @@ public class GhidraFileData { ContentHandler contentHandler = getContentHandler(); + long checkoutId = folderItem.getCheckoutId(); + if (!modifiedSinceCheckout()) { - // Quick merge + // Quick database update of local folder item folderItem.updateCheckout(versionedFolderItem, true, monitor); } else { + // Perform interactive merge if (SystemUtilities.isInHeadlessMode()) { throw new IOException("Merge failed, merge is not supported in headless mode"); @@ -1966,7 +1971,6 @@ public class GhidraFileData { bufferFile.dispose(); } int coVer = folderItem.getCheckoutVersion(); - long checkoutId = folderItem.getCheckoutId(); tmpItem.setCheckout(checkoutId, folderItem.isCheckedOutExclusive(), mergeVer, 0); @@ -2002,13 +2006,15 @@ public class GhidraFileData { release(latestObj); } - // Update folder item + // Update local folder item using temporary file content folderItem.updateCheckout(tmpItem, mergeVer); - versionedFolderItem.updateCheckoutVersion(checkoutId, mergeVer, - ClientUtil.getUserName()); - tmpItem = null; + tmpItem = null; // update removes temporary file if successful } + // update checkout data within versioned repository + versionedFolderItem.updateCheckoutVersion(checkoutId, + folderItem.getCheckoutVersion(), ClientUtil.getUserName()); + Msg.info(this, "Updated checkout completed for " + name); if (inUseDomainObj != null) { @@ -2023,6 +2029,7 @@ public class GhidraFileData { mergeInProgress = false; try { if (tmpItem != null) { + // remove temporary merge file if error occured try { tmpItem.delete(-1, ClientUtil.getUserName()); }