SRombauts / UEGitPlugin

Unreal Engine 5 Git LFS 2 Source Control Plugin (beta)
http://srombauts.github.io/UEGitPlugin
MIT License
806 stars 165 forks source link

Smarter Sync/Pull #150

Closed dgsantana closed 2 years ago

dgsantana commented 3 years ago

Instead of trying to unload all the packages and reload, since this can crash Unreal in some cases, a more sensible is presented on this commit.

First we do a fetch, afterwards we read the changed files on index, and also check which files we have unstaged. Grab the packages for those files and unload the packages. Then the normal workflow carries on, doing the pull --rebase, and reloading the unloaded packages.

The only missing point right now is not unloading files on any local commit not yet on remote, but this should a lesser evil then unloading all the files.

David-Bulczak commented 2 years ago

Is there a chance that this one will be merged soon? Actually we are using the plugin in our project and some non-technical persons want to use source control functions exclusively in Unreal Editor (and not in some other Git Client). Unfortunately the Editor always crashes during the sync/pull action.

Here is the relevant part of the crash log:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000000000e0

UE4Editor_CoreUObject!CastChecked<UPackage,UObject>() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Public\Templates\Casts.h:259]
UE4Editor_CoreUObject!UObjectBaseUtility::GetOutermost() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectBaseUtility.cpp:198]
UE4Editor_UnrealEd!UPackageTools::UnloadPackages() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PackageTools.cpp:289]
UE4Editor_UnrealEd!UPackageTools::UnloadPackages() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PackageTools.cpp:258]
UE4Editor_GitSourceControl!FGitSourceControlMenu::ReloadPackages() [PATH_TO_OUR_GAME\Plugins\UE4GitPlugin\Source\GitSourceControl\Private\GitSourceControlMenu.cpp:167]
UE4Editor_GitSourceControl!FGitSourceControlMenu::OnSourceControlOperationComplete() [PATH_TO_OUR_GAME\Plugins\UE4GitPlugin\Source\GitSourceControl\Private\GitSourceControlMenu.cpp:449]
UE4Editor_GitSourceControl!TBaseRawMethodDelegateInstance<0,FGitSourceControlMenu,void __cdecl(TSharedRef<ISourceControlOperation,1> const &,enum ECommandResult::Type),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\Games\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:469]
UE4Editor_GitSourceControl!FGitSourceControlCommand::ReturnResults() [PATH_TO_OUR_GAME\Plugins\UE4GitPlugin\Source\GitSourceControl\Private\GitSourceControlCommand.cpp:65]
UE4Editor_GitSourceControl!FGitSourceControlProvider::Tick() [PATH_TO_OUR_GAME\Plugins\UE4GitPlugin\Source\GitSourceControl\Private\GitSourceControlProvider.cpp:366]
UE4Editor_SourceControl!FSourceControlModule::Tick() [D:\Build\++UE4\Sync\Engine\Source\Developer\SourceControl\Private\SourceControlModule.cpp:244]
UE4Editor_UnrealEd!UEditorEngine::Tick() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1892]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:426]
UE4Editor!FEngineLoop::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4836]
UE4Editor!GuardedMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:169]
UE4Editor!GuardedMainWrapper() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!WinMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll
SRombauts commented 2 years ago

Thanks a lot for this awesome contribution! I wasn't really available, but I think I should have merged it anyway.

I might have to dig into the few changes I just merged, and have to deal with the consequences ;)