// Copyright (c) 2014-2020 Sebastien Rombauts (sebastien.rombauts@gmail.com) // // Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt // or copy at http://opensource.org/licenses/MIT) #pragma once #include "CoreMinimal.h" #include "ISourceControlProvider.h" #include "Misc/IQueuedWork.h" /** * Used to execute Git commands multi-threaded. */ class FGitSourceControlCommand : public IQueuedWork { public: FGitSourceControlCommand(const TSharedRef& InOperation, const TSharedRef& InWorker, const FSourceControlOperationComplete& InOperationCompleteDelegate = FSourceControlOperationComplete() ); /** * This is where the real thread work is done. All work that is done for * this queued object should be done from within the call to this function. */ bool DoWork(); /** * Tells the queued work that it is being abandoned so that it can do * per object clean up as needed. This will only be called if it is being * abandoned before completion. NOTE: This requires the object to delete * itself using whatever heap it was allocated in. */ virtual void Abandon() override; /** * This method is also used to tell the object to cleanup but not before * the object has finished it's work. */ virtual void DoThreadedWork() override; /** Save any results and call any registered callbacks. */ ECommandResult::Type ReturnResults(); public: /** Path to the Git binary */ FString PathToGitBinary; /** Path to the root of the Git repository: can be the ProjectDir itself, or any parent directory (found by the "Connect" operation) */ FString PathToRepositoryRoot; /** Tell if using the Git LFS file Locking workflow */ bool bUsingGitLfsLocking; /** Operation we want to perform - contains outward-facing parameters & results */ TSharedRef Operation; /** The object that will actually do the work */ TSharedRef Worker; /** Delegate to notify when this operation completes */ FSourceControlOperationComplete OperationCompleteDelegate; /**If true, this command has been processed by the source control thread*/ volatile int32 bExecuteProcessed; /**If true, the source control command succeeded*/ bool bCommandSuccessful; /** TODO LFS If true, the source control connection was dropped while this command was being executed*/ bool bConnectionDropped; /** Current Commit full SHA1 */ FString CommitId; /** Current Commit description's Summary */ FString CommitSummary; /** If true, this command will be automatically cleaned up in Tick() */ bool bAutoDelete; /** Whether we are running multi-treaded or not*/ EConcurrency::Type Concurrency; /** Files to perform this operation on */ TArray Files; /**Info and/or warning message storage*/ TArray InfoMessages; /**Potential error message storage*/ TArray ErrorMessages; };