diff --git a/src/AppInstallerCLITests/SQLiteIndex.cpp b/src/AppInstallerCLITests/SQLiteIndex.cpp index defb5bc206..fb381ebb72 100644 --- a/src/AppInstallerCLITests/SQLiteIndex.cpp +++ b/src/AppInstallerCLITests/SQLiteIndex.cpp @@ -3918,20 +3918,20 @@ TEST_CASE("SQLiteIndex_AddOrUpdateManifest", "[sqliteindex]") { SQLiteIndex index = SQLiteIndex::Open(tempFile, SQLiteStorageBase::OpenDisposition::ReadWrite); - // Update with no updates should return false + // Update should return false REQUIRE(!index.AddOrUpdateManifest(manifest, manifestPath)); manifest.DefaultLocalization.Add("description2"); - // Update with no indexed updates should return false + // Update should return false REQUIRE(!index.AddOrUpdateManifest(manifest, manifestPath)); - // Update with indexed changes + // Update with indexed changes should still return false manifest.DefaultLocalization.Add("Test Name2"); manifest.Moniker = "testmoniker2"; manifest.DefaultLocalization.Add({ "t1", "t2", "t3" }); manifest.Installers[0].Commands = {}; - REQUIRE(index.AddOrUpdateManifest(manifest, manifestPath)); + REQUIRE(!index.AddOrUpdateManifest(manifest, manifestPath)); } } diff --git a/src/AppInstallerRepositoryCore/Microsoft/SQLiteIndex.cpp b/src/AppInstallerRepositoryCore/Microsoft/SQLiteIndex.cpp index bbd3305d81..ba4c089158 100644 --- a/src/AppInstallerRepositoryCore/Microsoft/SQLiteIndex.cpp +++ b/src/AppInstallerRepositoryCore/Microsoft/SQLiteIndex.cpp @@ -194,7 +194,8 @@ namespace AppInstaller::Repository::Microsoft if (m_interface->GetManifestIdByManifest(m_dbconn, manifest)) { - return UpdateManifestInternalHoldingLock(manifest, relativePath); + UpdateManifestInternalHoldingLock(manifest, relativePath); + return false; } else { diff --git a/src/AppInstallerRepositoryCore/Microsoft/SQLiteIndex.h b/src/AppInstallerRepositoryCore/Microsoft/SQLiteIndex.h index e60262800b..6dc3cac54e 100644 --- a/src/AppInstallerRepositoryCore/Microsoft/SQLiteIndex.h +++ b/src/AppInstallerRepositoryCore/Microsoft/SQLiteIndex.h @@ -95,15 +95,15 @@ namespace AppInstaller::Repository::Microsoft bool UpdateManifest(const Manifest::Manifest& manifest); // Adds or updates the manifest with matching { Id, Version, Channel } in the index. - // The return value indicates whether the index was modified by the function. + // The return value indicates whether the manifest was added (true) or updated (false). bool AddOrUpdateManifest(const std::filesystem::path& manifestPath, const std::filesystem::path& relativePath); // Updates the manifest with matching { Id, Version, Channel } in the index. - // The return value indicates whether the index was modified by the function. + // The return value indicates whether the manifest was added (true) or updated (false). bool AddOrUpdateManifest(const Manifest::Manifest& manifest, const std::filesystem::path& relativePath); // Updates the manifest with matching { Id, Version, Channel } in the index. - // The return value indicates whether the index was modified by the function. + // The return value indicates whether the manifest was added (true) or updated (false). bool AddOrUpdateManifest(const Manifest::Manifest& manifest); // Removes the manifest with matching { Id, Version, Channel } from the index. diff --git a/src/WinGetUtil/WinGetUtil.h b/src/WinGetUtil/WinGetUtil.h index 86a69f1c04..fe60ca77ed 100644 --- a/src/WinGetUtil/WinGetUtil.h +++ b/src/WinGetUtil/WinGetUtil.h @@ -159,7 +159,7 @@ extern "C" BOOL* indexModified); // Adds or Updates the manifest with matching { Id, Version, Channel } in the index. - // The return value indicates whether the index was modified by the function. + // The return value indicates whether the manifest was added (true) or updated (false). WINGET_UTIL_API WinGetSQLiteIndexAddOrUpdateManifest( WINGET_SQLITE_INDEX_HANDLE index, WINGET_STRING manifestPath, diff --git a/src/WinGetUtilInterop.UnitTests/APIUnitTests/SQLiteIndexUnitTests.cs b/src/WinGetUtilInterop.UnitTests/APIUnitTests/SQLiteIndexUnitTests.cs index d2ae335ac4..929562737b 100644 --- a/src/WinGetUtilInterop.UnitTests/APIUnitTests/SQLiteIndexUnitTests.cs +++ b/src/WinGetUtilInterop.UnitTests/APIUnitTests/SQLiteIndexUnitTests.cs @@ -188,13 +188,13 @@ public void AddOrUpdateManifest() { this.CreateIndexHelperForIndexTest((wrapper) => { - // Add manifest. + // Add manifest; should return true. string addManifest = Path.Combine(this.indexTestDataPath, PackageTest); - wrapper.AddOrUpdateManifest(addManifest, PackageTestRelativePath); + Assert.True(wrapper.AddOrUpdateManifest(addManifest, PackageTestRelativePath)); - // Update manifest. name is different, should return true. + // Update manifest. name is different, should return false. string updateManifest = Path.Combine(this.indexTestDataPath, PackageTestNewName); - Assert.True(wrapper.AddOrUpdateManifest(updateManifest, PackageTestRelativePath)); + Assert.False(wrapper.AddOrUpdateManifest(updateManifest, PackageTestRelativePath)); return true; }); diff --git a/src/WinGetUtilInterop/Interfaces/IWinGetSQLiteIndex.cs b/src/WinGetUtilInterop/Interfaces/IWinGetSQLiteIndex.cs index 96a5661765..15c1e30d6f 100644 --- a/src/WinGetUtilInterop/Interfaces/IWinGetSQLiteIndex.cs +++ b/src/WinGetUtilInterop/Interfaces/IWinGetSQLiteIndex.cs @@ -67,7 +67,7 @@ public interface IWinGetSQLiteIndex : IDisposable /// /// Path to manifest. /// Path of the manifest in the repository. - /// True if index was modified. + /// True if added; false if updated. bool AddOrUpdateManifest(string manifestPath, string relativePath); ///