40 const wxString sep = wxFileName::GetPathSeparator();
41 const wxString sourcePath = TempPath() + sep + wxS(
"source" );
42 const wxString barePath = TempPath() + sep + wxS(
"ctrl-board.git" );
43 const wxString clonePath = TempPath() + sep + wxS(
"clone" );
47 const std::pair<wxString, wxString> files[] = { { wxS(
"ctrl-board.kicad_pro" ), wxS(
"ctrl-board.kicad_pro" ) },
48 { wxS(
"gitignore.txt" ), wxS(
".gitignore" ) } };
50 for(
const auto& [src, dst] : files )
52 wxFFile in( dataDir + src, wxS(
"rb" ) );
55 BOOST_REQUIRE( in.IsOpened() && in.ReadAll( &contents, wxConvISO8859_1 ) );
64 git_clone_options options = GIT_CLONE_OPTIONS_INIT;
67 BOOST_REQUIRE_EQUAL( git_clone( &bare, wxFileSystem::FileNameToURL( wxFileName( sourcePath ) ).utf8_str(),
68 barePath.utf8_str(), &options ),
70 git_repository_free( bare );
76 handler.
SetRemote( wxFileSystem::FileNameToURL( wxFileName( barePath ) ) );
82 git_status_options statusOptions = GIT_STATUS_OPTIONS_INIT;
83 statusOptions.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
84 statusOptions.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED | GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS;
86 git_status_list* statusList =
nullptr;
92 wxFFile attributes( clonePath + sep + wxS(
".git/info/attributes" ), wxS(
"rb" ) );
93 wxString attributesText;
95 BOOST_REQUIRE( attributes.IsOpened() && attributes.ReadAll( &attributesText ) );
96 BOOST_CHECK( attributesText.Contains( wxS(
"*.kicad_pcb merge=kicad-pcb" ) ) );
97 BOOST_CHECK( attributesText.Contains( wxS(
"*.kicad_sch merge=kicad-sch" ) ) );
99 git_repository_free( common.
GetRepo() );
void WriteGitFile(const wxString &aRepoPath, const wxString &aRelativePath, const std::string &aContents)
Write test data without staging it. Create parent directories when needed.