From c236850c8a23a9d0fddd82b68e6ea85cec81f3ad Mon Sep 17 00:00:00 2001 From: DiG Date: Fri, 1 Aug 2025 00:41:46 +0200 Subject: [PATCH] * Skip temporary/memory files from PackageNotIncludedInGit warning --- .../Private/GitSourceControlUtils.cpp | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/Source/GitSourceControl/Private/GitSourceControlUtils.cpp b/Source/GitSourceControl/Private/GitSourceControlUtils.cpp index 78fce09b..f4eb1fe1 100644 --- a/Source/GitSourceControl/Private/GitSourceControlUtils.cpp +++ b/Source/GitSourceControl/Private/GitSourceControlUtils.cpp @@ -128,6 +128,37 @@ void FGitLockedFilesCache::OnFileLockChanged(const FString& filePath, const FStr namespace GitSourceControlUtils { + bool IsMeantToBeSaved(const FString& InFilePath) + { + FString PackageName; + if (!FPackageName::TryConvertFilenameToLongPackageName(InFilePath, PackageName)) + { + return false; + } + + UPackage* Package = FindPackage(nullptr, *PackageName); + if (!Package) + { + // Try loading the package if it is not already loaded + Package = LoadPackage(nullptr, *PackageName, LOAD_None); + if (!Package) + { + return false; + } + } + // Ignore the packages that aren't meant to be persistent. + if (Package->HasAnyFlags(RF_Transient) || + Package->HasAnyPackageFlags(PKG_CompiledIn) || + Package->HasAnyPackageFlags(PKG_PlayInEditor) || + Package == GetTransientPackage() || + FPackageName::IsMemoryPackage(Package->GetPathName())) + { + return false; + } + + return true; + } + FString ChangeRepositoryRootIfSubmodule(TArray& AbsoluteFilePaths, const FString& PathToRepositoryRoot) { FString Ret = PathToRepositoryRoot; @@ -147,8 +178,11 @@ namespace GitSourceControlUtils if (TestPath.IsEmpty()) { // TestPath.IsEmpty() meaning is that FilePath is not git file. So it need to removed to git command file list. - PackageNotIncludedInGit.Add(FilePath); - UE_LOG(LogSourceControl, Warning, TEXT("Package file to update has included dependent file is not git or Can't find directory path for file : %s"), *FilePath); + if (IsMeantToBeSaved(FilePath)) + { + PackageNotIncludedInGit.Add(FilePath); + UE_LOG(LogSourceControl, Warning, TEXT("Package file to update has included dependent file is not git or Can't find directory path for file : %s"), *FilePath); + } break; }