From 2e25d4b1c985b19b371abdbf5558d8e96b39b931 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 11 Mar 2025 12:27:35 +0800 Subject: [PATCH] Add repository_init_flag_t --- libgit2/repository.ha | 35 +++++++++++++++++++++++++++++++++++ diff --git a/libgit2/repository.ha b/libgit2/repository.ha index 1a26c63df8489cc09992487a9defb7284001ecaf..8830001d8ee704b531bdb5becb91dc23893a1b4b 100644 --- a/libgit2/repository.ha +++ b/libgit2/repository.ha @@ -16,3 +16,38 @@ free(_path); return res; }; @symbol("git_repository_init") fn _repository_init(out: *nullable *repository, path: *const c::char, is_bare: bool) int; + +// Option flags for [[repository_init_ext]]. +// +// These flags configure extra behaviors to [[repository_init_ext]]. +// In every case, the default behavior is the zero value (i.e. flag is +// not set). Just OR the flag values together for the flags parameter +// when initializing a new repo. +export type repository_init_flag_t = enum uint { + // Create a bare repository with no working directory. + REPOSITORY_INIT_BARE = (1 << 0), + + // Return an GIT_EEXISTS error if the repo_path appears to already be + // an git repository. + REPOSITORY_INIT_NO_REINIT = (1 << 1), + + // Make the repo_path (and workdir_path) as needed. Init is always willing + // to create the ".git" directory even without this flag. This flag tells + // init to create the trailing component of the repo and workdir paths + // as needed. + REPOSITORY_INIT_MKDIR = (1 << 3), + + // Recursively make all components of the repo and workdir paths as + // necessary. + REPOSITORY_INIT_MKPATH = (1 << 4), + + // libgit2 normally uses internal templates to initialize a new repo. + // This flags enables external templates, looking the "template_path" from + // the options if set, or the `init.templatedir` global config if not, + // or falling back on "/usr/share/git-core/templates" if it exists. + REPOSITORY_INIT_EXTERNAL_TEMPLATE = (1 << 5), + + // If an alternate workdir is specified, use relative paths for the gitdir + // and core.worktree. + REPOSITORY_INIT_RELATIVE_GITLINK = (1 << 6), +}; -- 2.48.1