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...

Public Member Functions

 GIT_BACKEND_FIXTURE ()
 
 ~GIT_BACKEND_FIXTURE ()
 
bool ready () const
 
const wxString & repoPath () 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.
 
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.
 

Private Member Functions

bool initRepoWithCommit ()
 
bool initBareRemoteFromRepo ()
 

Private Attributes

LIBGIT_BACKENDm_backend
 
wxString m_tempBase
 
wxString m_repoPath
 
wxString m_remotePath
 
bool m_ready
 

Static Private Attributes

static long s_counter = 0
 

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 57 of file test_libgit_backend.cpp.

Constructor & Destructor Documentation

◆ GIT_BACKEND_FIXTURE()

GIT_BACKEND_FIXTURE::GIT_BACKEND_FIXTURE ( )
inline

◆ ~GIT_BACKEND_FIXTURE()

GIT_BACKEND_FIXTURE::~GIT_BACKEND_FIXTURE ( )
inline

Definition at line 78 of file test_libgit_backend.cpp.

References m_backend, m_tempBase, and SetGitBackend().

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 163 of file test_libgit_backend.cpp.

References m_remotePath.

◆ 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 178 of file test_libgit_backend.cpp.

◆ 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 104 of file test_libgit_backend.cpp.

References index, m_repoPath, TEST_AUTHOR_EMAIL, and TEST_AUTHOR_NAME.

Referenced by initRepoWithCommit().

◆ initBareRemoteFromRepo()

bool GIT_BACKEND_FIXTURE::initBareRemoteFromRepo ( )
inlineprivate

Definition at line 258 of file test_libgit_backend.cpp.

References m_remotePath, and m_repoPath.

Referenced by GIT_BACKEND_FIXTURE().

◆ initRepoWithCommit()

bool GIT_BACKEND_FIXTURE::initRepoWithCommit ( )
inlineprivate

Definition at line 236 of file test_libgit_backend.cpp.

References createCommit(), m_repoPath, TEST_AUTHOR_EMAIL, and TEST_AUTHOR_NAME.

Referenced by GIT_BACKEND_FIXTURE().

◆ openRepo()

git_repository * GIT_BACKEND_FIXTURE::openRepo ( ) const
inline

Open the working repo. Caller frees with git_repository_free.

Definition at line 95 of file test_libgit_backend.cpp.

References 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 216 of file test_libgit_backend.cpp.

References result.

◆ ready()

bool GIT_BACKEND_FIXTURE::ready ( ) const
inline

Definition at line 89 of file test_libgit_backend.cpp.

References m_ready.

◆ remotePath()

const wxString & GIT_BACKEND_FIXTURE::remotePath ( ) const
inline

Definition at line 91 of file test_libgit_backend.cpp.

References m_remotePath.

◆ repoPath()

const wxString & GIT_BACKEND_FIXTURE::repoPath ( ) const
inline

Definition at line 90 of file test_libgit_backend.cpp.

References m_repoPath.

◆ 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 197 of file test_libgit_backend.cpp.

Member Data Documentation

◆ m_backend

LIBGIT_BACKEND* GIT_BACKEND_FIXTURE::m_backend
private

Definition at line 276 of file test_libgit_backend.cpp.

Referenced by GIT_BACKEND_FIXTURE(), and ~GIT_BACKEND_FIXTURE().

◆ m_ready

bool GIT_BACKEND_FIXTURE::m_ready
private

Definition at line 280 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_tempBase

wxString GIT_BACKEND_FIXTURE::m_tempBase
private

Definition at line 277 of file test_libgit_backend.cpp.

Referenced by GIT_BACKEND_FIXTURE(), and ~GIT_BACKEND_FIXTURE().

◆ s_counter

long GIT_BACKEND_FIXTURE::s_counter = 0
staticprivate

Definition at line 282 of file test_libgit_backend.cpp.

Referenced by GIT_BACKEND_FIXTURE().


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