Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/imh-pyth.../include/git2
File: repository.h
/*
[0] Fix | Delete
* Copyright (C) the libgit2 contributors. All rights reserved.
[1] Fix | Delete
*
[2] Fix | Delete
* This file is part of libgit2, distributed under the GNU GPL v2 with
[3] Fix | Delete
* a Linking Exception. For full terms see the included COPYING file.
[4] Fix | Delete
*/
[5] Fix | Delete
#ifndef INCLUDE_git_repository_h__
[6] Fix | Delete
#define INCLUDE_git_repository_h__
[7] Fix | Delete
[8] Fix | Delete
#include "common.h"
[9] Fix | Delete
#include "types.h"
[10] Fix | Delete
#include "oid.h"
[11] Fix | Delete
#include "buffer.h"
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* @file git2/repository.h
[15] Fix | Delete
* @brief Git repository management routines
[16] Fix | Delete
* @defgroup git_repository Git repository management routines
[17] Fix | Delete
* @ingroup Git
[18] Fix | Delete
* @{
[19] Fix | Delete
*/
[20] Fix | Delete
GIT_BEGIN_DECL
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Open a git repository.
[24] Fix | Delete
*
[25] Fix | Delete
* The 'path' argument must point to either a git repository
[26] Fix | Delete
* folder, or an existing work dir.
[27] Fix | Delete
*
[28] Fix | Delete
* The method will automatically detect if 'path' is a normal
[29] Fix | Delete
* or bare repository or fail is 'path' is neither.
[30] Fix | Delete
*
[31] Fix | Delete
* @param out pointer to the repo which will be opened
[32] Fix | Delete
* @param path the path to the repository
[33] Fix | Delete
* @return 0 or an error code
[34] Fix | Delete
*/
[35] Fix | Delete
GIT_EXTERN(int) git_repository_open(git_repository **out, const char *path);
[36] Fix | Delete
/**
[37] Fix | Delete
* Open working tree as a repository
[38] Fix | Delete
*
[39] Fix | Delete
* Open the working directory of the working tree as a normal
[40] Fix | Delete
* repository that can then be worked on.
[41] Fix | Delete
*
[42] Fix | Delete
* @param out Output pointer containing opened repository
[43] Fix | Delete
* @param wt Working tree to open
[44] Fix | Delete
* @return 0 or an error code
[45] Fix | Delete
*/
[46] Fix | Delete
GIT_EXTERN(int) git_repository_open_from_worktree(git_repository **out, git_worktree *wt);
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Create a "fake" repository to wrap an object database
[50] Fix | Delete
*
[51] Fix | Delete
* Create a repository object to wrap an object database to be used
[52] Fix | Delete
* with the API when all you have is an object database. This doesn't
[53] Fix | Delete
* have any paths associated with it, so use with care.
[54] Fix | Delete
*
[55] Fix | Delete
* @param out pointer to the repo
[56] Fix | Delete
* @param odb the object database to wrap
[57] Fix | Delete
* @return 0 or an error code
[58] Fix | Delete
*/
[59] Fix | Delete
GIT_EXTERN(int) git_repository_wrap_odb(git_repository **out, git_odb *odb);
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Look for a git repository and copy its path in the given buffer.
[63] Fix | Delete
* The lookup start from base_path and walk across parent directories
[64] Fix | Delete
* if nothing has been found. The lookup ends when the first repository
[65] Fix | Delete
* is found, or when reaching a directory referenced in ceiling_dirs
[66] Fix | Delete
* or when the filesystem changes (in case across_fs is true).
[67] Fix | Delete
*
[68] Fix | Delete
* The method will automatically detect if the repository is bare
[69] Fix | Delete
* (if there is a repository).
[70] Fix | Delete
*
[71] Fix | Delete
* @param out A pointer to a user-allocated git_buf which will contain
[72] Fix | Delete
* the found path.
[73] Fix | Delete
*
[74] Fix | Delete
* @param start_path The base path where the lookup starts.
[75] Fix | Delete
*
[76] Fix | Delete
* @param across_fs If true, then the lookup will not stop when a
[77] Fix | Delete
* filesystem device change is detected while exploring parent directories.
[78] Fix | Delete
*
[79] Fix | Delete
* @param ceiling_dirs A GIT_PATH_LIST_SEPARATOR separated list of
[80] Fix | Delete
* absolute symbolic link free paths. The lookup will stop when any
[81] Fix | Delete
* of this paths is reached. Note that the lookup always performs on
[82] Fix | Delete
* start_path no matter start_path appears in ceiling_dirs ceiling_dirs
[83] Fix | Delete
* might be NULL (which is equivalent to an empty string)
[84] Fix | Delete
*
[85] Fix | Delete
* @return 0 or an error code
[86] Fix | Delete
*/
[87] Fix | Delete
GIT_EXTERN(int) git_repository_discover(
[88] Fix | Delete
git_buf *out,
[89] Fix | Delete
const char *start_path,
[90] Fix | Delete
int across_fs,
[91] Fix | Delete
const char *ceiling_dirs);
[92] Fix | Delete
[93] Fix | Delete
/**
[94] Fix | Delete
* Option flags for `git_repository_open_ext`.
[95] Fix | Delete
*/
[96] Fix | Delete
typedef enum {
[97] Fix | Delete
/**
[98] Fix | Delete
* Only open the repository if it can be immediately found in the
[99] Fix | Delete
* start_path. Do not walk up from the start_path looking at parent
[100] Fix | Delete
* directories.
[101] Fix | Delete
*/
[102] Fix | Delete
GIT_REPOSITORY_OPEN_NO_SEARCH = (1 << 0),
[103] Fix | Delete
[104] Fix | Delete
/**
[105] Fix | Delete
* Unless this flag is set, open will not continue searching across
[106] Fix | Delete
* filesystem boundaries (i.e. when `st_dev` changes from the `stat`
[107] Fix | Delete
* system call). For example, searching in a user's home directory at
[108] Fix | Delete
* "/home/user/source/" will not return "/.git/" as the found repo if
[109] Fix | Delete
* "/" is a different filesystem than "/home".
[110] Fix | Delete
*/
[111] Fix | Delete
GIT_REPOSITORY_OPEN_CROSS_FS = (1 << 1),
[112] Fix | Delete
[113] Fix | Delete
/**
[114] Fix | Delete
* Open repository as a bare repo regardless of core.bare config, and
[115] Fix | Delete
* defer loading config file for faster setup.
[116] Fix | Delete
* Unlike `git_repository_open_bare`, this can follow gitlinks.
[117] Fix | Delete
*/
[118] Fix | Delete
GIT_REPOSITORY_OPEN_BARE = (1 << 2),
[119] Fix | Delete
[120] Fix | Delete
/**
[121] Fix | Delete
* Do not check for a repository by appending /.git to the start_path;
[122] Fix | Delete
* only open the repository if start_path itself points to the git
[123] Fix | Delete
* directory.
[124] Fix | Delete
*/
[125] Fix | Delete
GIT_REPOSITORY_OPEN_NO_DOTGIT = (1 << 3),
[126] Fix | Delete
[127] Fix | Delete
/**
[128] Fix | Delete
* Find and open a git repository, respecting the environment variables
[129] Fix | Delete
* used by the git command-line tools.
[130] Fix | Delete
* If set, `git_repository_open_ext` will ignore the other flags and
[131] Fix | Delete
* the `ceiling_dirs` argument, and will allow a NULL `path` to use
[132] Fix | Delete
* `GIT_DIR` or search from the current directory.
[133] Fix | Delete
* The search for a repository will respect $GIT_CEILING_DIRECTORIES and
[134] Fix | Delete
* $GIT_DISCOVERY_ACROSS_FILESYSTEM. The opened repository will
[135] Fix | Delete
* respect $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and
[136] Fix | Delete
* $GIT_ALTERNATE_OBJECT_DIRECTORIES.
[137] Fix | Delete
* In the future, this flag will also cause `git_repository_open_ext`
[138] Fix | Delete
* to respect $GIT_WORK_TREE and $GIT_COMMON_DIR; currently,
[139] Fix | Delete
* `git_repository_open_ext` with this flag will error out if either
[140] Fix | Delete
* $GIT_WORK_TREE or $GIT_COMMON_DIR is set.
[141] Fix | Delete
*/
[142] Fix | Delete
GIT_REPOSITORY_OPEN_FROM_ENV = (1 << 4),
[143] Fix | Delete
} git_repository_open_flag_t;
[144] Fix | Delete
[145] Fix | Delete
/**
[146] Fix | Delete
* Find and open a repository with extended controls.
[147] Fix | Delete
*
[148] Fix | Delete
* @param out Pointer to the repo which will be opened. This can
[149] Fix | Delete
* actually be NULL if you only want to use the error code to
[150] Fix | Delete
* see if a repo at this path could be opened.
[151] Fix | Delete
* @param path Path to open as git repository. If the flags
[152] Fix | Delete
* permit "searching", then this can be a path to a subdirectory
[153] Fix | Delete
* inside the working directory of the repository. May be NULL if
[154] Fix | Delete
* flags is GIT_REPOSITORY_OPEN_FROM_ENV.
[155] Fix | Delete
* @param flags A combination of the GIT_REPOSITORY_OPEN flags above.
[156] Fix | Delete
* @param ceiling_dirs A GIT_PATH_LIST_SEPARATOR delimited list of path
[157] Fix | Delete
* prefixes at which the search for a containing repository should
[158] Fix | Delete
* terminate.
[159] Fix | Delete
* @return 0 on success, GIT_ENOTFOUND if no repository could be found,
[160] Fix | Delete
* or -1 if there was a repository but open failed for some reason
[161] Fix | Delete
* (such as repo corruption or system errors).
[162] Fix | Delete
*/
[163] Fix | Delete
GIT_EXTERN(int) git_repository_open_ext(
[164] Fix | Delete
git_repository **out,
[165] Fix | Delete
const char *path,
[166] Fix | Delete
unsigned int flags,
[167] Fix | Delete
const char *ceiling_dirs);
[168] Fix | Delete
[169] Fix | Delete
/**
[170] Fix | Delete
* Open a bare repository on the serverside.
[171] Fix | Delete
*
[172] Fix | Delete
* This is a fast open for bare repositories that will come in handy
[173] Fix | Delete
* if you're e.g. hosting git repositories and need to access them
[174] Fix | Delete
* efficiently
[175] Fix | Delete
*
[176] Fix | Delete
* @param out Pointer to the repo which will be opened.
[177] Fix | Delete
* @param bare_path Direct path to the bare repository
[178] Fix | Delete
* @return 0 on success, or an error code
[179] Fix | Delete
*/
[180] Fix | Delete
GIT_EXTERN(int) git_repository_open_bare(git_repository **out, const char *bare_path);
[181] Fix | Delete
[182] Fix | Delete
/**
[183] Fix | Delete
* Free a previously allocated repository
[184] Fix | Delete
*
[185] Fix | Delete
* Note that after a repository is free'd, all the objects it has spawned
[186] Fix | Delete
* will still exist until they are manually closed by the user
[187] Fix | Delete
* with `git_object_free`, but accessing any of the attributes of
[188] Fix | Delete
* an object without a backing repository will result in undefined
[189] Fix | Delete
* behavior
[190] Fix | Delete
*
[191] Fix | Delete
* @param repo repository handle to close. If NULL nothing occurs.
[192] Fix | Delete
*/
[193] Fix | Delete
GIT_EXTERN(void) git_repository_free(git_repository *repo);
[194] Fix | Delete
[195] Fix | Delete
/**
[196] Fix | Delete
* Creates a new Git repository in the given folder.
[197] Fix | Delete
*
[198] Fix | Delete
* TODO:
[199] Fix | Delete
* - Reinit the repository
[200] Fix | Delete
*
[201] Fix | Delete
* @param out pointer to the repo which will be created or reinitialized
[202] Fix | Delete
* @param path the path to the repository
[203] Fix | Delete
* @param is_bare if true, a Git repository without a working directory is
[204] Fix | Delete
* created at the pointed path. If false, provided path will be
[205] Fix | Delete
* considered as the working directory into which the .git directory
[206] Fix | Delete
* will be created.
[207] Fix | Delete
*
[208] Fix | Delete
* @return 0 or an error code
[209] Fix | Delete
*/
[210] Fix | Delete
GIT_EXTERN(int) git_repository_init(
[211] Fix | Delete
git_repository **out,
[212] Fix | Delete
const char *path,
[213] Fix | Delete
unsigned is_bare);
[214] Fix | Delete
[215] Fix | Delete
/**
[216] Fix | Delete
* Option flags for `git_repository_init_ext`.
[217] Fix | Delete
*
[218] Fix | Delete
* These flags configure extra behaviors to `git_repository_init_ext`.
[219] Fix | Delete
* In every case, the default behavior is the zero value (i.e. flag is
[220] Fix | Delete
* not set). Just OR the flag values together for the `flags` parameter
[221] Fix | Delete
* when initializing a new repo. Details of individual values are:
[222] Fix | Delete
*
[223] Fix | Delete
* * BARE - Create a bare repository with no working directory.
[224] Fix | Delete
* * NO_REINIT - Return an GIT_EEXISTS error if the repo_path appears to
[225] Fix | Delete
* already be an git repository.
[226] Fix | Delete
* * NO_DOTGIT_DIR - Normally a "/.git/" will be appended to the repo
[227] Fix | Delete
* path for non-bare repos (if it is not already there), but
[228] Fix | Delete
* passing this flag prevents that behavior.
[229] Fix | Delete
* * MKDIR - Make the repo_path (and workdir_path) as needed. Init is
[230] Fix | Delete
* always willing to create the ".git" directory even without this
[231] Fix | Delete
* flag. This flag tells init to create the trailing component of
[232] Fix | Delete
* the repo and workdir paths as needed.
[233] Fix | Delete
* * MKPATH - Recursively make all components of the repo and workdir
[234] Fix | Delete
* paths as necessary.
[235] Fix | Delete
* * EXTERNAL_TEMPLATE - libgit2 normally uses internal templates to
[236] Fix | Delete
* initialize a new repo. This flags enables external templates,
[237] Fix | Delete
* looking the "template_path" from the options if set, or the
[238] Fix | Delete
* `init.templatedir` global config if not, or falling back on
[239] Fix | Delete
* "/usr/share/git-core/templates" if it exists.
[240] Fix | Delete
* * GIT_REPOSITORY_INIT_RELATIVE_GITLINK - If an alternate workdir is
[241] Fix | Delete
* specified, use relative paths for the gitdir and core.worktree.
[242] Fix | Delete
*/
[243] Fix | Delete
typedef enum {
[244] Fix | Delete
GIT_REPOSITORY_INIT_BARE = (1u << 0),
[245] Fix | Delete
GIT_REPOSITORY_INIT_NO_REINIT = (1u << 1),
[246] Fix | Delete
GIT_REPOSITORY_INIT_NO_DOTGIT_DIR = (1u << 2),
[247] Fix | Delete
GIT_REPOSITORY_INIT_MKDIR = (1u << 3),
[248] Fix | Delete
GIT_REPOSITORY_INIT_MKPATH = (1u << 4),
[249] Fix | Delete
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE = (1u << 5),
[250] Fix | Delete
GIT_REPOSITORY_INIT_RELATIVE_GITLINK = (1u << 6),
[251] Fix | Delete
} git_repository_init_flag_t;
[252] Fix | Delete
[253] Fix | Delete
/**
[254] Fix | Delete
* Mode options for `git_repository_init_ext`.
[255] Fix | Delete
*
[256] Fix | Delete
* Set the mode field of the `git_repository_init_options` structure
[257] Fix | Delete
* either to the custom mode that you would like, or to one of the
[258] Fix | Delete
* following modes:
[259] Fix | Delete
*
[260] Fix | Delete
* * SHARED_UMASK - Use permissions configured by umask - the default.
[261] Fix | Delete
* * SHARED_GROUP - Use "--shared=group" behavior, chmod'ing the new repo
[262] Fix | Delete
* to be group writable and "g+sx" for sticky group assignment.
[263] Fix | Delete
* * SHARED_ALL - Use "--shared=all" behavior, adding world readability.
[264] Fix | Delete
* * Anything else - Set to custom value.
[265] Fix | Delete
*/
[266] Fix | Delete
typedef enum {
[267] Fix | Delete
GIT_REPOSITORY_INIT_SHARED_UMASK = 0,
[268] Fix | Delete
GIT_REPOSITORY_INIT_SHARED_GROUP = 0002775,
[269] Fix | Delete
GIT_REPOSITORY_INIT_SHARED_ALL = 0002777,
[270] Fix | Delete
} git_repository_init_mode_t;
[271] Fix | Delete
[272] Fix | Delete
/**
[273] Fix | Delete
* Extended options structure for `git_repository_init_ext`.
[274] Fix | Delete
*
[275] Fix | Delete
* This contains extra options for `git_repository_init_ext` that enable
[276] Fix | Delete
* additional initialization features. The fields are:
[277] Fix | Delete
*
[278] Fix | Delete
* * flags - Combination of GIT_REPOSITORY_INIT flags above.
[279] Fix | Delete
* * mode - Set to one of the standard GIT_REPOSITORY_INIT_SHARED_...
[280] Fix | Delete
* constants above, or to a custom value that you would like.
[281] Fix | Delete
* * workdir_path - The path to the working dir or NULL for default (i.e.
[282] Fix | Delete
* repo_path parent on non-bare repos). IF THIS IS RELATIVE PATH,
[283] Fix | Delete
* IT WILL BE EVALUATED RELATIVE TO THE REPO_PATH. If this is not
[284] Fix | Delete
* the "natural" working directory, a .git gitlink file will be
[285] Fix | Delete
* created here linking to the repo_path.
[286] Fix | Delete
* * description - If set, this will be used to initialize the "description"
[287] Fix | Delete
* file in the repository, instead of using the template content.
[288] Fix | Delete
* * template_path - When GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE is set,
[289] Fix | Delete
* this contains the path to use for the template directory. If
[290] Fix | Delete
* this is NULL, the config or default directory options will be
[291] Fix | Delete
* used instead.
[292] Fix | Delete
* * initial_head - The name of the head to point HEAD at. If NULL, then
[293] Fix | Delete
* this will be treated as "master" and the HEAD ref will be set
[294] Fix | Delete
* to "refs/heads/master". If this begins with "refs/" it will be
[295] Fix | Delete
* used verbatim; otherwise "refs/heads/" will be prefixed.
[296] Fix | Delete
* * origin_url - If this is non-NULL, then after the rest of the
[297] Fix | Delete
* repository initialization is completed, an "origin" remote
[298] Fix | Delete
* will be added pointing to this URL.
[299] Fix | Delete
*/
[300] Fix | Delete
typedef struct {
[301] Fix | Delete
unsigned int version;
[302] Fix | Delete
uint32_t flags;
[303] Fix | Delete
uint32_t mode;
[304] Fix | Delete
const char *workdir_path;
[305] Fix | Delete
const char *description;
[306] Fix | Delete
const char *template_path;
[307] Fix | Delete
const char *initial_head;
[308] Fix | Delete
const char *origin_url;
[309] Fix | Delete
} git_repository_init_options;
[310] Fix | Delete
[311] Fix | Delete
#define GIT_REPOSITORY_INIT_OPTIONS_VERSION 1
[312] Fix | Delete
#define GIT_REPOSITORY_INIT_OPTIONS_INIT {GIT_REPOSITORY_INIT_OPTIONS_VERSION}
[313] Fix | Delete
[314] Fix | Delete
/**
[315] Fix | Delete
* Initialize git_repository_init_options structure
[316] Fix | Delete
*
[317] Fix | Delete
* Initializes a `git_repository_init_options` with default values. Equivalent to
[318] Fix | Delete
* creating an instance with `GIT_REPOSITORY_INIT_OPTIONS_INIT`.
[319] Fix | Delete
*
[320] Fix | Delete
* @param opts The `git_repository_init_options` struct to initialize.
[321] Fix | Delete
* @param version The struct version; pass `GIT_REPOSITORY_INIT_OPTIONS_VERSION`.
[322] Fix | Delete
* @return Zero on success; -1 on failure.
[323] Fix | Delete
*/
[324] Fix | Delete
GIT_EXTERN(int) git_repository_init_options_init(
[325] Fix | Delete
git_repository_init_options *opts,
[326] Fix | Delete
unsigned int version);
[327] Fix | Delete
[328] Fix | Delete
/**
[329] Fix | Delete
* Create a new Git repository in the given folder with extended controls.
[330] Fix | Delete
*
[331] Fix | Delete
* This will initialize a new git repository (creating the repo_path
[332] Fix | Delete
* if requested by flags) and working directory as needed. It will
[333] Fix | Delete
* auto-detect the case sensitivity of the file system and if the
[334] Fix | Delete
* file system supports file mode bits correctly.
[335] Fix | Delete
*
[336] Fix | Delete
* @param out Pointer to the repo which will be created or reinitialized.
[337] Fix | Delete
* @param repo_path The path to the repository.
[338] Fix | Delete
* @param opts Pointer to git_repository_init_options struct.
[339] Fix | Delete
* @return 0 or an error code on failure.
[340] Fix | Delete
*/
[341] Fix | Delete
GIT_EXTERN(int) git_repository_init_ext(
[342] Fix | Delete
git_repository **out,
[343] Fix | Delete
const char *repo_path,
[344] Fix | Delete
git_repository_init_options *opts);
[345] Fix | Delete
[346] Fix | Delete
/**
[347] Fix | Delete
* Retrieve and resolve the reference pointed at by HEAD.
[348] Fix | Delete
*
[349] Fix | Delete
* The returned `git_reference` will be owned by caller and
[350] Fix | Delete
* `git_reference_free()` must be called when done with it to release the
[351] Fix | Delete
* allocated memory and prevent a leak.
[352] Fix | Delete
*
[353] Fix | Delete
* @param out pointer to the reference which will be retrieved
[354] Fix | Delete
* @param repo a repository object
[355] Fix | Delete
*
[356] Fix | Delete
* @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing
[357] Fix | Delete
* branch, GIT_ENOTFOUND when HEAD is missing; an error code otherwise
[358] Fix | Delete
*/
[359] Fix | Delete
GIT_EXTERN(int) git_repository_head(git_reference **out, git_repository *repo);
[360] Fix | Delete
[361] Fix | Delete
/**
[362] Fix | Delete
* Retrieve the referenced HEAD for the worktree
[363] Fix | Delete
*
[364] Fix | Delete
* @param out pointer to the reference which will be retrieved
[365] Fix | Delete
* @param repo a repository object
[366] Fix | Delete
* @param name name of the worktree to retrieve HEAD for
[367] Fix | Delete
* @return 0 when successful, error-code otherwise
[368] Fix | Delete
*/
[369] Fix | Delete
GIT_EXTERN(int) git_repository_head_for_worktree(git_reference **out, git_repository *repo,
[370] Fix | Delete
const char *name);
[371] Fix | Delete
[372] Fix | Delete
/**
[373] Fix | Delete
* Check if a repository's HEAD is detached
[374] Fix | Delete
*
[375] Fix | Delete
* A repository's HEAD is detached when it points directly to a commit
[376] Fix | Delete
* instead of a branch.
[377] Fix | Delete
*
[378] Fix | Delete
* @param repo Repo to test
[379] Fix | Delete
* @return 1 if HEAD is detached, 0 if it's not; error code if there
[380] Fix | Delete
* was an error.
[381] Fix | Delete
*/
[382] Fix | Delete
GIT_EXTERN(int) git_repository_head_detached(git_repository *repo);
[383] Fix | Delete
[384] Fix | Delete
/**
[385] Fix | Delete
* Check if a worktree's HEAD is detached
[386] Fix | Delete
*
[387] Fix | Delete
* A worktree's HEAD is detached when it points directly to a
[388] Fix | Delete
* commit instead of a branch.
[389] Fix | Delete
*
[390] Fix | Delete
* @param repo a repository object
[391] Fix | Delete
* @param name name of the worktree to retrieve HEAD for
[392] Fix | Delete
* @return 1 if HEAD is detached, 0 if its not; error code if
[393] Fix | Delete
* there was an error
[394] Fix | Delete
*/
[395] Fix | Delete
GIT_EXTERN(int) git_repository_head_detached_for_worktree(git_repository *repo,
[396] Fix | Delete
const char *name);
[397] Fix | Delete
[398] Fix | Delete
/**
[399] Fix | Delete
* Check if the current branch is unborn
[400] Fix | Delete
*
[401] Fix | Delete
* An unborn branch is one named from HEAD but which doesn't exist in
[402] Fix | Delete
* the refs namespace, because it doesn't have any commit to point to.
[403] Fix | Delete
*
[404] Fix | Delete
* @param repo Repo to test
[405] Fix | Delete
* @return 1 if the current branch is unborn, 0 if it's not; error
[406] Fix | Delete
* code if there was an error
[407] Fix | Delete
*/
[408] Fix | Delete
GIT_EXTERN(int) git_repository_head_unborn(git_repository *repo);
[409] Fix | Delete
[410] Fix | Delete
/**
[411] Fix | Delete
* Check if a repository is empty
[412] Fix | Delete
*
[413] Fix | Delete
* An empty repository has just been initialized and contains no references
[414] Fix | Delete
* apart from HEAD, which must be pointing to the unborn master branch.
[415] Fix | Delete
*
[416] Fix | Delete
* @param repo Repo to test
[417] Fix | Delete
* @return 1 if the repository is empty, 0 if it isn't, error code
[418] Fix | Delete
* if the repository is corrupted
[419] Fix | Delete
*/
[420] Fix | Delete
GIT_EXTERN(int) git_repository_is_empty(git_repository *repo);
[421] Fix | Delete
[422] Fix | Delete
/**
[423] Fix | Delete
* List of items which belong to the git repository layout
[424] Fix | Delete
*/
[425] Fix | Delete
typedef enum {
[426] Fix | Delete
GIT_REPOSITORY_ITEM_GITDIR,
[427] Fix | Delete
GIT_REPOSITORY_ITEM_WORKDIR,
[428] Fix | Delete
GIT_REPOSITORY_ITEM_COMMONDIR,
[429] Fix | Delete
GIT_REPOSITORY_ITEM_INDEX,
[430] Fix | Delete
GIT_REPOSITORY_ITEM_OBJECTS,
[431] Fix | Delete
GIT_REPOSITORY_ITEM_REFS,
[432] Fix | Delete
GIT_REPOSITORY_ITEM_PACKED_REFS,
[433] Fix | Delete
GIT_REPOSITORY_ITEM_REMOTES,
[434] Fix | Delete
GIT_REPOSITORY_ITEM_CONFIG,
[435] Fix | Delete
GIT_REPOSITORY_ITEM_INFO,
[436] Fix | Delete
GIT_REPOSITORY_ITEM_HOOKS,
[437] Fix | Delete
GIT_REPOSITORY_ITEM_LOGS,
[438] Fix | Delete
GIT_REPOSITORY_ITEM_MODULES,
[439] Fix | Delete
GIT_REPOSITORY_ITEM_WORKTREES,
[440] Fix | Delete
GIT_REPOSITORY_ITEM__LAST
[441] Fix | Delete
} git_repository_item_t;
[442] Fix | Delete
[443] Fix | Delete
/**
[444] Fix | Delete
* Get the location of a specific repository file or directory
[445] Fix | Delete
*
[446] Fix | Delete
* This function will retrieve the path of a specific repository
[447] Fix | Delete
* item. It will thereby honor things like the repository's
[448] Fix | Delete
* common directory, gitdir, etc. In case a file path cannot
[449] Fix | Delete
* exist for a given item (e.g. the working directory of a bare
[450] Fix | Delete
* repository), GIT_ENOTFOUND is returned.
[451] Fix | Delete
*
[452] Fix | Delete
* @param out Buffer to store the path at
[453] Fix | Delete
* @param repo Repository to get path for
[454] Fix | Delete
* @param item The repository item for which to retrieve the path
[455] Fix | Delete
* @return 0, GIT_ENOTFOUND if the path cannot exist or an error code
[456] Fix | Delete
*/
[457] Fix | Delete
GIT_EXTERN(int) git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item);
[458] Fix | Delete
[459] Fix | Delete
/**
[460] Fix | Delete
* Get the path of this repository
[461] Fix | Delete
*
[462] Fix | Delete
* This is the path of the `.git` folder for normal repositories,
[463] Fix | Delete
* or of the repository itself for bare repositories.
[464] Fix | Delete
*
[465] Fix | Delete
* @param repo A repository object
[466] Fix | Delete
* @return the path to the repository
[467] Fix | Delete
*/
[468] Fix | Delete
GIT_EXTERN(const char *) git_repository_path(const git_repository *repo);
[469] Fix | Delete
[470] Fix | Delete
/**
[471] Fix | Delete
* Get the path of the working directory for this repository
[472] Fix | Delete
*
[473] Fix | Delete
* If the repository is bare, this function will always return
[474] Fix | Delete
* NULL.
[475] Fix | Delete
*
[476] Fix | Delete
* @param repo A repository object
[477] Fix | Delete
* @return the path to the working dir, if it exists
[478] Fix | Delete
*/
[479] Fix | Delete
GIT_EXTERN(const char *) git_repository_workdir(const git_repository *repo);
[480] Fix | Delete
[481] Fix | Delete
/**
[482] Fix | Delete
* Get the path of the shared common directory for this repository.
[483] Fix | Delete
*
[484] Fix | Delete
* If the repository is bare, it is the root directory for the repository.
[485] Fix | Delete
* If the repository is a worktree, it is the parent repo's gitdir.
[486] Fix | Delete
* Otherwise, it is the gitdir.
[487] Fix | Delete
*
[488] Fix | Delete
* @param repo A repository object
[489] Fix | Delete
* @return the path to the common dir
[490] Fix | Delete
*/
[491] Fix | Delete
GIT_EXTERN(const char *) git_repository_commondir(const git_repository *repo);
[492] Fix | Delete
[493] Fix | Delete
/**
[494] Fix | Delete
* Set the path to the working directory for this repository
[495] Fix | Delete
*
[496] Fix | Delete
* The working directory doesn't need to be the same one
[497] Fix | Delete
* that contains the `.git` folder for this repository.
[498] Fix | Delete
*
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function