예제 #1
0
int main(int argc, char *argv[])
#endif
{
	int res;
	char *at_exit_cmd;

	clar_test_init(argc, argv);

	res = git_libgit2_init();
	if (res < 0) {
		fprintf(stderr, "failed to init libgit2");
		return res;
	}

	cl_global_trace_register();
	cl_sandbox_set_search_path_defaults();

	/* Run the test suite */
	res = clar_test_run();

	clar_test_shutdown();

	cl_global_trace_disable();
	git_libgit2_shutdown();

	at_exit_cmd = getenv("CLAR_AT_EXIT");
	if (at_exit_cmd != NULL) {
		int at_exit = system(at_exit_cmd);
		return res || at_exit;
	}

	return res;
}
예제 #2
0
파일: test.c 프로젝트: nghiattran/pm
int main(int argc, char *argv[]) {
    git_libgit2_init();
    git_repository *repo = NULL;
    git_diff *diff = NULL;

    const char *repo_path = "/home/nghia/.git_packages/cache/version-checker/.git";
    fprintf(stdout, "Current working dir: %s\n", repo_path);
    int error = git_repository_open(&repo, repo_path);
    fprintf(stdout, "error: %d\n", error);
    error = git_diff_index_to_workdir(&diff, repo, NULL, NULL);
    fprintf(stdout, "error: %d\n", error);
    git_diff_print(diff, GIT_DIFF_FORMAT_PATCH, color_printer, NULL);
    git_diff_free(diff);
    git_libgit2_shutdown();
    return 0;



//    error = git_diff_index_to_workdir(&diff, repo, NULL, NULL);
//	struct opts o = {
//		GIT_DIFF_OPTIONS_INIT, GIT_DIFF_FIND_OPTIONS_INIT,
//		-1, 0, 0, GIT_DIFF_FORMAT_PATCH, NULL, NULL, "."
//	};

//	git_libgit2_init();
}
예제 #3
0
int main()
{
    git_libgit2_init();

    git_repository* rep = nullptr;

    git_remote* remote = nullptr;
    git_push_options opts = GIT_PUSH_OPTIONS_INIT;

    int error = 0;

    // git open
    git_repository_open(&rep, path);

    // take remote
    git_remote_lookup(&remote, rep, "origin");

    const char *refs[] = {"refs/heads/master:refs/heads/master"};
    git_strarray strarr = {(char**)refs, 1};

    opts.callbacks.credentials = cred_acquire_cb;
    error = git_remote_push(remote, &strarr, &opts);
    if (error < 0)
    {
        const git_error *e = giterr_last();
        std::cout << "Error: " << error << " / " << e->klass << " : " << e->message << std::endl;

        goto SHUTDOWN;
    }

SHUTDOWN:
    git_repository_free(rep);
    git_libgit2_shutdown();
}
예제 #4
0
void CacheGitDirectory::updateRef() {
  currentGitRef_ = "";
  git_repository *repo = NULL;
  git_reference *head = NULL;

  git_libgit2_init();
  int r = git_repository_open(&repo, gitRepository_.c_str());
  if (r != 0) {
    LOG(INFO) << "Cannot open git repository " << gitRepository_;
    goto cleanup;
  }

  if (git_repository_head_detached(repo)) {
    LOG(INFO) << "We are in detached state";
    goto cleanup;
  }

  r = git_repository_head(&head, repo);
  if (r != 0) {
    LOG(INFO) << "Cannot get current ref head";
    goto cleanup;
  }

  currentGitRef_ = git_reference_name(head);
  LOG(INFO) << "found ref: " << currentGitRef_;

cleanup:
  git_repository_free(repo);
  git_libgit2_shutdown();
}
예제 #5
0
파일: main.c 프로젝트: 1336/libgit2
int main(int argc, char *argv[])
#endif
{
	int res;

#if defined(GIT_MSVC_CRTDBG)
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

	_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
	_CrtSetReportMode(_CRT_ERROR,  _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
	_CrtSetReportMode(_CRT_WARN,   _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);

	_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
	_CrtSetReportFile(_CRT_ERROR,  _CRTDBG_FILE_STDERR);
	_CrtSetReportFile(_CRT_WARN,   _CRTDBG_FILE_STDERR);
#endif

	clar_test_init(argc, argv);

	git_libgit2_init();
	cl_global_trace_register();
	cl_sandbox_set_search_path_defaults();

	/* Run the test suite */
	res = clar_test_run();

	clar_test_shutdown();

	cl_global_trace_disable();
	git_libgit2_shutdown();

	return res;
}
예제 #6
0
bool CacheGitDirectory::checkIsGitRepository() const {
  git_libgit2_init();
  git_repository *repo = NULL;
  bool found = !git_repository_open(&repo, gitRepository_.c_str());
  git_repository_free(repo);
  git_libgit2_shutdown();
  return found;
}
예제 #7
0
MainWindow::~MainWindow()
{
    delete ui;
    if (repo != NULL)
    {
        git_repository_free(repo);
    }
    git_libgit2_shutdown();
}
예제 #8
0
int main(int argc, char **argv)
{
        struct stat st;
        struct timeval start, end;
        char filepath[1024], repodir[64];
        char *dirpath, *filename, *ref = NULL;

        if (argc != 3) {
                fprintf(stderr, "Usage: ./log dirpath filename\n");
                exit(-1);
        }

        dirpath = argv[1];
        filename = argv[2];
        strcpy(repodir, dirpath);
        strcat(repodir, "/.git");
        strcpy(filepath, dirpath);
        strcat(filepath, "/");
        strcat(filepath, filename);
        if (stat(filepath, &st) < 0) {
                fprintf(stderr, "Not valid file path: \"%s\"!\n", filepath);
                exit(-2);
        }

        memset(&s, 0, sizeof(s));
        s.sorting = GIT_SORT_TIME;
        s.hide = 0;
        s.repodir = strlen(repodir) > 0  ? repodir : "/tmp/git/.git";
        s.ref = ref ? ref : "refs/heads/master";

        /* Init libgit2 library */
        git_libgit2_init();

        /* Open repo. */
        check_lg2(git_repository_open_ext(&s.repo, s.repodir, 0, NULL),
                "Could not open repository", s.repodir);

	/* Create revwalker. */
        check_lg2(git_revwalk_new(&s.walker, s.repo),
                "Could not create revision walker", NULL);
        git_revwalk_sorting(s.walker, s.sorting);

        /* Show file's latest commit. */
        printf("filename: %s\n", filename);
        gettimeofday(&start, NULL);
        git_show_last_commit(filename);
        gettimeofday(&end, NULL);
        printf("time span: %ld(ms)\n", (end.tv_sec - start.tv_sec) * 1000 + \
                        (end.tv_usec - start.tv_usec) / 1000);

	git_revwalk_free(s.walker);
	git_repository_free(s.repo);
	git_libgit2_shutdown();

        return 0;
}
예제 #9
0
GitRepository::~GitRepository()
{
    if (NULL != m_signature) {
        git_signature_free(m_signature);
    }
    if (NULL != m_repo) {
        git_repository_free(m_repo);
    }
    git_libgit2_shutdown();
}
예제 #10
0
void
syncTerminate()
{
    AutoSyncLock lock(gSyncMutex);

    if (gbInitialized)
    {
        git_libgit2_shutdown();
        gbInitialized = false;
    }
}
예제 #11
0
int _tmain(int argc, _TCHAR* argv[])
{
	git_libgit2_init();
	// Since Google Mock depends on Google Test, InitGoogleMock() is
	// also responsible for initializing Google Test. Therefore there's
	// no need for calling testing::InitGoogleTest() separately.
	testing::InitGoogleMock(&argc, argv);
	int result = RUN_ALL_TESTS();
	git_libgit2_shutdown();
	return result;
}
예제 #12
0
파일: basic.c 프로젝트: ethomson/libgit2
void test_threads_basic__multiple_init(void)
{
	git_repository *nested_repo;

	git_libgit2_init();
	cl_git_pass(git_repository_open(&nested_repo, cl_fixture("testrepo.git")));
	git_repository_free(nested_repo);

	git_libgit2_shutdown();
	cl_git_pass(git_repository_open(&nested_repo, cl_fixture("testrepo.git")));
	git_repository_free(nested_repo);
}
예제 #13
0
int main(int argc, char **argv)
{
	int i;
	int return_code = 1;
	int error;
	git_repository *repo;
	struct args_info args = ARGS_INFO_INIT;
	const char *git_dir = NULL;

	if (argc < 2) {
		fprintf(stderr, "usage: %s <cmd> [repo]\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	git_libgit2_init();

	for (args.pos = 1; args.pos < args.argc; ++args.pos) {
		char *a = args.argv[args.pos];

		if (a[0] != '-') {
			/* non-arg */
			break;
		} else if (optional_str_arg(&git_dir, &args, "--git-dir", ".git")) {
			continue;
		} else if (!strcmp(a, "--")) {
			/* arg separator */
			break;
		}
	}

	/* Before running the actual command, create an instance of the local
	 * repository and pass it to the function. */

	error = git_repository_open(&repo, git_dir);
	if (error < 0)
		repo = NULL;

	for (i = 0; commands[i].name != NULL; ++i) {
		if (!strcmp(args.argv[args.pos], commands[i].name)) {
			return_code = run_command(commands[i].fn, repo, args);
			goto shutdown;
		}
	}

	fprintf(stderr, "Command not found: %s\n", argv[1]);

shutdown:
	git_repository_free(repo);

	git_libgit2_shutdown();

	return return_code;
}
예제 #14
0
//-----------------------------------------------------------------------------------------//
int AdVersion::gitInit(QString gitDirectory)
{

    int ierr;
    git_repository *repository;
    QByteArray tempData = gitDirectory.toLatin1();
    const char *cgitDirectory = tempData.data();

    git_libgit2_init();
    ierr = git_repository_init(&repository,cgitDirectory,0);
    git_repository_free(repository);
    git_libgit2_shutdown();
    return ERROR_NOERROR;
}
예제 #15
0
static void AutomationMain()
{
	// initialize the COM library
	HRESULT hr = ::CoInitialize(nullptr);
	if (FAILED(hr))
		return;

	git_libgit2_init();

	RunOutprocServer();

	git_libgit2_shutdown();

	::CoUninitialize();
}
예제 #16
0
int configctl_git_create_config_dir(char *path)
{
	int rc = 0;
	git_repository *repo = NULL;

	git_libgit2_init();

	git_repository_init(&repo, path, 0);
	rc = create_initial_commit(repo);

	git_repository_free(repo);
	git_libgit2_shutdown();

	return rc;
}
예제 #17
0
bool shutdownLibQGit2() {
    bool ret = false;
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
    if (int(LibInitialized) > Uninitialized) {
#else
    if (LibInitialized.load() > Uninitialized) {
#endif
        if (LibInitialized.fetchAndAddRelaxed(-Initialized) == Initialized) {
            git_libgit2_shutdown();
            ret = true;
        }
    }
    return ret;
}

}
예제 #18
0
파일: qgit.cpp 프로젝트: bokic/gitmaster
int QGit::createLocalRepository(const QDir &path)
{
    git_repository *repo = nullptr;
    int err = 0;

    git_libgit2_init();

    err = git_repository_init(&repo, path.absolutePath().toUtf8().constData(), 0);

    if (repo)
    {
        git_repository_free(repo);
        repo = nullptr;
    }

    git_libgit2_shutdown();

    return err;
}
예제 #19
0
파일: qgit.cpp 프로젝트: bokic/gitmaster
QString QGit::getBranchNameFromPath(const QString &path)
{
    git_repository *repo = nullptr;
    git_reference *ref = nullptr;
    int result = 0;
    const char *branch = nullptr;
    QString ret;

    git_libgit2_init();

    result = git_repository_open(&repo, path.toUtf8().constData());
    if (result)
    {
        goto cleanup;
    }

    result = git_repository_head(&ref, repo);
    if (result)
    {
        goto cleanup;
    }

    git_branch_name(&branch, ref);
    ret = branch;

cleanup:
    if (ref)
    {
        git_reference_free(ref);
        ref = nullptr;
    }

    if (repo)
    {
        git_repository_free(repo);
        repo = nullptr;
    }

    git_libgit2_shutdown();

    return ret;
}
예제 #20
0
int main(int argc, char **argv) {
    if (argc < 2) {
        printf("Usage: %s <repo url>\n", argv[0]);
        return 1;
    }
    git_libgit2_init();

    git_repository *repo = NULL;
    git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
    opts.repository_cb = repository_create_memory_cb;
    const char *url = argv[1];
    const char *path = "repo";
    int error = git_clone(&repo, url, path, &opts);
    if (error) {
        fprintf(stderr, "%s\n", giterr_last()->message);
    }

    git_libgit2_shutdown();
    return 0;
}
예제 #21
0
파일: describe.c 프로젝트: AChep/libgit2
int main(int argc, char **argv)
{
	git_repository *repo;
	describe_options opts;

	git_libgit2_init();

	check_lg2(git_repository_open_ext(&repo, ".", 0, NULL),
			"Could not open repository", NULL);

	describe_options_init(&opts);
	parse_options(&opts, argc, argv);

	do_describe(repo, &opts);

	git_repository_free(repo);
	git_libgit2_shutdown();

	return 0;
}
예제 #22
0
파일: rev-list.c 프로젝트: 1336/libgit2
int main (int argc, char **argv)
{
	git_repository *repo;
	git_revwalk *walk;
	git_oid oid;
	char buf[GIT_OID_HEXSZ+1];

	git_libgit2_init();

	check_lg2(git_repository_open_ext(&repo, ".", 0, NULL), "opening repository", NULL);
	check_lg2(git_revwalk_new(&walk, repo), "allocating revwalk", NULL);
	check_lg2(revwalk_parseopts(repo, walk, argc-1, argv+1), "parsing options", NULL);

	while (!git_revwalk_next(&oid, walk)) {
		git_oid_fmt(buf, &oid);
		buf[GIT_OID_HEXSZ] = '\0';
		printf("%s\n", buf);
	}

	git_libgit2_shutdown();
	return 0;
}
void PhysiomeModelRepositoryWindowWindow::cloneWorkspace(const QString &pWorkspace)
{
    // Retrieve the name of an empty directory

    QString dirName = Core::getExistingDirectory(tr("Select Empty Directory"),
                                                 QString(), true);

    if (!dirName.isEmpty()) {
        // We have got a directory name where we can clone the workspace, so
        // clone it

        git_libgit2_init();

        git_repository *gitRepository = 0;
        QByteArray workspaceByteArray = pWorkspace.toUtf8();
        QByteArray dirNameByteArray = dirName.toUtf8();

        int res = git_clone(&gitRepository, workspaceByteArray.constData(),
                            dirNameByteArray.constData(), 0);

        if (res) {
            const git_error *gitError = giterr_last();

            QMessageBox::warning(qApp->activeWindow(),
                                 tr("Clone Workspace"),
                                 gitError?
                                     tr("Error %1: %2.").arg(QString::number(gitError->klass),
                                                             Core::formatMessage(gitError->message)):
                                     tr("An error occurred while trying to clone the workspace."),
                                 QMessageBox::Ok);
        } else if (gitRepository) {
            git_repository_free(gitRepository);
        }

        git_libgit2_shutdown();
    }
}
예제 #24
0
파일: qgit.cpp 프로젝트: bokic/gitmaster
bool QGit::isGitRepository(const QDir &path)
{
    git_repository *repo = nullptr;
    bool ret = false;
    int err = 0;

    git_libgit2_init();

    err = git_repository_open(&repo, path.absolutePath().toUtf8().constData());
    if (err == 0)
    {
        ret = true;
    }

    if (repo)
    {
        git_repository_free(repo);
        repo = nullptr;
    }

    git_libgit2_shutdown();

    return ret;
}
예제 #25
0
파일: main.c 프로젝트: tjohann/sdk_builder
int
main(int argc, char *argv[])
{
	char *conf_file = NULL;
	char *conf_dir = NULL;
	int c;

	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);

	set_program_name(&program_name, argv[0]);

	while ((c = getopt(argc, argv, "hf:d:")) != -1) {
		switch (c) {
		case 'f':
			conf_file = optarg;
			break;
		case 'd':
			conf_dir = optarg;
			break;
		case 'h':
			usage(EXIT_SUCCESS);
			break;
		default:
			fprintf(stderr, _("ERROR: no valid argument\n"));
			usage(EXIT_FAILURE);
		}
	}

	if (atexit(cleanup) != 0)
		exit(EXIT_FAILURE);

	if (conf_file == NULL)
		usage(EXIT_FAILURE);

        /*
	 * init non-gtk stuff
	 */
	git_libgit2_init();
	curl_global_init(CURL_GLOBAL_ALL);

	if (read_complete_config(conf_file, conf_dir) == 0) {
		info_msg(_("Init main sdk_config done"));
	} else {
		error_msg(_("Possible init problem: read_complete_config != 0"));
		usage(EXIT_FAILURE);
	}

	if ((is_this_a_dir(get_common_workdir()) == false) ||
	    (is_this_a_dir(get_common_workdir()) == false))
		usage(EXIT_FAILURE);

	if ((read_checksum_file()) == 0)
		info_msg(_("Read checksum file done"));
	else
		info_msg(_("%s not available or not valid"),
			 NAME_CHECKSUM_FILE);

	/*
	 * init gtk stuff
	 */
	if (!g_thread_supported())
		g_thread_init(NULL);

	gdk_threads_init();
	gdk_threads_enter();

	gtk_init(&argc, &argv);
	build_main_window();

	// lock unused buttons/menus -> not yet implemented
	lock_unused_buttons();

	/*
	 * check for some defaults to control the gui
	 */
	check_all_states();

	/*
	 * show some useful info
	 */
	show_all_infos();

	// beginn trash

	/*
	 *
	 */

	// end trash

	gtk_main();
	gdk_threads_leave();

	git_libgit2_shutdown();

	return EXIT_SUCCESS;
}
예제 #26
0
static void cleanup_cb(void *unused)
{
	(void)unused;
	git_libgit2_shutdown();
}
예제 #27
0
파일: cat-file.c 프로젝트: 1336/libgit2
/** Entry point for this command */
int main(int argc, char *argv[])
{
	git_repository *repo;
	struct opts o = { ".", NULL, 0, 0 };
	git_object *obj = NULL;
	char oidstr[GIT_OID_HEXSZ + 1];

	git_libgit2_init();

	parse_opts(&o, argc, argv);

	check_lg2(git_repository_open_ext(&repo, o.dir, 0, NULL),
			"Could not open repository", NULL);
	check_lg2(git_revparse_single(&obj, repo, o.rev),
			"Could not resolve", o.rev);

	if (o.verbose) {
		char oidstr[GIT_OID_HEXSZ + 1];
		git_oid_tostr(oidstr, sizeof(oidstr), git_object_id(obj));

		printf("%s %s\n--\n",
			git_object_type2string(git_object_type(obj)), oidstr);
	}

	switch (o.action) {
	case SHOW_TYPE:
		printf("%s\n", git_object_type2string(git_object_type(obj)));
		break;
	case SHOW_SIZE: {
		git_odb *odb;
		git_odb_object *odbobj;

		check_lg2(git_repository_odb(&odb, repo), "Could not open ODB", NULL);
		check_lg2(git_odb_read(&odbobj, odb, git_object_id(obj)),
			"Could not find obj", NULL);

		printf("%ld\n", (long)git_odb_object_size(odbobj));

		git_odb_object_free(odbobj);
		git_odb_free(odb);
		}
		break;
	case SHOW_NONE:
		/* just want return result */
		break;
	case SHOW_PRETTY:

		switch (git_object_type(obj)) {
		case GIT_OBJ_BLOB:
			show_blob((const git_blob *)obj);
			break;
		case GIT_OBJ_COMMIT:
			show_commit((const git_commit *)obj);
			break;
		case GIT_OBJ_TREE:
			show_tree((const git_tree *)obj);
			break;
		case GIT_OBJ_TAG:
			show_tag((const git_tag *)obj);
			break;
		default:
			printf("unknown %s\n", oidstr);
			break;
		}
		break;
	}

	git_object_free(obj);
	git_repository_free(repo);

	git_libgit2_shutdown();

	return 0;
}
예제 #28
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                       HINSTANCE /*hPrevInstance*/,
                       LPTSTR    lpCmdLine,
                       int       /*nCmdShow*/)
{
    SetDllDirectory(L"");
    SetTaskIDPerUUID();
    CRegStdDWORD loc = CRegStdDWORD(L"Software\\TortoiseGit\\LanguageID", 1033);
    long langId = loc;
    CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);

    CLangDll langDLL;
    hResource = langDLL.Init(L"TortoiseIDiff", langId);
    if (!hResource)
        hResource = hInstance;

    git_libgit2_init();

    CCmdLineParser parser(lpCmdLine);

    if (parser.HasKey(L"?") || parser.HasKey(L"help"))
    {
        TCHAR buf[1024] = { 0 };
        LoadString(hResource, IDS_COMMANDLINEHELP, buf, _countof(buf));
        MessageBox(nullptr, buf, L"TortoiseIDiff", MB_ICONINFORMATION);
        langDLL.Close();
        return 0;
    }


    MSG msg;
    hInst = hInstance;

    INITCOMMONCONTROLSEX used = {
        sizeof(INITCOMMONCONTROLSEX),
        ICC_STANDARD_CLASSES | ICC_BAR_CLASSES | ICC_WIN95_CLASSES
    };
    InitCommonControlsEx(&used);

    // load the cursors we need
    curHand = static_cast<HCURSOR>(LoadImage(hInst, MAKEINTRESOURCE(IDC_PANCUR), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE));
    curHandDown = static_cast<HCURSOR>(LoadImage(hInst, MAKEINTRESOURCE(IDC_PANDOWNCUR), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE));

    auto mainWindow = std::make_unique<CMainWindow>(hResource);
    mainWindow->SetRegistryPath(L"Software\\TortoiseGit\\TortoiseIDiffWindowPos");
    std::wstring leftfile = parser.HasVal(L"left") ? parser.GetVal(L"left") : L"";
    std::wstring rightfile = parser.HasVal(L"right") ? parser.GetVal(L"right") : L"";
    if ((leftfile.empty()) && (lpCmdLine[0] != 0))
    {
        int nArgs;
        LPWSTR * szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
        if (szArglist)
        {
            if (nArgs == 3)
            {
                // Four parameters:
                // [0]: Program name
                // [1]: left file
                // [2]: right file
                if (PathFileExists(szArglist[1]) && PathFileExists(szArglist[2]))
                {
                    leftfile = szArglist[1];
                    rightfile = szArglist[2];
                }
            }
        }

        // Free memory allocated for CommandLineToArgvW arguments.
        LocalFree(szArglist);
    }
    mainWindow->SetLeft(leftfile.c_str(), parser.HasVal(L"lefttitle") ? parser.GetVal(L"lefttitle") : L"");
    mainWindow->SetRight(rightfile.c_str(), parser.HasVal(L"righttitle") ? parser.GetVal(L"righttitle") : L"");
    if (parser.HasVal(L"base"))
        mainWindow->SetSelectionImage(FileTypeBase, parser.GetVal(L"base"), parser.HasVal(L"basetitle") ? parser.GetVal(L"basetitle") : L"");
    if (parser.HasVal(L"mine"))
        mainWindow->SetSelectionImage(FileTypeMine, parser.GetVal(L"mine"), parser.HasVal(L"minetitle") ? parser.GetVal(L"minetitle") : L"");
    if (parser.HasVal(L"theirs"))
        mainWindow->SetSelectionImage(FileTypeTheirs, parser.GetVal(L"theirs"), parser.HasVal(L"theirstitle") ? parser.GetVal(L"theirstitle") : L"");
    if (parser.HasVal(L"result"))
        mainWindow->SetSelectionResult(parser.GetVal(L"result"));
    mainWindow->resolveMsgWnd = parser.HasVal(L"resolvemsghwnd") ? reinterpret_cast<HWND>(parser.GetLongLongVal(L"resolvemsghwnd")) : 0;
    mainWindow->resolveMsgWParam = parser.HasVal(L"resolvemsgwparam") ? static_cast<WPARAM>(parser.GetLongLongVal(L"resolvemsgwparam")) : 0;
    mainWindow->resolveMsgLParam = parser.HasVal(L"resolvemsglparam") ? static_cast<LPARAM>(parser.GetLongLongVal(L"resolvemsglparam")) : 0;
    if (mainWindow->RegisterAndCreateWindow())
    {
        HACCEL hAccelTable = LoadAccelerators(hResource, MAKEINTRESOURCE(IDR_TORTOISEIDIFF));
        if (!parser.HasVal(L"left") && parser.HasVal(L"base") && !parser.HasVal(L"mine") && !parser.HasVal(L"theirs"))
        {
            PostMessage(*mainWindow, WM_COMMAND, ID_FILE_OPEN, 0);
        }
        if (parser.HasKey(L"overlay"))
        {
            PostMessage(*mainWindow, WM_COMMAND, ID_VIEW_OVERLAPIMAGES, 0);
        }
        if (parser.HasKey(L"fit"))
        {
            PostMessage(*mainWindow, WM_COMMAND, ID_VIEW_FITIMAGEHEIGHTS, 0);
            PostMessage(*mainWindow, WM_COMMAND, ID_VIEW_FITIMAGEWIDTHS, 0);
        }
        if (parser.HasKey(L"fitwidth"))
        {
            PostMessage(*mainWindow, WM_COMMAND, ID_VIEW_FITIMAGEWIDTHS, 0);
        }
        if (parser.HasKey(L"fitheight"))
        {
            PostMessage(*mainWindow, WM_COMMAND, ID_VIEW_FITIMAGEHEIGHTS, 0);
        }
        if (parser.HasKey(L"showinfo"))
        {
            PostMessage(*mainWindow, WM_COMMAND, ID_VIEW_IMAGEINFO, 0);
        }
        // Main message loop:
        while (GetMessage(&msg, nullptr, 0, 0))
        {
            if (!TranslateAccelerator(*mainWindow, hAccelTable, &msg))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
        return static_cast<int>(msg.wParam);
    }
    langDLL.Close();
    DestroyCursor(curHand);
    DestroyCursor(curHandDown);
    CoUninitialize();
    git_libgit2_shutdown();
    return 1;
}
예제 #29
0
SyncState::~SyncState()
{
	m_thread.wait();
	git_libgit2_shutdown();
}
예제 #30
0
	~CGit2InitClass()
	{
		git_libgit2_shutdown();
		if (niData.hWnd)
			Shell_NotifyIcon(NIM_DELETE, &niData);
	}