Beispiel #1
0
void GitRepository::clone(const QString& url)
{
    git_repository* repo = NULL;
    git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
    opts.checkout_branch = "master";
    git_eval(git_clone(&repo, url.toLatin1(), m_local_dir_path.absolutePath().toLocal8Bit(), &opts));
    setRepository(repo);
}
Beispiel #2
0
void MainWindow::open()
{
	OpenRepositoryDialog openRepoDialog(this);
	openRepoDialog.exec();
	if (openRepoDialog.result() == QDialog::Accepted) {
		QString path = openRepoDialog.selectedRepositoryPath();
		setRepository(path);
	}
}
Beispiel #3
0
void GitRepository::init()
{
    git_repository* repo = NULL;

    git_repository_init_options initopts = GIT_REPOSITORY_INIT_OPTIONS_INIT;
    initopts.flags = GIT_REPOSITORY_INIT_MKPATH;
    git_eval(git_repository_init_ext(&repo, m_local_dir_path.absolutePath().toLocal8Bit(), &initopts));

    git_auto<git_index> index;
    git_eval(git_repository_index(&index, repo));

    git_oid tree_id;
    git_eval(git_index_write_tree(&tree_id, index));

    git_auto<git_tree> tree;
    git_eval(git_tree_lookup(&tree, repo, &tree_id));

    git_oid commit_id;
    git_eval(git_commit_create_v(&commit_id, repo, "HEAD", signature(), signature(), NULL, "Initial commit", tree, 0));

    setRepository(repo);
}
Beispiel #4
0
void GitRepository::open()
{
    git_repository* repo = NULL;
    git_eval(git_repository_open(&repo, m_local_dir_path.absolutePath().toLocal8Bit()));
    setRepository(repo);
}