From 3cd62699046da2499a8faac7ae0b166cb8eb2149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Mon, 11 May 2020 22:03:14 +0200 Subject: [PATCH] Add a TODO about missing setting to configure the name of the origin --- .../GitSourceControl/Private/GitSourceControlModule.h | 11 +++++++---- .../Private/GitSourceControlOperations.cpp | 11 +++++++++-- .../Private/SGitSourceControlSettings.cpp | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Source/GitSourceControl/Private/GitSourceControlModule.h b/Source/GitSourceControl/Private/GitSourceControlModule.h index 8b15f3f8..161e3dba 100644 --- a/Source/GitSourceControl/Private/GitSourceControlModule.h +++ b/Source/GitSourceControl/Private/GitSourceControlModule.h @@ -31,11 +31,14 @@ Written and contributed by Sebastien Rombauts (sebastien.rombauts@gmail.com) - migrate an asset between two projects if both are using Git - solve a merge conflict on a blueprint - show current branch name in status text -- Sync to Pull (rebase) the current branch if there is no localy modified files +- Sync to Pull (rebase) the current branch - Git LFS (Github, Gitlab, Bitbucket) is working with Git 2.10+ under Windows - Git LFS 2 File Locking is working with Git 2.10+ and Git LFS 2.0.0 - Windows, Mac and Linux +### TODO +1. configure the name of the remote instead of default "origin" + ### TODO LFS 2.x File Locking Known issues: @@ -51,7 +54,7 @@ Use "TODO LFS" in the code to track things left to do/improve/refactor: is not working after Git LFS 2 has switched "read-only" flag on files (which needs the Checkout operation to be editable)! - temporarily deactivating locks may be required if we want to be able to work while not connected (do we really need this ???) - does Git LFS have a command to do this deactivation ? - - perhaps should we rely on detection of such flags to detect LFS 2 usage (ie the need to do a checkout) + - perhaps should we rely on detection of such flags to detect LFS 2 usage (ie. the need to do a checkout) - see SubversionSourceControl plugin that deals with such flags - this would need a rework of the way the "bIsUsingFileLocking" si propagated, since this would no more be a configuration (or not only) but a file state - else we should at least revert those read-only flags when going out of "Lock mode" @@ -64,9 +67,9 @@ Use "TODO LFS" in the code to track things left to do/improve/refactor: - Configure user name & email ('git config user.name' & git config user.email') ### Known issues -- the Editor does not show deleted files (only when deleted externaly?) +- the Editor does not show deleted files (only when deleted externally?) - the Editor does not show missing files -- missing localisation for git specific messages +- missing localization for git specific messages - displaying states of 'Engine' assets (also needs management of 'out of tree' files) - renaming a Blueprint in Editor leaves a redirector file, AND modify too much the asset to enable git to track its history through renaming - standard Editor commit dialog asks if user wants to "Keep Files Checked Out" => no use for Git or Mercurial CanCheckOut()==false diff --git a/Source/GitSourceControl/Private/GitSourceControlOperations.cpp b/Source/GitSourceControl/Private/GitSourceControlOperations.cpp index 9e53953f..64c5c7b3 100644 --- a/Source/GitSourceControl/Private/GitSourceControlOperations.cpp +++ b/Source/GitSourceControl/Private/GitSourceControlOperations.cpp @@ -22,6 +22,7 @@ FName FGitPush::GetName() const FText FGitPush::GetInProgressString() const { + // TODO Configure origin return LOCTEXT("SourceControl_Push", "Pushing local commits to remote origin..."); } @@ -187,7 +188,11 @@ bool FGitCheckInWorker::Execute(FGitSourceControlCommand& InCommand) // git-lfs: push and unlock files if(InCommand.bUsingGitLfsLocking && InCommand.bCommandSuccessful) { - InCommand.bCommandSuccessful = GitSourceControlUtils::RunCommand(TEXT("push origin HEAD"), InCommand.PathToGitBinary, InCommand.PathToRepositoryRoot, TArray(), TArray(), InCommand.InfoMessages, InCommand.ErrorMessages); + TArray Parameters2; + // TODO Configure origin + Parameters2.Add(TEXT("origin")); + Parameters2.Add(TEXT("HEAD")); + InCommand.bCommandSuccessful = GitSourceControlUtils::RunCommand(TEXT("push"), InCommand.PathToGitBinary, InCommand.PathToRepositoryRoot, Parameters2, TArray(), InCommand.InfoMessages, InCommand.ErrorMessages); if(InCommand.bCommandSuccessful) { // unlock files: execute the LFS command on relative filenames @@ -379,9 +384,10 @@ FName FGitSyncWorker::GetName() const bool FGitSyncWorker::Execute(FGitSourceControlCommand& InCommand) { // pull the branch to get remote changes by rebasing any local commits (not merging them to avoid complex graphs) - // (this cannot work if any local files are modified but not commited) TArray Parameters; Parameters.Add(TEXT("--rebase")); + Parameters.Add(TEXT("--autostash")); + // TODO Configure origin Parameters.Add(TEXT("origin")); Parameters.Add(TEXT("HEAD")); InCommand.bCommandSuccessful = GitSourceControlUtils::RunCommand(TEXT("pull"), InCommand.PathToGitBinary, InCommand.PathToRepositoryRoot, Parameters, TArray(), InCommand.InfoMessages, InCommand.ErrorMessages); @@ -410,6 +416,7 @@ bool FGitPushWorker::Execute(FGitSourceControlCommand& InCommand) // (works only if the default remote "origin" is set and does not require authentication) TArray Parameters; Parameters.Add(TEXT("--set-upstream")); + // TODO Configure origin Parameters.Add(TEXT("origin")); Parameters.Add(TEXT("HEAD")); InCommand.bCommandSuccessful = GitSourceControlUtils::RunCommand(TEXT("push"), InCommand.PathToGitBinary, InCommand.PathToRepositoryRoot, Parameters, TArray(), InCommand.InfoMessages, InCommand.ErrorMessages); diff --git a/Source/GitSourceControl/Private/SGitSourceControlSettings.cpp b/Source/GitSourceControl/Private/SGitSourceControlSettings.cpp index 1dc1c40d..ce1d9abd 100644 --- a/Source/GitSourceControl/Private/SGitSourceControlSettings.cpp +++ b/Source/GitSourceControl/Private/SGitSourceControlSettings.cpp @@ -181,6 +181,7 @@ void SGitSourceControlSettings::Construct(const FArguments& InArgs) ] ] // Option to configure the URL of the default remote 'origin' + // TODO: option to configure the name of the remote instead of the default origin +SVerticalBox::Slot() .AutoHeight() .Padding(2.0f)