KiCad PCB EDA Suite
Loading...
Searching...
No Matches
git_init_handler.cpp File Reference
#include "git_init_handler.h"
#include "git_backend.h"
#include <git/kicad_git_common.h>
#include <git/kicad_git_memory.h>
#include <paths.h>
#include <trace_helpers.h>
#include <git2.h>
#include <set>
#include <string>
#include <wx/ffile.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/tokenzr.h>

Go to the source code of this file.

Functions

static void ensureProjectGitignore (const wxString &aProjectPath)
 
static void ensureProjectGitattributes (const wxString &aProjectPath)
 
static wxString resolveKicadCliPath ()
 
static bool setConfigIfMissing (git_config *aConfig, const char *aKey, const wxString &aValue)
 
static void ensureMergeDriverConfig (const wxString &aProjectPath)
 
void ApplyKicadGitConventions (const wxString &aProjectPath)
 Apply KiCad's standard repo conventions to a project directory:
 

Function Documentation

◆ ApplyKicadGitConventions()

void ApplyKicadGitConventions ( const wxString & aProjectPath)

Apply KiCad's standard repo conventions to a project directory:

  • seed .gitignore with KiCad-generated paths
  • seed .gitattributes with merge=kicad-* lines so the in-process libgit2 drivers and external git merge both route design files
  • configure repo-local merge.kicad-*.driver / mergetool.kicad.cmd pointing at the kicad-cli binary alongside the running process

Each step is append-only: existing user content is preserved, never overwritten. Safe to call repeatedly. Used by both GIT_INIT_HANDLER (after init) and GIT_CLONE_HANDLER (after clone) so freshly-cloned repos get the same setup as freshly-init'd ones.

Definition at line 333 of file git_init_handler.cpp.

References ensureMergeDriverConfig(), ensureProjectGitattributes(), and ensureProjectGitignore().

Referenced by GIT_INIT_HANDLER::InitializeRepository(), and GIT_CLONE_HANDLER::PerformClone().

◆ ensureMergeDriverConfig()

static void ensureMergeDriverConfig ( const wxString & aProjectPath)
static

◆ ensureProjectGitattributes()

static void ensureProjectGitattributes ( const wxString & aProjectPath)
static

Definition at line 109 of file git_init_handler.cpp.

Referenced by ApplyKicadGitConventions().

◆ ensureProjectGitignore()

static void ensureProjectGitignore ( const wxString & aProjectPath)
static

Definition at line 42 of file git_init_handler.cpp.

Referenced by ApplyKicadGitConventions().

◆ resolveKicadCliPath()

static wxString resolveKicadCliPath ( )
static

Definition at line 183 of file git_init_handler.cpp.

References PATHS::ResolveSiblingExecutable().

Referenced by ensureMergeDriverConfig().

◆ setConfigIfMissing()

static bool setConfigIfMissing ( git_config * aConfig,
const char * aKey,
const wxString & aValue )
static

Definition at line 191 of file git_init_handler.cpp.

References KIGIT_COMMON::GetLastGitError(), result, and traceGit.

Referenced by ensureMergeDriverConfig().