Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/imh-pyth.../include/git2
File: branch.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_branch_h__
[6] Fix | Delete
#define INCLUDE_git_branch_h__
[7] Fix | Delete
[8] Fix | Delete
#include "common.h"
[9] Fix | Delete
#include "oid.h"
[10] Fix | Delete
#include "types.h"
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* @file git2/branch.h
[14] Fix | Delete
* @brief Git branch parsing routines
[15] Fix | Delete
* @defgroup git_branch Git branch management
[16] Fix | Delete
* @ingroup Git
[17] Fix | Delete
* @{
[18] Fix | Delete
*/
[19] Fix | Delete
GIT_BEGIN_DECL
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* Create a new branch pointing at a target commit
[23] Fix | Delete
*
[24] Fix | Delete
* A new direct reference will be created pointing to
[25] Fix | Delete
* this target commit. If `force` is true and a reference
[26] Fix | Delete
* already exists with the given name, it'll be replaced.
[27] Fix | Delete
*
[28] Fix | Delete
* The returned reference must be freed by the user.
[29] Fix | Delete
*
[30] Fix | Delete
* The branch name will be checked for validity.
[31] Fix | Delete
* See `git_tag_create()` for rules about valid names.
[32] Fix | Delete
*
[33] Fix | Delete
* @param out Pointer where to store the underlying reference.
[34] Fix | Delete
*
[35] Fix | Delete
* @param branch_name Name for the branch; this name is
[36] Fix | Delete
* validated for consistency. It should also not conflict with
[37] Fix | Delete
* an already existing branch name.
[38] Fix | Delete
*
[39] Fix | Delete
* @param target Commit to which this branch should point. This object
[40] Fix | Delete
* must belong to the given `repo`.
[41] Fix | Delete
*
[42] Fix | Delete
* @param force Overwrite existing branch.
[43] Fix | Delete
*
[44] Fix | Delete
* @return 0, GIT_EINVALIDSPEC or an error code.
[45] Fix | Delete
* A proper reference is written in the refs/heads namespace
[46] Fix | Delete
* pointing to the provided target commit.
[47] Fix | Delete
*/
[48] Fix | Delete
GIT_EXTERN(int) git_branch_create(
[49] Fix | Delete
git_reference **out,
[50] Fix | Delete
git_repository *repo,
[51] Fix | Delete
const char *branch_name,
[52] Fix | Delete
const git_commit *target,
[53] Fix | Delete
int force);
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* Create a new branch pointing at a target commit
[57] Fix | Delete
*
[58] Fix | Delete
* This behaves like `git_branch_create()` but takes an annotated
[59] Fix | Delete
* commit, which lets you specify which extended sha syntax string was
[60] Fix | Delete
* specified by a user, allowing for more exact reflog messages.
[61] Fix | Delete
*
[62] Fix | Delete
* See the documentation for `git_branch_create()`.
[63] Fix | Delete
*
[64] Fix | Delete
* @see git_branch_create
[65] Fix | Delete
*/
[66] Fix | Delete
GIT_EXTERN(int) git_branch_create_from_annotated(
[67] Fix | Delete
git_reference **ref_out,
[68] Fix | Delete
git_repository *repository,
[69] Fix | Delete
const char *branch_name,
[70] Fix | Delete
const git_annotated_commit *commit,
[71] Fix | Delete
int force);
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* Delete an existing branch reference.
[75] Fix | Delete
*
[76] Fix | Delete
* Note that if the deletion succeeds, the reference object will not
[77] Fix | Delete
* be valid anymore, and should be freed immediately by the user using
[78] Fix | Delete
* `git_reference_free()`.
[79] Fix | Delete
*
[80] Fix | Delete
* @param branch A valid reference representing a branch
[81] Fix | Delete
* @return 0 on success, or an error code.
[82] Fix | Delete
*/
[83] Fix | Delete
GIT_EXTERN(int) git_branch_delete(git_reference *branch);
[84] Fix | Delete
[85] Fix | Delete
/** Iterator type for branches */
[86] Fix | Delete
typedef struct git_branch_iterator git_branch_iterator;
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* Create an iterator which loops over the requested branches.
[90] Fix | Delete
*
[91] Fix | Delete
* @param out the iterator
[92] Fix | Delete
* @param repo Repository where to find the branches.
[93] Fix | Delete
* @param list_flags Filtering flags for the branch
[94] Fix | Delete
* listing. Valid values are GIT_BRANCH_LOCAL, GIT_BRANCH_REMOTE
[95] Fix | Delete
* or GIT_BRANCH_ALL.
[96] Fix | Delete
*
[97] Fix | Delete
* @return 0 on success or an error code
[98] Fix | Delete
*/
[99] Fix | Delete
GIT_EXTERN(int) git_branch_iterator_new(
[100] Fix | Delete
git_branch_iterator **out,
[101] Fix | Delete
git_repository *repo,
[102] Fix | Delete
git_branch_t list_flags);
[103] Fix | Delete
[104] Fix | Delete
/**
[105] Fix | Delete
* Retrieve the next branch from the iterator
[106] Fix | Delete
*
[107] Fix | Delete
* @param out the reference
[108] Fix | Delete
* @param out_type the type of branch (local or remote-tracking)
[109] Fix | Delete
* @param iter the branch iterator
[110] Fix | Delete
* @return 0 on success, GIT_ITEROVER if there are no more branches or an error code.
[111] Fix | Delete
*/
[112] Fix | Delete
GIT_EXTERN(int) git_branch_next(git_reference **out, git_branch_t *out_type, git_branch_iterator *iter);
[113] Fix | Delete
[114] Fix | Delete
/**
[115] Fix | Delete
* Free a branch iterator
[116] Fix | Delete
*
[117] Fix | Delete
* @param iter the iterator to free
[118] Fix | Delete
*/
[119] Fix | Delete
GIT_EXTERN(void) git_branch_iterator_free(git_branch_iterator *iter);
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Move/rename an existing local branch reference.
[123] Fix | Delete
*
[124] Fix | Delete
* The new branch name will be checked for validity.
[125] Fix | Delete
* See `git_tag_create()` for rules about valid names.
[126] Fix | Delete
*
[127] Fix | Delete
* Note that if the move succeeds, the old reference object will not
[128] Fix | Delete
+ be valid anymore, and should be freed immediately by the user using
[129] Fix | Delete
+ `git_reference_free()`.
[130] Fix | Delete
*
[131] Fix | Delete
* @param out New reference object for the updated name.
[132] Fix | Delete
*
[133] Fix | Delete
* @param branch Current underlying reference of the branch.
[134] Fix | Delete
*
[135] Fix | Delete
* @param new_branch_name Target name of the branch once the move
[136] Fix | Delete
* is performed; this name is validated for consistency.
[137] Fix | Delete
*
[138] Fix | Delete
* @param force Overwrite existing branch.
[139] Fix | Delete
*
[140] Fix | Delete
* @return 0 on success, GIT_EINVALIDSPEC or an error code.
[141] Fix | Delete
*/
[142] Fix | Delete
GIT_EXTERN(int) git_branch_move(
[143] Fix | Delete
git_reference **out,
[144] Fix | Delete
git_reference *branch,
[145] Fix | Delete
const char *new_branch_name,
[146] Fix | Delete
int force);
[147] Fix | Delete
[148] Fix | Delete
/**
[149] Fix | Delete
* Lookup a branch by its name in a repository.
[150] Fix | Delete
*
[151] Fix | Delete
* The generated reference must be freed by the user.
[152] Fix | Delete
* The branch name will be checked for validity.
[153] Fix | Delete
*
[154] Fix | Delete
* @see git_tag_create for rules about valid names.
[155] Fix | Delete
*
[156] Fix | Delete
* @param out pointer to the looked-up branch reference
[157] Fix | Delete
* @param repo the repository to look up the branch
[158] Fix | Delete
* @param branch_name Name of the branch to be looked-up;
[159] Fix | Delete
* this name is validated for consistency.
[160] Fix | Delete
* @param branch_type Type of the considered branch. This should
[161] Fix | Delete
* be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
[162] Fix | Delete
*
[163] Fix | Delete
* @return 0 on success; GIT_ENOTFOUND when no matching branch
[164] Fix | Delete
* exists, GIT_EINVALIDSPEC, otherwise an error code.
[165] Fix | Delete
*/
[166] Fix | Delete
GIT_EXTERN(int) git_branch_lookup(
[167] Fix | Delete
git_reference **out,
[168] Fix | Delete
git_repository *repo,
[169] Fix | Delete
const char *branch_name,
[170] Fix | Delete
git_branch_t branch_type);
[171] Fix | Delete
[172] Fix | Delete
/**
[173] Fix | Delete
* Get the branch name
[174] Fix | Delete
*
[175] Fix | Delete
* Given a reference object, this will check that it really is a branch (ie.
[176] Fix | Delete
* it lives under "refs/heads/" or "refs/remotes/"), and return the branch part
[177] Fix | Delete
* of it.
[178] Fix | Delete
*
[179] Fix | Delete
* @param out Pointer to the abbreviated reference name.
[180] Fix | Delete
* Owned by ref, do not free.
[181] Fix | Delete
*
[182] Fix | Delete
* @param ref A reference object, ideally pointing to a branch
[183] Fix | Delete
*
[184] Fix | Delete
* @return 0 on success; GIT_EINVALID if the reference isn't either a local or
[185] Fix | Delete
* remote branch, otherwise an error code.
[186] Fix | Delete
*/
[187] Fix | Delete
GIT_EXTERN(int) git_branch_name(
[188] Fix | Delete
const char **out,
[189] Fix | Delete
const git_reference *ref);
[190] Fix | Delete
[191] Fix | Delete
/**
[192] Fix | Delete
* Get the upstream of a branch
[193] Fix | Delete
*
[194] Fix | Delete
* Given a reference, this will return a new reference object corresponding
[195] Fix | Delete
* to its remote tracking branch. The reference must be a local branch.
[196] Fix | Delete
*
[197] Fix | Delete
* @see git_branch_upstream_name for details on the resolution.
[198] Fix | Delete
*
[199] Fix | Delete
* @param out Pointer where to store the retrieved reference.
[200] Fix | Delete
* @param branch Current underlying reference of the branch.
[201] Fix | Delete
*
[202] Fix | Delete
* @return 0 on success; GIT_ENOTFOUND when no remote tracking
[203] Fix | Delete
* reference exists, otherwise an error code.
[204] Fix | Delete
*/
[205] Fix | Delete
GIT_EXTERN(int) git_branch_upstream(
[206] Fix | Delete
git_reference **out,
[207] Fix | Delete
const git_reference *branch);
[208] Fix | Delete
[209] Fix | Delete
/**
[210] Fix | Delete
* Set a branch's upstream branch
[211] Fix | Delete
*
[212] Fix | Delete
* This will update the configuration to set the branch named `branch_name` as the upstream of `branch`.
[213] Fix | Delete
* Pass a NULL name to unset the upstream information.
[214] Fix | Delete
*
[215] Fix | Delete
* @note the actual tracking reference must have been already created for the
[216] Fix | Delete
* operation to succeed.
[217] Fix | Delete
*
[218] Fix | Delete
* @param branch the branch to configure
[219] Fix | Delete
* @param branch_name remote-tracking or local branch to set as upstream.
[220] Fix | Delete
*
[221] Fix | Delete
* @return 0 on success; GIT_ENOTFOUND if there's no branch named `branch_name`
[222] Fix | Delete
* or an error code
[223] Fix | Delete
*/
[224] Fix | Delete
GIT_EXTERN(int) git_branch_set_upstream(
[225] Fix | Delete
git_reference *branch,
[226] Fix | Delete
const char *branch_name);
[227] Fix | Delete
[228] Fix | Delete
/**
[229] Fix | Delete
* Get the upstream name of a branch
[230] Fix | Delete
*
[231] Fix | Delete
* Given a local branch, this will return its remote-tracking branch information,
[232] Fix | Delete
* as a full reference name, ie. "feature/nice" would become
[233] Fix | Delete
* "refs/remote/origin/feature/nice", depending on that branch's configuration.
[234] Fix | Delete
*
[235] Fix | Delete
* @param out the buffer into which the name will be written.
[236] Fix | Delete
* @param repo the repository where the branches live.
[237] Fix | Delete
* @param refname reference name of the local branch.
[238] Fix | Delete
*
[239] Fix | Delete
* @return 0 on success, GIT_ENOTFOUND when no remote tracking reference exists,
[240] Fix | Delete
* or an error code.
[241] Fix | Delete
*/
[242] Fix | Delete
GIT_EXTERN(int) git_branch_upstream_name(
[243] Fix | Delete
git_buf *out,
[244] Fix | Delete
git_repository *repo,
[245] Fix | Delete
const char *refname);
[246] Fix | Delete
[247] Fix | Delete
/**
[248] Fix | Delete
* Determine if HEAD points to the given branch
[249] Fix | Delete
*
[250] Fix | Delete
* @param branch A reference to a local branch.
[251] Fix | Delete
*
[252] Fix | Delete
* @return 1 if HEAD points at the branch, 0 if it isn't, or a negative value
[253] Fix | Delete
* as an error code.
[254] Fix | Delete
*/
[255] Fix | Delete
GIT_EXTERN(int) git_branch_is_head(
[256] Fix | Delete
const git_reference *branch);
[257] Fix | Delete
[258] Fix | Delete
/**
[259] Fix | Delete
* Determine if any HEAD points to the current branch
[260] Fix | Delete
*
[261] Fix | Delete
* This will iterate over all known linked repositories (usually in the form of
[262] Fix | Delete
* worktrees) and report whether any HEAD is pointing at the current branch.
[263] Fix | Delete
*
[264] Fix | Delete
* @param branch A reference to a local branch.
[265] Fix | Delete
*
[266] Fix | Delete
* @return 1 if branch is checked out, 0 if it isn't, an error code otherwise.
[267] Fix | Delete
*/
[268] Fix | Delete
GIT_EXTERN(int) git_branch_is_checked_out(
[269] Fix | Delete
const git_reference *branch);
[270] Fix | Delete
[271] Fix | Delete
/**
[272] Fix | Delete
* Find the remote name of a remote-tracking branch
[273] Fix | Delete
*
[274] Fix | Delete
* This will return the name of the remote whose fetch refspec is matching
[275] Fix | Delete
* the given branch. E.g. given a branch "refs/remotes/test/master", it will
[276] Fix | Delete
* extract the "test" part. If refspecs from multiple remotes match,
[277] Fix | Delete
* the function will return GIT_EAMBIGUOUS.
[278] Fix | Delete
*
[279] Fix | Delete
* @param out The buffer into which the name will be written.
[280] Fix | Delete
* @param repo The repository where the branch lives.
[281] Fix | Delete
* @param refname complete name of the remote tracking branch.
[282] Fix | Delete
*
[283] Fix | Delete
* @return 0 on success, GIT_ENOTFOUND when no matching remote was found,
[284] Fix | Delete
* GIT_EAMBIGUOUS when the branch maps to several remotes,
[285] Fix | Delete
* otherwise an error code.
[286] Fix | Delete
*/
[287] Fix | Delete
GIT_EXTERN(int) git_branch_remote_name(
[288] Fix | Delete
git_buf *out,
[289] Fix | Delete
git_repository *repo,
[290] Fix | Delete
const char *refname);
[291] Fix | Delete
[292] Fix | Delete
/**
[293] Fix | Delete
* Retrieve the upstream remote of a local branch
[294] Fix | Delete
*
[295] Fix | Delete
* This will return the currently configured "branch.*.remote" for a given
[296] Fix | Delete
* branch. This branch must be local.
[297] Fix | Delete
*
[298] Fix | Delete
* @param buf the buffer into which to write the name
[299] Fix | Delete
* @param repo the repository in which to look
[300] Fix | Delete
* @param refname the full name of the branch
[301] Fix | Delete
* @return 0 or an error code
[302] Fix | Delete
*/
[303] Fix | Delete
GIT_EXTERN(int) git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *refname);
[304] Fix | Delete
[305] Fix | Delete
/** @} */
[306] Fix | Delete
GIT_END_DECL
[307] Fix | Delete
#endif
[308] Fix | Delete
[309] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function