const std = @import("std");
const git = @cImport(@cInclude("git2.h"));
pub fn main() !void {
_ = git.git_libgit2_init();
var repo: ?*git.git_repository = undefined;
_ = git.git_repository_open(&repo, ".");
var statuses: ?*git.git_status_list = undefined;
// ERROR
const opts = git.GIT_STATUS_OPTIONS_INIT;
_ = git.git_status_list_new(&statuses, repo, &opts);
var len = git.git_status_list_entrycount(statuses);
for (0..len) |i| {
var entry = git.git_status_byindex(statuses, i);
std.debug.print("{*}", .{entry});
}
_ = git.git_libgit2_shutdown();
return;
}
Trying to use GIT_STATUS_OPTIONS_INIT.
https://github.com/libgit2/libgit2/blob/main/include/git2/status.h#L265
But I'm getting the following error.
unable to translate C expr: unexpected token '{'
pub const GIT_STATUS_OPTIONS_INIT = @compileError("unable to translate C expr: unexpected token '{'"); // /usr/include/git2/status.h:265:9