Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A little cleaning #191

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GitSourceControl.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"Modules": [
{
"Name": "GitSourceControl",
"Type": "UncookedOnly",
"Type": "Editor",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my knowledge UncookedOnly is preferred

Copy link
Author

@olegkaspersky olegkaspersky Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to be able to interact with git anyhow outside of the editor?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's an expectation that source control module is available outside of the editor in many Unreal tools from Epic

Copy link
Author

@olegkaspersky olegkaspersky Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity, could you give me an example because I couldn't find any in the engine folder
or you are talking about Borealis internal tools?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many C# tools in the engine source (Programs folder) and UnrealEd commandlet use auto checkout functionality or auto submit.

"LoadingPhase": "Default"
}
]
Expand Down
2 changes: 1 addition & 1 deletion Source/GitSourceControl/Public/GitSourceControlModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class FGitSourceControlModule : public IModuleInterface
return GitSourceControlProvider;
}

GITSOURCECONTROL_API static const TArray< FString > & GetEmptyStringArray()
static const TArray< FString > & GetEmptyStringArray()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why API removed?

Copy link
Author

@olegkaspersky olegkaspersky Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how you use it internally, but in my projects, I interact with VCS through ISourceControlModule, ISourceControlProvider and UEditorAssetLibrary, UEditorAssetSubsystem in my validators and asset action utilities

So exposing such functionality seems a bit wrong architecturally, but again I'm not aware of how you use it in your code, so feel free to revert my changes

At least exposing GITSOURCECONTROL_API static const TArray< FString > & GetEmptyStringArray() seems a bit cursed

{
return EmptyStringArray;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/GitSourceControl/Public/GitSourceControlProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FGitSourceControlCommand;

DECLARE_DELEGATE_RetVal(FGitSourceControlWorkerRef, FGetGitSourceControlWorker)

/// Git version and capabilites extracted from the string "git version 2.11.0.windows.3"
/// Git version and capabilities extracted from the string "git version 2.11.0.windows.3"
struct FGitVersion
{
// Git version extracted from the string "git version 2.11.0.windows.3" (Windows), "git version 2.11.0" (Linux/Mac/Cygwin/WSL) or "git version 2.31.1.vfs.0.3" (Microsoft)
Expand All @@ -43,7 +43,7 @@ struct FGitVersion
}
};

class GITSOURCECONTROL_API FGitSourceControlProvider final : public ISourceControlProvider
class FGitSourceControlProvider final : public ISourceControlProvider
{
public:
/* ISourceControlProvider implementation */
Expand Down
2 changes: 1 addition & 1 deletion Source/GitSourceControl/Public/GitSourceControlSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "Containers/UnrealString.h"
#include "HAL/CriticalSection.h"

class GITSOURCECONTROL_API FGitSourceControlSettings
class FGitSourceControlSettings
{
public:
/** Get the Git Binary Path */
Expand Down
2 changes: 1 addition & 1 deletion Source/GitSourceControl/Public/GitSourceControlState.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct FGitState
FString HeadBranch;
};

class GITSOURCECONTROL_API FGitSourceControlState : public ISourceControlState
class FGitSourceControlState : public ISourceControlState
{
public:
explicit FGitSourceControlState(const FString &InLocalFilename) :
Expand Down
22 changes: 11 additions & 11 deletions Source/GitSourceControl/Public/GitSourceControlUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ FString FindGitBinaryPath();
/**
* Run a Git "version" command to check the availability of the binary.
* @param InPathToGitBinary The path to the Git binary
* @param OutGitVersion If provided, populate with the git version parsed from "version" command
* @param OutVersion If provided, populate with the git version parsed from "version" command
* @returns true if the command succeeded and returned no errors
*/
bool CheckGitAvailability(const FString& InPathToGitBinary, FGitVersion* OutVersion = nullptr);
Expand All @@ -96,14 +96,14 @@ bool CheckGitAvailability(const FString& InPathToGitBinary, FGitVersion* OutVers
/**
* Check git for various optional capabilities by various means.
* @param InPathToGitBinary The path to the Git binary
* @param OutGitVersion If provided, populate with the git version parsed from "version" command
* @param OutVersion If provided, populate with the git version parsed from "version" command
*/
void FindGitCapabilities(const FString& InPathToGitBinary, FGitVersion* OutVersion);

/**
* Run a Git "lfs" command to check the availability of the "Large File System" extension.
* @param InPathToGitBinary The path to the Git binary
* @param OutGitVersion If provided, populate with the git version parsed from "version" command
* @param OutVersion If provided, populate with the git version parsed from "version" command
*/
void FindGitLfsCapabilities(const FString& InPathToGitBinary, FGitVersion* OutVersion);

Expand All @@ -120,7 +120,7 @@ bool FindRootDirectory(const FString& InPath, FString& OutRepositoryRoot);
* @param InPathToGitBinary The path to the Git binary
* @param InRepositoryRoot The Git repository from where to run the command - usually the Game directory (can be empty)
* @param OutUserName Name of the Git user configured for this repository (or globaly)
* @param OutEmailName E-mail of the Git user configured for this repository (or globaly)
* @param OutUserEmail E-mail of the Git user configured for this repository (or globaly)
*/
void GetUserConfig(const FString& InPathToGitBinary, const FString& InRepositoryRoot, FString& OutUserName, FString& OutUserEmail);

Expand Down Expand Up @@ -176,7 +176,7 @@ bool GetRemoteUrl(const FString& InPathToGitBinary, const FString& InRepositoryR
* @param OutErrorMessages Any errors (from StdErr) as an array per-line
* @returns true if the command succeeded and returned no errors
*/
GITSOURCECONTROL_API bool RunCommand( const FString & InCommand, const FString & InPathToGitBinary, const FString & InRepositoryRoot, const TArray< FString > & InParameters, const TArray< FString > & InFiles, TArray< FString > & OutResults, TArray< FString > & OutErrorMessages );
bool RunCommand( const FString & InCommand, const FString & InPathToGitBinary, const FString & InRepositoryRoot, const TArray< FString > & InParameters, const TArray< FString > & InFiles, TArray< FString > & OutResults, TArray< FString > & OutErrorMessages );
bool RunCommandInternalRaw(const FString& InCommand, const FString& InPathToGitBinary, const FString& InRepositoryRoot, const TArray<FString>& InParameters, const TArray<FString>& InFiles, FString& OutResults, FString& OutErrors, const int32 ExpectedReturnCode = 0);

/**
Expand All @@ -199,7 +199,7 @@ bool ListFilesInDirectoryRecurse(const FString& InPathToGitBinary, const FString
*
* @param InPathToGitBinary The path to the Git binary
* @param InRepositoryRoot The Git repository from where to run the command - usually the Game directory
* @param InParameter The parameters to the Git commit command
* @param InParameters The parameters to the Git commit command
* @param InFiles The files to be operated on
* @param OutErrorMessages Any errors (from StdErr) as an array per-line
* @returns true if the command succeeded and returned no errors
Expand All @@ -219,7 +219,7 @@ bool RunCommit(const FString& InPathToGitBinary, const FString& InRepositoryRoot
* @param[out] InResults Results from the "status" command
* @param[out] OutStates States of files for witch the status has been gathered (distinct than InFiles in case of a "directory status")
*/
GITSOURCECONTROL_API void ParseStatusResults( const FString & InPathToGitBinary, const FString & InRepositoryRoot, const bool InUsingLfsLocking, const TArray< FString > & InFiles, const TMap< FString, FString > & InResults, TMap< FString, FGitSourceControlState > & OutStates );
void ParseStatusResults( const FString & InPathToGitBinary, const FString & InRepositoryRoot, const bool InUsingLfsLocking, const TArray< FString > & InFiles, const TMap< FString, FString > & InResults, TMap< FString, FGitSourceControlState > & OutStates );

/**
* Checks remote branches to see file differences.
Expand Down Expand Up @@ -332,13 +332,13 @@ void RemoveRedundantErrors(FGitSourceControlCommand& InCommand, const FString& I
* Helper function for various commands to update cached states.
* @returns true if any states were updated
*/
GITSOURCECONTROL_API bool UpdateCachedStates( const TMap< const FString, FGitState > & InResults );
bool UpdateCachedStates( const TMap< const FString, FGitState > & InResults );

/**
* Helper function for various commands to collect new states.
* @returns true if any states were updated
*/
GITSOURCECONTROL_API bool CollectNewStates( const TMap< FString, FGitSourceControlState > & InStates, TMap< const FString, FGitState > & OutResults );
bool CollectNewStates( const TMap< FString, FGitSourceControlState > & InStates, TMap< const FString, FGitState > & OutResults );

/**
* Helper function for various commands to collect new states.
Expand Down Expand Up @@ -372,12 +372,12 @@ bool IsFileLFSLockable(const FString& InFile);
*/
bool CheckLFSLockable(const FString& InPathToGitBinary, const FString& InRepositoryRoot, const TArray<FString>& InFiles, TArray<FString>& OutErrorMessages);

GITSOURCECONTROL_API bool FetchRemote( const FString & InPathToGitBinary, const FString & InPathToRepositoryRoot, bool InUsingGitLfsLocking, TArray< FString > & OutResults, TArray< FString > & OutErrorMessages );
bool FetchRemote( const FString & InPathToGitBinary, const FString & InPathToRepositoryRoot, bool InUsingGitLfsLocking, TArray< FString > & OutResults, TArray< FString > & OutErrorMessages );

bool PullOrigin(const FString& InPathToGitBinary, const FString& InPathToRepositoryRoot, const TArray<FString>& InFiles, TArray<FString>& OutFiles,
TArray<FString>& OutResults, TArray<FString>& OutErrorMessages);


GITSOURCECONTROL_API TSharedPtr< class ISourceControlRevision, ESPMode::ThreadSafe > GetOriginRevisionOnBranch( const FString & InPathToGitBinary, const FString & InRepositoryRoot, const FString & InRelativeFileName, TArray< FString > & OutErrorMessages, const FString & BranchName );
TSharedPtr< class ISourceControlRevision, ESPMode::ThreadSafe > GetOriginRevisionOnBranch( const FString & InPathToGitBinary, const FString & InRepositoryRoot, const FString & InRelativeFileName, TArray< FString > & OutErrorMessages, const FString & BranchName );

}