KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_libgit_backend.cpp File Reference

Regression tests for LIBGIT_BACKEND, KIGIT_COMMON, GIT_INIT_HANDLER, GIT_PULL_HANDLER, GIT_PUSH_HANDLER, GIT_COMMIT_HANDLER focused on the recent Git integration bug fixes and the Amend Last Commit feature. More...

#include <qa_utils/wx_utils/unit_test_utils.h>
#include <dialogs/git/git_status_entries.h>
#include <git/git_backend.h>
#include <git/libgit_backend.h>
#include <git/kicad_git_common.h>
#include <git/kicad_git_memory.h>
#include <git/git_status_handler.h>
#include <git/project_git_utils.h>
#include <wildcards_and_files_ext.h>
#include <git/git_init_handler.h>
#include <git/git_branch_handler.h>
#include <git/git_pull_handler.h>
#include <git/git_push_handler.h>
#include <git/git_commit_handler.h>
#include <git/git_clone_handler.h>
#include <qa_utils/git_test_fixture.h>
#include <git2.h>
#include <project.h>
#include <project/project_local_settings.h>
#include <settings/settings_manager.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fstream>
#include <future>
#include <set>
#include <thread>
#include <wx/ffile.h>
#include <wx/file.h>
#include <wx/filename.h>
#include <wx/textfile.h>

Go to the source code of this file.

Classes

struct  GIT_BACKEND_FIXTURE
 Build a temp directory tree containing a local working repo with one commit and a bare "remote" repo cloned from it. More...
 
class  CLONE_CANCEL_REPORTER
 

Functions

 BOOST_AUTO_TEST_CASE (FetchHeadMarksAtMostOneBranchToMerge)
 
 BOOST_AUTO_TEST_CASE (PerformPull_RefusesACommitThatBringsGitLfs)
 
 BOOST_AUTO_TEST_CASE (PushProgressStopsWhenTheOperationIsCancelled)
 
 BOOST_AUTO_TEST_CASE (IsWithinProjectPath_ScopesToProjectDirectory)
 
 BOOST_AUTO_TEST_CASE (GetDifferentFiles_SameTreeAmendHidesAheadFiles)
 
 BOOST_AUTO_TEST_CASE (GetDifferentFiles_DifferentTreeAmendKeepsAheadFile)
 
 BOOST_AUTO_TEST_CASE (PerformPull_NoUpstreamConfig_FallbackSucceedsAndWritesUpstream)
 
 BOOST_AUTO_TEST_CASE (PerformPull_RebaseConfigReplaysLocalCommit)
 With pull.rebase set, a pull over diverged history must replay the local commit onto the remote one and leave no rebase in progress.
 
 BOOST_AUTO_TEST_CASE (Push_FirstPushSetsUpstreamTracking)
 
 BOOST_AUTO_TEST_CASE (Push_RefusesOnADetachedHead)
 
 BOOST_AUTO_TEST_CASE (Push_ReportsNonFastForwardWhenRemoteIsAhead)
 
 BOOST_AUTO_TEST_CASE (Push_ReportsErrorWhenRemoteRefusesTheUpdate)
 
 BOOST_AUTO_TEST_CASE (PerformPull_RebaseConflictLeavesRepositoryAsItWas)
 
 BOOST_AUTO_TEST_CASE (PerformPull_FastForwardFollowsConfiguredUpstreamBranch)
 
 BOOST_AUTO_TEST_CASE (PerformPull_FastForwardRollsBackWhenBranchCannotMove)
 
 BOOST_AUTO_TEST_CASE (PerformPull_RollbackKeepsAnUntrackedDirectoryItCannotIdentify)
 
 BOOST_AUTO_TEST_CASE (PerformPull_AdoptRemoteHistoryLeavesUnbornBranchOnFailedCheckout)
 
 BOOST_AUTO_TEST_CASE (PerformPull_ExplainsWhenActionLockHeld)
 
 BOOST_AUTO_TEST_CASE (PerformPull_NamesUntrackedFileBlockingFastForward)
 
 BOOST_AUTO_TEST_CASE (PerformPull_NamesUntrackedFileBlockingMerge)
 
 BOOST_AUTO_TEST_CASE (PerformPull_UnbornBranchAdoptsRemoteHistory)
 
 BOOST_AUTO_TEST_CASE (AbandonOperation_ClearsInterruptedMerge)
 
 BOOST_AUTO_TEST_CASE (AbandonOperation_KeepsWorkTheOperationDidNotTouch)
 
 BOOST_AUTO_TEST_CASE (AbandonOperation_RefusesDuringABisect)
 
 BOOST_AUTO_TEST_CASE (AbandonOperation_RefusesAnInteractiveRebaseInOurWords)
 
 BOOST_AUTO_TEST_CASE (AbandonOperation_ClearsInterruptedRebase)
 
 BOOST_AUTO_TEST_CASE (PerformPull_FastForwardRefusesOverDirtyTrackedFile)
 
 BOOST_AUTO_TEST_CASE (DiscardChangesRestoresOnlyTheGivenPaths)
 
 BOOST_AUTO_TEST_CASE (DiscardChangesMatchesPathsLiterally)
 
 BOOST_AUTO_TEST_CASE (GetFileStatusMatchesPathspecLiterally)
 
 BOOST_AUTO_TEST_CASE (HasUpstreamCommitsSeesTheRemoteMoveOn)
 
 BOOST_AUTO_TEST_CASE (Commit_RefusesConflictedRepository)
 
 BOOST_AUTO_TEST_CASE (DiscardChangesDropsStagedEntryForNeverCommittedFile)
 
 BOOST_AUTO_TEST_CASE (BusyOperationDoesNotConsumeAnotherCancellation)
 
 BOOST_AUTO_TEST_CASE (Clone_CancelFromProgressReporterStopsTheClone)
 
 BOOST_AUTO_TEST_CASE (CancelRequestedWhileQueuedAbortsTransfer)
 
 BOOST_AUTO_TEST_CASE (ShutdownRequestAbortsAnOperationThatStartsAfterIt)
 
 BOOST_AUTO_TEST_CASE (Amend_MessageOnlyRewritesHeadKeepsTree)
 
 BOOST_AUTO_TEST_CASE (Amend_StagedFileChangesTreeAndKeepsParent)
 
 BOOST_AUTO_TEST_CASE (Amend_UnbornBranchReturnsError)
 
 BOOST_AUTO_TEST_CASE (SetupRemote_PreservesSshSchemePortAndUsername)
 
 BOOST_AUTO_TEST_CASE (SetupRemote_UpdatesExistingOriginWithScpAddress)
 
 BOOST_AUTO_TEST_CASE (SetupRemote_ExtractsHttpCredentialsWithoutPersistingThem)
 
 BOOST_AUTO_TEST_CASE (SetupRemote_KeepsSeparateHttpCredentialsForImmediateFetch)
 
 BOOST_AUTO_TEST_CASE (InitializeRepository_SeedsGitignoreWithKicadEntries)
 
 BOOST_AUTO_TEST_CASE (InitializeRepository_LeavesExistingGitignoreUntouched)
 
 BOOST_AUTO_TEST_CASE (InitializeRepository_LeavesEmptyGitignoreEmpty)
 
static wxString seedProjectFile (const wxString &aDir)
 
 BOOST_AUTO_TEST_CASE (ProjectGitCommon_LazyCreateAttachRelease)
 
 BOOST_AUTO_TEST_CASE (ProjectGitCommon_ReleaseSkipsFreeWhenBackendGone)
 
 BOOST_AUTO_TEST_CASE (ProjectGitCommon_AttachOutsideRepositoryFails)
 
 BOOST_AUTO_TEST_CASE (ProjectGitCommon_AttachHonorsDisabledSetting)
 
 BOOST_AUTO_TEST_CASE (ProjectGitCommon_ReleaseDefersFreeWhileActionMutexHeld)
 
 BOOST_AUTO_TEST_CASE (CommitKeepsAPathThatIsNotARegularFile)
 
 BOOST_AUTO_TEST_CASE (IsTransientGitFile_HandlesDosPaths)
 
 BOOST_AUTO_TEST_CASE (BuildGitChangeEntries_KeepsTrackedAndStagedTransientFiles)
 
 BOOST_AUTO_TEST_CASE (WriteTreeToDir_MaterializesSubdirectoryFiles)
 
 BOOST_AUTO_TEST_CASE (MergeConflictRoundTrip)
 
 BOOST_AUTO_TEST_CASE (MergeConflictFinishesWithAnUntrackedFilePresent)
 
 BOOST_AUTO_TEST_CASE (MergeConflictRenameTakeTheirsLandsOnNewPath)
 
 BOOST_AUTO_TEST_CASE (Amend_KeepsFilesAlreadyInCommit)
 
 BOOST_AUTO_TEST_CASE (SwitchToBranch_RefusesARemoteBranch)
 
 BOOST_AUTO_TEST_CASE (SwitchToBranch_ReportsConflictOverLocalChanges)
 
 BOOST_AUTO_TEST_CASE (SwitchToBranch_ReportsConflictOverUntrackedCollision)
 
 BOOST_AUTO_TEST_CASE (Commit_RecordsDeletedFile)
 
 BOOST_AUTO_TEST_CASE (Commit_PreservesIndexEntriesOfUnselectedFiles)
 
 BOOST_AUTO_TEST_CASE (Commit_HandlesNonAsciiPaths)
 
 BOOST_AUTO_TEST_CASE (Commit_DoesNotDamageIndexWhileAnotherProcessHoldsTheLock)
 
 BOOST_AUTO_TEST_CASE (Amend_KeepsStagingWrittenByAnotherProcess)
 
 BOOST_AUTO_TEST_CASE (Commit_KeepsStagingWrittenByAnotherProcess)
 
 BOOST_AUTO_TEST_CASE (Commit_IgnoresContentStagedElsewhere)
 
 BOOST_AUTO_TEST_CASE (RestoreVersionRoundTrip)
 
 BOOST_AUTO_TEST_CASE (RestoreScopesToProjectDirectory)
 
 BOOST_AUTO_TEST_CASE (RestoreRefusesUnknownOrOutsideProject)
 
 BOOST_AUTO_TEST_CASE (RestoreRefusesUntrackedCollision)
 
 BOOST_AUTO_TEST_CASE (MergeConflictKeepsDeletion)
 
 BOOST_AUTO_TEST_CASE (WriteTreeToDir_LeavesIndexUntouched)
 

Variables

static const char * TEST_AUTHOR_NAME = "Test Author"
 
static const char * TEST_AUTHOR_EMAIL = "[email protected]"
 

Detailed Description

Regression tests for LIBGIT_BACKEND, KIGIT_COMMON, GIT_INIT_HANDLER, GIT_PULL_HANDLER, GIT_PUSH_HANDLER, GIT_COMMIT_HANDLER focused on the recent Git integration bug fixes and the Amend Last Commit feature.

Definition in file test_libgit_backend.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/76]

BOOST_AUTO_TEST_CASE ( AbandonOperation_ClearsInterruptedMerge )

◆ BOOST_AUTO_TEST_CASE() [2/76]

BOOST_AUTO_TEST_CASE ( AbandonOperation_ClearsInterruptedRebase )

◆ BOOST_AUTO_TEST_CASE() [3/76]

BOOST_AUTO_TEST_CASE ( AbandonOperation_KeepsWorkTheOperationDidNotTouch )

◆ BOOST_AUTO_TEST_CASE() [4/76]

BOOST_AUTO_TEST_CASE ( AbandonOperation_RefusesAnInteractiveRebaseInOurWords )

◆ BOOST_AUTO_TEST_CASE() [5/76]

BOOST_AUTO_TEST_CASE ( AbandonOperation_RefusesDuringABisect )

◆ BOOST_AUTO_TEST_CASE() [6/76]

BOOST_AUTO_TEST_CASE ( Amend_KeepsFilesAlreadyInCommit )

◆ BOOST_AUTO_TEST_CASE() [7/76]

BOOST_AUTO_TEST_CASE ( Amend_KeepsStagingWrittenByAnotherProcess )

◆ BOOST_AUTO_TEST_CASE() [8/76]

BOOST_AUTO_TEST_CASE ( Amend_MessageOnlyRewritesHeadKeepsTree )

◆ BOOST_AUTO_TEST_CASE() [9/76]

BOOST_AUTO_TEST_CASE ( Amend_StagedFileChangesTreeAndKeepsParent )

◆ BOOST_AUTO_TEST_CASE() [10/76]

BOOST_AUTO_TEST_CASE ( Amend_UnbornBranchReturnsError )

◆ BOOST_AUTO_TEST_CASE() [11/76]

BOOST_AUTO_TEST_CASE ( BuildGitChangeEntries_KeepsTrackedAndStagedTransientFiles )

◆ BOOST_AUTO_TEST_CASE() [12/76]

◆ BOOST_AUTO_TEST_CASE() [13/76]

◆ BOOST_AUTO_TEST_CASE() [14/76]

◆ BOOST_AUTO_TEST_CASE() [15/76]

BOOST_AUTO_TEST_CASE ( Commit_DoesNotDamageIndexWhileAnotherProcessHoldsTheLock )

◆ BOOST_AUTO_TEST_CASE() [16/76]

◆ BOOST_AUTO_TEST_CASE() [17/76]

◆ BOOST_AUTO_TEST_CASE() [18/76]

BOOST_AUTO_TEST_CASE ( Commit_KeepsStagingWrittenByAnotherProcess )

◆ BOOST_AUTO_TEST_CASE() [19/76]

◆ BOOST_AUTO_TEST_CASE() [20/76]

BOOST_AUTO_TEST_CASE ( Commit_RecordsDeletedFile )

◆ BOOST_AUTO_TEST_CASE() [21/76]

◆ BOOST_AUTO_TEST_CASE() [22/76]

BOOST_AUTO_TEST_CASE ( CommitKeepsAPathThatIsNotARegularFile )

◆ BOOST_AUTO_TEST_CASE() [23/76]

BOOST_AUTO_TEST_CASE ( DiscardChangesDropsStagedEntryForNeverCommittedFile )

◆ BOOST_AUTO_TEST_CASE() [24/76]

BOOST_AUTO_TEST_CASE ( DiscardChangesMatchesPathsLiterally )

◆ BOOST_AUTO_TEST_CASE() [25/76]

BOOST_AUTO_TEST_CASE ( DiscardChangesRestoresOnlyTheGivenPaths )

◆ BOOST_AUTO_TEST_CASE() [26/76]

BOOST_AUTO_TEST_CASE ( FetchHeadMarksAtMostOneBranchToMerge )

◆ BOOST_AUTO_TEST_CASE() [27/76]

BOOST_AUTO_TEST_CASE ( GetDifferentFiles_DifferentTreeAmendKeepsAheadFile )

Definition at line 544 of file test_libgit_backend.cpp.

References KIGIT_COMMON::GetDifferentFiles(), and git_repository.

◆ BOOST_AUTO_TEST_CASE() [28/76]

BOOST_AUTO_TEST_CASE ( GetDifferentFiles_SameTreeAmendHidesAheadFiles )

◆ BOOST_AUTO_TEST_CASE() [29/76]

BOOST_AUTO_TEST_CASE ( GetFileStatusMatchesPathspecLiterally )

◆ BOOST_AUTO_TEST_CASE() [30/76]

BOOST_AUTO_TEST_CASE ( HasUpstreamCommitsSeesTheRemoteMoveOn )

◆ BOOST_AUTO_TEST_CASE() [31/76]

BOOST_AUTO_TEST_CASE ( InitializeRepository_LeavesEmptyGitignoreEmpty )

◆ BOOST_AUTO_TEST_CASE() [32/76]

BOOST_AUTO_TEST_CASE ( InitializeRepository_LeavesExistingGitignoreUntouched )

◆ BOOST_AUTO_TEST_CASE() [33/76]

◆ BOOST_AUTO_TEST_CASE() [34/76]

BOOST_AUTO_TEST_CASE ( IsTransientGitFile_HandlesDosPaths )

Definition at line 2689 of file test_libgit_backend.cpp.

◆ BOOST_AUTO_TEST_CASE() [35/76]

BOOST_AUTO_TEST_CASE ( IsWithinProjectPath_ScopesToProjectDirectory )

◆ BOOST_AUTO_TEST_CASE() [36/76]

BOOST_AUTO_TEST_CASE ( MergeConflictFinishesWithAnUntrackedFilePresent )

◆ BOOST_AUTO_TEST_CASE() [37/76]

BOOST_AUTO_TEST_CASE ( MergeConflictKeepsDeletion )

◆ BOOST_AUTO_TEST_CASE() [38/76]

BOOST_AUTO_TEST_CASE ( MergeConflictRenameTakeTheirsLandsOnNewPath )

◆ BOOST_AUTO_TEST_CASE() [39/76]

BOOST_AUTO_TEST_CASE ( MergeConflictRoundTrip )

◆ BOOST_AUTO_TEST_CASE() [40/76]

BOOST_AUTO_TEST_CASE ( PerformPull_AdoptRemoteHistoryLeavesUnbornBranchOnFailedCheckout )

◆ BOOST_AUTO_TEST_CASE() [41/76]

BOOST_AUTO_TEST_CASE ( PerformPull_ExplainsWhenActionLockHeld )

◆ BOOST_AUTO_TEST_CASE() [42/76]

BOOST_AUTO_TEST_CASE ( PerformPull_FastForwardFollowsConfiguredUpstreamBranch )

◆ BOOST_AUTO_TEST_CASE() [43/76]

BOOST_AUTO_TEST_CASE ( PerformPull_FastForwardRefusesOverDirtyTrackedFile )

◆ BOOST_AUTO_TEST_CASE() [44/76]

BOOST_AUTO_TEST_CASE ( PerformPull_FastForwardRollsBackWhenBranchCannotMove )

◆ BOOST_AUTO_TEST_CASE() [45/76]

BOOST_AUTO_TEST_CASE ( PerformPull_NamesUntrackedFileBlockingFastForward )

◆ BOOST_AUTO_TEST_CASE() [46/76]

BOOST_AUTO_TEST_CASE ( PerformPull_NamesUntrackedFileBlockingMerge )

◆ BOOST_AUTO_TEST_CASE() [47/76]

BOOST_AUTO_TEST_CASE ( PerformPull_NoUpstreamConfig_FallbackSucceedsAndWritesUpstream )

◆ BOOST_AUTO_TEST_CASE() [48/76]

BOOST_AUTO_TEST_CASE ( PerformPull_RebaseConfigReplaysLocalCommit )

With pull.rebase set, a pull over diverged history must replay the local commit onto the remote one and leave no rebase in progress.

Definition at line 611 of file test_libgit_backend.cpp.

References BOOST_CHECK_EQUAL(), KIGIT_ERRORS::GetErrorString(), git_repository, GIT_PULL_HANDLER::PerformPull(), GIT_PUSH_HANDLER::PerformPush(), result, and Success.

◆ BOOST_AUTO_TEST_CASE() [49/76]

BOOST_AUTO_TEST_CASE ( PerformPull_RebaseConflictLeavesRepositoryAsItWas )

◆ BOOST_AUTO_TEST_CASE() [50/76]

BOOST_AUTO_TEST_CASE ( PerformPull_RefusesACommitThatBringsGitLfs )

◆ BOOST_AUTO_TEST_CASE() [51/76]

BOOST_AUTO_TEST_CASE ( PerformPull_RollbackKeepsAnUntrackedDirectoryItCannotIdentify )

◆ BOOST_AUTO_TEST_CASE() [52/76]

BOOST_AUTO_TEST_CASE ( PerformPull_UnbornBranchAdoptsRemoteHistory )

◆ BOOST_AUTO_TEST_CASE() [53/76]

BOOST_AUTO_TEST_CASE ( ProjectGitCommon_AttachHonorsDisabledSetting )

◆ BOOST_AUTO_TEST_CASE() [54/76]

BOOST_AUTO_TEST_CASE ( ProjectGitCommon_AttachOutsideRepositoryFails )

◆ BOOST_AUTO_TEST_CASE() [55/76]

BOOST_AUTO_TEST_CASE ( ProjectGitCommon_LazyCreateAttachRelease )

◆ BOOST_AUTO_TEST_CASE() [56/76]

BOOST_AUTO_TEST_CASE ( ProjectGitCommon_ReleaseDefersFreeWhileActionMutexHeld )

◆ BOOST_AUTO_TEST_CASE() [57/76]

BOOST_AUTO_TEST_CASE ( ProjectGitCommon_ReleaseSkipsFreeWhenBackendGone )

◆ BOOST_AUTO_TEST_CASE() [58/76]

BOOST_AUTO_TEST_CASE ( Push_FirstPushSetsUpstreamTracking )

◆ BOOST_AUTO_TEST_CASE() [59/76]

BOOST_AUTO_TEST_CASE ( Push_RefusesOnADetachedHead )

◆ BOOST_AUTO_TEST_CASE() [60/76]

BOOST_AUTO_TEST_CASE ( Push_ReportsErrorWhenRemoteRefusesTheUpdate )

◆ BOOST_AUTO_TEST_CASE() [61/76]

BOOST_AUTO_TEST_CASE ( Push_ReportsNonFastForwardWhenRemoteIsAhead )

◆ BOOST_AUTO_TEST_CASE() [62/76]

BOOST_AUTO_TEST_CASE ( PushProgressStopsWhenTheOperationIsCancelled )

◆ BOOST_AUTO_TEST_CASE() [63/76]

BOOST_AUTO_TEST_CASE ( RestoreRefusesUnknownOrOutsideProject )

◆ BOOST_AUTO_TEST_CASE() [64/76]

BOOST_AUTO_TEST_CASE ( RestoreRefusesUntrackedCollision )

◆ BOOST_AUTO_TEST_CASE() [65/76]

BOOST_AUTO_TEST_CASE ( RestoreScopesToProjectDirectory )

◆ BOOST_AUTO_TEST_CASE() [66/76]

BOOST_AUTO_TEST_CASE ( RestoreVersionRoundTrip )

◆ BOOST_AUTO_TEST_CASE() [67/76]

◆ BOOST_AUTO_TEST_CASE() [68/76]

BOOST_AUTO_TEST_CASE ( SetupRemote_KeepsSeparateHttpCredentialsForImmediateFetch )

◆ BOOST_AUTO_TEST_CASE() [69/76]

◆ BOOST_AUTO_TEST_CASE() [70/76]

◆ BOOST_AUTO_TEST_CASE() [71/76]

BOOST_AUTO_TEST_CASE ( ShutdownRequestAbortsAnOperationThatStartsAfterIt )

◆ BOOST_AUTO_TEST_CASE() [72/76]

BOOST_AUTO_TEST_CASE ( SwitchToBranch_RefusesARemoteBranch )

◆ BOOST_AUTO_TEST_CASE() [73/76]

BOOST_AUTO_TEST_CASE ( SwitchToBranch_ReportsConflictOverLocalChanges )

◆ BOOST_AUTO_TEST_CASE() [74/76]

BOOST_AUTO_TEST_CASE ( SwitchToBranch_ReportsConflictOverUntrackedCollision )

◆ BOOST_AUTO_TEST_CASE() [75/76]

BOOST_AUTO_TEST_CASE ( WriteTreeToDir_LeavesIndexUntouched )

◆ BOOST_AUTO_TEST_CASE() [76/76]

BOOST_AUTO_TEST_CASE ( WriteTreeToDir_MaterializesSubdirectoryFiles )

◆ seedProjectFile()

static wxString seedProjectFile ( const wxString & aDir)
static

Variable Documentation

◆ TEST_AUTHOR_EMAIL

const char* TEST_AUTHOR_EMAIL = "[email protected]"
static

◆ TEST_AUTHOR_NAME

const char* TEST_AUTHOR_NAME = "Test Author"
static