HTTP解析器错误:libgit2中的常量字符串无效

时间:2013-07-08 15:23:10

标签: c++ libgit2

我正在尝试使用libgit2克隆git repo 但是,即使从示例中获取,下面的代码也会抛出错误。

int do_clone(git_repository *repo, string url, string path) {
    progress_data pd = {{0}};
    git_repository *cloned_repo = NULL;
    git_clone_options clone_opts = GIT_CLONE_OPTIONS_INIT;
    git_checkout_opts checkout_opts = GIT_CHECKOUT_OPTS_INIT;
    int error;
    (void) repo;
    checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
    checkout_opts.progress_cb = checkout_progress;
    checkout_opts.progress_payload = &pd;
    clone_opts.checkout_opts = checkout_opts;
    clone_opts.fetch_progress_cb = &fetch_progress;
    clone_opts.fetch_progress_payload = &pd;
    error = git_clone(&cloned_repo, url.c_str(), path.c_str(), &clone_opts);
    printf("\n");
    if (error != 0) {
        const git_error *err = giterr_last();
        if (err) printf("ERROR %s\n", err->message);
        else printf("ERROR %d: no detailed info\n", error);
    } else if (cloned_repo) git_repository_free(cloned_repo);
    return error;
}

以下是错误:

  

错误HTTP解析器错误:无效的常量字符串

有任何帮助指示吗?

0 个答案:

没有答案