Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/imh-pyth.../include/git2
File: worktree.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_worktree_h__
[6] Fix | Delete
#define INCLUDE_git_worktree_h__
[7] Fix | Delete
[8] Fix | Delete
#include "common.h"
[9] Fix | Delete
#include "buffer.h"
[10] Fix | Delete
#include "types.h"
[11] Fix | Delete
#include "strarray.h"
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* @file git2/worktrees.h
[15] Fix | Delete
* @brief Git worktree related functions
[16] Fix | Delete
* @defgroup git_commit Git worktree related functions
[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
* List names of linked working trees
[24] Fix | Delete
*
[25] Fix | Delete
* The returned list should be released with `git_strarray_free`
[26] Fix | Delete
* when no longer needed.
[27] Fix | Delete
*
[28] Fix | Delete
* @param out pointer to the array of working tree names
[29] Fix | Delete
* @param repo the repo to use when listing working trees
[30] Fix | Delete
* @return 0 or an error code
[31] Fix | Delete
*/
[32] Fix | Delete
GIT_EXTERN(int) git_worktree_list(git_strarray *out, git_repository *repo);
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Lookup a working tree by its name for a given repository
[36] Fix | Delete
*
[37] Fix | Delete
* @param out Output pointer to looked up worktree or `NULL`
[38] Fix | Delete
* @param repo The repository containing worktrees
[39] Fix | Delete
* @param name Name of the working tree to look up
[40] Fix | Delete
* @return 0 or an error code
[41] Fix | Delete
*/
[42] Fix | Delete
GIT_EXTERN(int) git_worktree_lookup(git_worktree **out, git_repository *repo, const char *name);
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Open a worktree of a given repository
[46] Fix | Delete
*
[47] Fix | Delete
* If a repository is not the main tree but a worktree, this
[48] Fix | Delete
* function will look up the worktree inside the parent
[49] Fix | Delete
* repository and create a new `git_worktree` structure.
[50] Fix | Delete
*
[51] Fix | Delete
* @param out Out-pointer for the newly allocated worktree
[52] Fix | Delete
* @param repo Repository to look up worktree for
[53] Fix | Delete
*/
[54] Fix | Delete
GIT_EXTERN(int) git_worktree_open_from_repository(git_worktree **out, git_repository *repo);
[55] Fix | Delete
[56] Fix | Delete
/**
[57] Fix | Delete
* Free a previously allocated worktree
[58] Fix | Delete
*
[59] Fix | Delete
* @param wt worktree handle to close. If NULL nothing occurs.
[60] Fix | Delete
*/
[61] Fix | Delete
GIT_EXTERN(void) git_worktree_free(git_worktree *wt);
[62] Fix | Delete
[63] Fix | Delete
/**
[64] Fix | Delete
* Check if worktree is valid
[65] Fix | Delete
*
[66] Fix | Delete
* A valid worktree requires both the git data structures inside
[67] Fix | Delete
* the linked parent repository and the linked working copy to be
[68] Fix | Delete
* present.
[69] Fix | Delete
*
[70] Fix | Delete
* @param wt Worktree to check
[71] Fix | Delete
* @return 0 when worktree is valid, error-code otherwise
[72] Fix | Delete
*/
[73] Fix | Delete
GIT_EXTERN(int) git_worktree_validate(const git_worktree *wt);
[74] Fix | Delete
[75] Fix | Delete
/**
[76] Fix | Delete
* Worktree add options structure
[77] Fix | Delete
*
[78] Fix | Delete
* Initialize with `GIT_WORKTREE_ADD_OPTIONS_INIT`. Alternatively, you can
[79] Fix | Delete
* use `git_worktree_add_options_init`.
[80] Fix | Delete
*
[81] Fix | Delete
*/
[82] Fix | Delete
typedef struct git_worktree_add_options {
[83] Fix | Delete
unsigned int version;
[84] Fix | Delete
[85] Fix | Delete
int lock; /**< lock newly created worktree */
[86] Fix | Delete
git_reference *ref; /**< reference to use for the new worktree HEAD */
[87] Fix | Delete
} git_worktree_add_options;
[88] Fix | Delete
[89] Fix | Delete
#define GIT_WORKTREE_ADD_OPTIONS_VERSION 1
[90] Fix | Delete
#define GIT_WORKTREE_ADD_OPTIONS_INIT {GIT_WORKTREE_ADD_OPTIONS_VERSION,0,NULL}
[91] Fix | Delete
[92] Fix | Delete
/**
[93] Fix | Delete
* Initialize git_worktree_add_options structure
[94] Fix | Delete
*
[95] Fix | Delete
* Initializes a `git_worktree_add_options` with default values. Equivalent to
[96] Fix | Delete
* creating an instance with `GIT_WORKTREE_ADD_OPTIONS_INIT`.
[97] Fix | Delete
*
[98] Fix | Delete
* @param opts The `git_worktree_add_options` struct to initialize.
[99] Fix | Delete
* @param version The struct version; pass `GIT_WORKTREE_ADD_OPTIONS_VERSION`.
[100] Fix | Delete
* @return Zero on success; -1 on failure.
[101] Fix | Delete
*/
[102] Fix | Delete
GIT_EXTERN(int) git_worktree_add_options_init(git_worktree_add_options *opts,
[103] Fix | Delete
unsigned int version);
[104] Fix | Delete
[105] Fix | Delete
/**
[106] Fix | Delete
* Add a new working tree
[107] Fix | Delete
*
[108] Fix | Delete
* Add a new working tree for the repository, that is create the
[109] Fix | Delete
* required data structures inside the repository and check out
[110] Fix | Delete
* the current HEAD at `path`
[111] Fix | Delete
*
[112] Fix | Delete
* @param out Output pointer containing new working tree
[113] Fix | Delete
* @param repo Repository to create working tree for
[114] Fix | Delete
* @param name Name of the working tree
[115] Fix | Delete
* @param path Path to create working tree at
[116] Fix | Delete
* @param opts Options to modify default behavior. May be NULL
[117] Fix | Delete
* @return 0 or an error code
[118] Fix | Delete
*/
[119] Fix | Delete
GIT_EXTERN(int) git_worktree_add(git_worktree **out, git_repository *repo,
[120] Fix | Delete
const char *name, const char *path,
[121] Fix | Delete
const git_worktree_add_options *opts);
[122] Fix | Delete
[123] Fix | Delete
/**
[124] Fix | Delete
* Lock worktree if not already locked
[125] Fix | Delete
*
[126] Fix | Delete
* Lock a worktree, optionally specifying a reason why the linked
[127] Fix | Delete
* working tree is being locked.
[128] Fix | Delete
*
[129] Fix | Delete
* @param wt Worktree to lock
[130] Fix | Delete
* @param reason Reason why the working tree is being locked
[131] Fix | Delete
* @return 0 on success, non-zero otherwise
[132] Fix | Delete
*/
[133] Fix | Delete
GIT_EXTERN(int) git_worktree_lock(git_worktree *wt, const char *reason);
[134] Fix | Delete
[135] Fix | Delete
/**
[136] Fix | Delete
* Unlock a locked worktree
[137] Fix | Delete
*
[138] Fix | Delete
* @param wt Worktree to unlock
[139] Fix | Delete
* @return 0 on success, 1 if worktree was not locked, error-code
[140] Fix | Delete
* otherwise
[141] Fix | Delete
*/
[142] Fix | Delete
GIT_EXTERN(int) git_worktree_unlock(git_worktree *wt);
[143] Fix | Delete
[144] Fix | Delete
/**
[145] Fix | Delete
* Check if worktree is locked
[146] Fix | Delete
*
[147] Fix | Delete
* A worktree may be locked if the linked working tree is stored
[148] Fix | Delete
* on a portable device which is not available.
[149] Fix | Delete
*
[150] Fix | Delete
* @param reason Buffer to store reason in. If NULL no reason is stored.
[151] Fix | Delete
* @param wt Worktree to check
[152] Fix | Delete
* @return 0 when the working tree not locked, a value greater
[153] Fix | Delete
* than zero if it is locked, less than zero if there was an
[154] Fix | Delete
* error
[155] Fix | Delete
*/
[156] Fix | Delete
GIT_EXTERN(int) git_worktree_is_locked(git_buf *reason, const git_worktree *wt);
[157] Fix | Delete
[158] Fix | Delete
/**
[159] Fix | Delete
* Retrieve the name of the worktree
[160] Fix | Delete
*
[161] Fix | Delete
* @param wt Worktree to get the name for
[162] Fix | Delete
* @return The worktree's name. The pointer returned is valid for the
[163] Fix | Delete
* lifetime of the git_worktree
[164] Fix | Delete
*/
[165] Fix | Delete
GIT_EXTERN(const char *) git_worktree_name(const git_worktree *wt);
[166] Fix | Delete
[167] Fix | Delete
/**
[168] Fix | Delete
* Retrieve the filesystem path for the worktree
[169] Fix | Delete
*
[170] Fix | Delete
* @param wt Worktree to get the path for
[171] Fix | Delete
* @return The worktree's filesystem path. The pointer returned
[172] Fix | Delete
* is valid for the lifetime of the git_worktree.
[173] Fix | Delete
*/
[174] Fix | Delete
GIT_EXTERN(const char *) git_worktree_path(const git_worktree *wt);
[175] Fix | Delete
[176] Fix | Delete
/**
[177] Fix | Delete
* Flags which can be passed to git_worktree_prune to alter its
[178] Fix | Delete
* behavior.
[179] Fix | Delete
*/
[180] Fix | Delete
typedef enum {
[181] Fix | Delete
/* Prune working tree even if working tree is valid */
[182] Fix | Delete
GIT_WORKTREE_PRUNE_VALID = 1u << 0,
[183] Fix | Delete
/* Prune working tree even if it is locked */
[184] Fix | Delete
GIT_WORKTREE_PRUNE_LOCKED = 1u << 1,
[185] Fix | Delete
/* Prune checked out working tree */
[186] Fix | Delete
GIT_WORKTREE_PRUNE_WORKING_TREE = 1u << 2,
[187] Fix | Delete
} git_worktree_prune_t;
[188] Fix | Delete
[189] Fix | Delete
/**
[190] Fix | Delete
* Worktree prune options structure
[191] Fix | Delete
*
[192] Fix | Delete
* Initialize with `GIT_WORKTREE_PRUNE_OPTIONS_INIT`. Alternatively, you can
[193] Fix | Delete
* use `git_worktree_prune_options_init`.
[194] Fix | Delete
*
[195] Fix | Delete
*/
[196] Fix | Delete
typedef struct git_worktree_prune_options {
[197] Fix | Delete
unsigned int version;
[198] Fix | Delete
[199] Fix | Delete
uint32_t flags;
[200] Fix | Delete
} git_worktree_prune_options;
[201] Fix | Delete
[202] Fix | Delete
#define GIT_WORKTREE_PRUNE_OPTIONS_VERSION 1
[203] Fix | Delete
#define GIT_WORKTREE_PRUNE_OPTIONS_INIT {GIT_WORKTREE_PRUNE_OPTIONS_VERSION,0}
[204] Fix | Delete
[205] Fix | Delete
/**
[206] Fix | Delete
* Initialize git_worktree_prune_options structure
[207] Fix | Delete
*
[208] Fix | Delete
* Initializes a `git_worktree_prune_options` with default values. Equivalent to
[209] Fix | Delete
* creating an instance with `GIT_WORKTREE_PRUNE_OPTIONS_INIT`.
[210] Fix | Delete
*
[211] Fix | Delete
* @param opts The `git_worktree_prune_options` struct to initialize.
[212] Fix | Delete
* @param version The struct version; pass `GIT_WORKTREE_PRUNE_OPTIONS_VERSION`.
[213] Fix | Delete
* @return Zero on success; -1 on failure.
[214] Fix | Delete
*/
[215] Fix | Delete
GIT_EXTERN(int) git_worktree_prune_options_init(
[216] Fix | Delete
git_worktree_prune_options *opts,
[217] Fix | Delete
unsigned int version);
[218] Fix | Delete
[219] Fix | Delete
/**
[220] Fix | Delete
* Is the worktree prunable with the given options?
[221] Fix | Delete
*
[222] Fix | Delete
* A worktree is not prunable in the following scenarios:
[223] Fix | Delete
*
[224] Fix | Delete
* - the worktree is linking to a valid on-disk worktree. The
[225] Fix | Delete
* `valid` member will cause this check to be ignored.
[226] Fix | Delete
* - the worktree is locked. The `locked` flag will cause this
[227] Fix | Delete
* check to be ignored.
[228] Fix | Delete
*
[229] Fix | Delete
* If the worktree is not valid and not locked or if the above
[230] Fix | Delete
* flags have been passed in, this function will return a
[231] Fix | Delete
* positive value.
[232] Fix | Delete
*/
[233] Fix | Delete
GIT_EXTERN(int) git_worktree_is_prunable(git_worktree *wt,
[234] Fix | Delete
git_worktree_prune_options *opts);
[235] Fix | Delete
[236] Fix | Delete
/**
[237] Fix | Delete
* Prune working tree
[238] Fix | Delete
*
[239] Fix | Delete
* Prune the working tree, that is remove the git data
[240] Fix | Delete
* structures on disk. The repository will only be pruned of
[241] Fix | Delete
* `git_worktree_is_prunable` succeeds.
[242] Fix | Delete
*
[243] Fix | Delete
* @param wt Worktree to prune
[244] Fix | Delete
* @param opts Specifies which checks to override. See
[245] Fix | Delete
* `git_worktree_is_prunable`. May be NULL
[246] Fix | Delete
* @return 0 or an error code
[247] Fix | Delete
*/
[248] Fix | Delete
GIT_EXTERN(int) git_worktree_prune(git_worktree *wt,
[249] Fix | Delete
git_worktree_prune_options *opts);
[250] Fix | Delete
[251] Fix | Delete
/** @} */
[252] Fix | Delete
GIT_END_DECL
[253] Fix | Delete
#endif
[254] Fix | Delete
[255] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function