KiCad PCB EDA Suite
Loading...
Searching...
No Matches
GIT_BACKEND_FIXTURE Struct Reference

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

Inheritance diagram for GIT_BACKEND_FIXTURE:
KI_TEST::GIT_TEST_FIXTURE

Public Member Functions

 GIT_BACKEND_FIXTURE ()
 
bool ready () const
 
const wxString & repoPath () const
 
const wxString & tempBase () const
 
const wxString & remotePath () const
 
git_repository * openRepo () const
 Open the working repo. Caller frees with git_repository_free.
 
git_oid createCommit (git_repository *aRepo, const wxString &aFile, const wxString &aContent, const wxString &aMessage)
 Create a new commit on the current branch from a single (path, content) pair.
 
git_oid createDetachedCommit (git_repository *aRepo, const git_oid &aParentOid, const wxString &aFile, const std::string &aContent, const char *aMessage)
 Create a commit on top of aParentOid setting aFile to aContent, without moving HEAD.
 
void writeFetchHead (const git_oid &aOid)
 Write .git/FETCH_HEAD naming aOid, as a fetch would leave it.
 
bool addOrigin (git_repository *aRepo)
 Add an origin remote pointing at the bare remote on disk.
 
bool clearUpstreamConfig (git_repository *aRepo, const wxString &aBranch)
 Drop branch.
 
bool setUpstreamConfig (git_repository *aRepo, const wxString &aBranch)
 Set branch.<aBranch>.merge = refs/heads/<aBranch>, branch.<aBranch>.remote = origin.
 
wxString readConfig (git_repository *aRepo, const wxString &aKey)
 Read a string value from the repo config, or "" if absent.
 
void useEmptyGlobalIgnore (git_repository *aRepo)
 
const wxString & TempPath () const
 
LIBGIT_BACKEND * Backend () const
 

Private Member Functions

bool initRepoWithCommit ()
 
bool initBareRemoteFromRepo ()
 

Static Private Member Functions

static wxString toWxString (const std::filesystem::path &aPath)
 

Private Attributes

wxString m_repoPath
 
wxString m_remotePath
 
bool m_ready
 
SCOPED_GIT_BACKEND m_backend
 
SCOPED_TEMP_DIR m_tempDir
 
SCOPED_TEMP_DIR m_configDir
 
SCOPED_GIT_CONFIG_SEARCH_PATH m_configSearchPath
 
wxString m_tempPath
 

Detailed Description

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

Helpers let individual tests mutate this state (additional commits, upstream config, amends, etc.).

Definition at line 76 of file test_libgit_backend.cpp.

Constructor & Destructor Documentation

◆ GIT_BACKEND_FIXTURE()

GIT_BACKEND_FIXTURE::GIT_BACKEND_FIXTURE ( )
inline

Member Function Documentation

◆ addOrigin()

bool GIT_BACKEND_FIXTURE::addOrigin ( git_repository * aRepo)
inline

Add an origin remote pointing at the bare remote on disk.

Definition at line 165 of file test_libgit_backend.cpp.

References git_repository, and m_remotePath.

◆ Backend()

LIBGIT_BACKEND * KI_TEST::GIT_TEST_FIXTURE::Backend ( ) const
inlineinherited

Definition at line 97 of file git_test_fixture.h.

References m_backend.

◆ clearUpstreamConfig()

bool GIT_BACKEND_FIXTURE::clearUpstreamConfig ( git_repository * aRepo,
const wxString & aBranch )
inline

Drop branch.

<aBranch>.merge / .remote, simulating a repo where Add Version Control wired up origin but never set per-branch upstream tracking.

Definition at line 179 of file test_libgit_backend.cpp.

References git_repository.

◆ createCommit()

git_oid GIT_BACKEND_FIXTURE::createCommit ( git_repository * aRepo,
const wxString & aFile,
const wxString & aContent,
const wxString & aMessage )
inline

Create a new commit on the current branch from a single (path, content) pair.

Definition at line 102 of file test_libgit_backend.cpp.

References KI_TEST::CommitGitFile(), git_repository, m_repoPath, and KI_TEST::WriteGitFile().

Referenced by initRepoWithCommit().

◆ createDetachedCommit()

git_oid GIT_BACKEND_FIXTURE::createDetachedCommit ( git_repository * aRepo,
const git_oid & aParentOid,
const wxString & aFile,
const std::string & aContent,
const char * aMessage )
inline

Create a commit on top of aParentOid setting aFile to aContent, without moving HEAD.

Definition at line 111 of file test_libgit_backend.cpp.

References git_repository, result, TEST_AUTHOR_EMAIL, and TEST_AUTHOR_NAME.

◆ initBareRemoteFromRepo()

bool GIT_BACKEND_FIXTURE::initBareRemoteFromRepo ( )
inlineprivate

Definition at line 263 of file test_libgit_backend.cpp.

References git_repository, m_remotePath, and m_repoPath.

Referenced by GIT_BACKEND_FIXTURE().

◆ initRepoWithCommit()

bool GIT_BACKEND_FIXTURE::initRepoWithCommit ( )
inlineprivate

◆ openRepo()

git_repository * GIT_BACKEND_FIXTURE::openRepo ( ) const
inline

Open the working repo. Caller frees with git_repository_free.

Definition at line 93 of file test_libgit_backend.cpp.

References git_repository, and m_repoPath.

◆ readConfig()

wxString GIT_BACKEND_FIXTURE::readConfig ( git_repository * aRepo,
const wxString & aKey )
inline

Read a string value from the repo config, or "" if absent.

Definition at line 217 of file test_libgit_backend.cpp.

References git_repository, and result.

◆ ready()

bool GIT_BACKEND_FIXTURE::ready ( ) const
inline

Definition at line 86 of file test_libgit_backend.cpp.

References m_ready.

◆ remotePath()

const wxString & GIT_BACKEND_FIXTURE::remotePath ( ) const
inline

Definition at line 89 of file test_libgit_backend.cpp.

References m_remotePath.

◆ repoPath()

const wxString & GIT_BACKEND_FIXTURE::repoPath ( ) const
inline

Definition at line 87 of file test_libgit_backend.cpp.

References m_repoPath.

Referenced by writeFetchHead().

◆ setUpstreamConfig()

bool GIT_BACKEND_FIXTURE::setUpstreamConfig ( git_repository * aRepo,
const wxString & aBranch )
inline

Set branch.<aBranch>.merge = refs/heads/<aBranch>, branch.<aBranch>.remote = origin.

Definition at line 198 of file test_libgit_backend.cpp.

References git_repository.

◆ tempBase()

const wxString & GIT_BACKEND_FIXTURE::tempBase ( ) const
inline

Definition at line 88 of file test_libgit_backend.cpp.

References KI_TEST::GIT_TEST_FIXTURE::TempPath().

Referenced by useEmptyGlobalIgnore().

◆ TempPath()

const wxString & KI_TEST::GIT_TEST_FIXTURE::TempPath ( ) const
inlineinherited

◆ toWxString()

static wxString KI_TEST::GIT_TEST_FIXTURE::toWxString ( const std::filesystem::path & aPath)
inlinestaticprivateinherited

Definition at line 100 of file git_test_fixture.h.

Referenced by GIT_TEST_FIXTURE().

◆ useEmptyGlobalIgnore()

void GIT_BACKEND_FIXTURE::useEmptyGlobalIgnore ( git_repository * aRepo)
inline

Definition at line 236 of file test_libgit_backend.cpp.

References config, git_repository, path, tempBase(), and KI_TEST::WriteGitFile().

◆ writeFetchHead()

void GIT_BACKEND_FIXTURE::writeFetchHead ( const git_oid & aOid)
inline

Write .git/FETCH_HEAD naming aOid, as a fetch would leave it.

Definition at line 153 of file test_libgit_backend.cpp.

References repoPath().

Member Data Documentation

◆ m_backend

SCOPED_GIT_BACKEND KI_TEST::GIT_TEST_FIXTURE::m_backend
privateinherited

Definition at line 110 of file git_test_fixture.h.

Referenced by Backend().

◆ m_configDir

SCOPED_TEMP_DIR KI_TEST::GIT_TEST_FIXTURE::m_configDir
privateinherited

Definition at line 112 of file git_test_fixture.h.

Referenced by GIT_TEST_FIXTURE().

◆ m_configSearchPath

SCOPED_GIT_CONFIG_SEARCH_PATH KI_TEST::GIT_TEST_FIXTURE::m_configSearchPath
privateinherited

Definition at line 113 of file git_test_fixture.h.

Referenced by GIT_TEST_FIXTURE().

◆ m_ready

bool GIT_BACKEND_FIXTURE::m_ready
private

Definition at line 281 of file test_libgit_backend.cpp.

Referenced by GIT_BACKEND_FIXTURE(), and ready().

◆ m_remotePath

wxString GIT_BACKEND_FIXTURE::m_remotePath
private

◆ m_repoPath

wxString GIT_BACKEND_FIXTURE::m_repoPath
private

◆ m_tempDir

SCOPED_TEMP_DIR KI_TEST::GIT_TEST_FIXTURE::m_tempDir
privateinherited

Definition at line 111 of file git_test_fixture.h.

Referenced by GIT_TEST_FIXTURE().

◆ m_tempPath

wxString KI_TEST::GIT_TEST_FIXTURE::m_tempPath
privateinherited

Definition at line 114 of file git_test_fixture.h.

Referenced by GIT_TEST_FIXTURE(), and TempPath().


The documentation for this struct was generated from the following file: