Maeln
Maeln

Reputation: 380

libgit2: Failed to resolve path when creating a repo

For a project I am working on, I am trying to use libgit2. For the moment, I am just trying to create a repo using git_repository_init but it fails with the following error message :

Error: -1/2: Failed to resolve path 'D:/Workspace/<project_name>/test/.git/': Invalid argument

The code is the following :

#include <iostream>
#include "git2.h"

int main(int argc, char *argv[])
{
    git_libgit2_init();

    git_repository *repo;
    git_repository_init_options opts = GIT_REPOSITORY_INIT_OPTIONS_INIT;
    opts.flags |= GIT_REPOSITORY_INIT_MKDIR;
    int err = git_repository_init_ext(&repo, "D:/Workspace/<project_name>/test", &opts);
    if(err < 0)
    {
        const git_error *e = giterr_last();
        std::cerr << "Error: " << err << "/" << e->klass << ": " << e->message << std::endl;
    }

    git_repository_free(repo);

    git_libgit2_shutdown();

    return 0;
}

The .git directory in the test directory is still created but it's empty. I have tried with relative and absolute path and also Unix and windows path but the result seem to always be the same.

Also, when executing libgit2_clar, a lot of test fail always with the same error : "error -1 - Failed to resolve path 'attr': Invalid argument".

libgit2 and the previous code has been compiled and executed on a Windows XP 32bit using MinGW with gcc 4.8.1.

Upvotes: 0

Views: 898

Answers (2)

Edward Thomson
Edward Thomson

Reputation: 78623

Windows XP is not supported by libgit2. Support ended in v0.21.0 in 2014:

Top-level Improvements

  • We've dropped support for Windows XP. We're evil like that.

Upvotes: 1

joni
joni

Reputation: 34

The repo_path parameter of git_repository_init_ext isn't legal because it contains the chars '<' '>' . Try to make new directory with the above chars and you get error message.

Upvotes: 0

Related Questions