| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/CodeHunterDev/nodegit/master/generate/input/libgit2-docs.json | [Back] [Original] |
Creates a git_annotated_commit from the given reference.\n The resulting git_annotated_commit must be freed with\n git_annotated_commit_free.
Creates a git_annotated_commit from the given fetch head data.\n The resulting git_annotated_commit must be freed with\n git_annotated_commit_free.
Creates a git_annotated_commit from the given commit id.\n The resulting git_annotated_commit must be freed with\n git_annotated_commit_free.
An annotated commit contains information about how it was looked up, which may be useful for functions like merge or rebase to provide context to the operation. For example, conflict files will include the name of the source or target branches being merged. It is therefore preferable to use the most specific function (eg git_annotated_commit_from_ref) instead of this one when that data is known.
Creates a git_annotated_commit from a revision string.
See man gitrevisions, or http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for information on the syntax accepted.
Gets the commit ID that the given git_annotated_commit refers to.
Get the refname that the given git_annotated_commit refers to.
Frees a git_annotated_commit.
Apply a git_diff to a git_tree, and return the resulting image\n as an index.
Apply a git_diff to the given repository, making changes directly\n in the working directory, the index, or both.
Return the value type for a given attribute.
\n", "comments": "This can be either TRUE, FALSE, UNSPECIFIED (if the attribute was not set at all), or VALUE, if the attribute was set to an actual string.
If the attribute has a VALUE string, it can be accessed normally as a NULL-terminated C string.
Look up the value of one git attribute for path.
\n", "comments": "", "group": "attr" }, "git_attr_get_ext": { "type": "function", "file": "git2/attr.h", "line": 203, "lineto": 208, "args": [ { "name": "value_out", "type": "const char **", "comment": "Output of the value of the attribute. Use the GIT_ATTR_...\n macros to test for TRUE, FALSE, UNSPECIFIED, etc. or just\n use the string value for attributes set to a value. You\n should NOT modify or free this value." }, { "name": "repo", "type": "git_repository *", "comment": "The repository containing the path." }, { "name": "opts", "type": "git_attr_options *", "comment": "The `git_attr_options` to use when querying these attributes." }, { "name": "path", "type": "const char *", "comment": "The path to check for attributes. Relative paths are\n interpreted relative to the repo root. The file does\n not have to exist, but if it does not, then it will be\n treated as a plain file (not a directory)." }, { "name": "name", "type": "const char *", "comment": "The name of the attribute to look up." } ], "argline": "const char **value_out, git_repository *repo, git_attr_options *opts, const char *path, const char *name", "sig": "const char **::git_repository *::git_attr_options *::const char *::const char *", "return": { "type": "int", "comment": null }, "description": "Look up the value of one git attribute for path with extended options.
\n", "comments": "", "group": "attr" }, "git_attr_get_many": { "type": "function", "file": "git2/attr.h", "line": 239, "lineto": 245, "args": [ { "name": "values_out", "type": "const char **", "comment": "An array of num_attr entries that will have string\n pointers written into it for the values of the attributes.\n You should not modify or free the values that are written\n into this array (although of course, you should free the\n array itself if you allocated it)." }, { "name": "repo", "type": "git_repository *", "comment": "The repository containing the path." }, { "name": "flags", "type": "uint32_t", "comment": "A combination of GIT_ATTR_CHECK... flags." }, { "name": "path", "type": "const char *", "comment": "The path inside the repo to check attributes. This\n does not have to exist, but if it does not, then\n it will be treated as a plain file (i.e. not a directory)." }, { "name": "num_attr", "type": "size_t", "comment": "The number of attributes being looked up" }, { "name": "names", "type": "const char **", "comment": "An array of num_attr strings containing attribute names." } ], "argline": "const char **values_out, git_repository *repo, uint32_t flags, const char *path, size_t num_attr, const char **names", "sig": "const char **::git_repository *::uint32_t::const char *::size_t::const char **", "return": { "type": "int", "comment": null }, "description": "Look up a list of git attributes for path.
\n", "comments": "Use this if you have a known list of attributes that you want to look up in a single call. This is somewhat more efficient than calling git_attr_get() multiple times.
For example, you might write:
\n\n const char *attrs[] = { "crlf", "diff", "foo" }; const char **values[3]; git_attr_get_many(values, repo, 0, "my/fun/file.c", 3, attrs);\n\n\nThen you could loop through the 3 values to get the settings for the three attributes you asked about.
\n", "group": "attr" }, "git_attr_get_many_ext": { "type": "function", "file": "git2/attr.h", "line": 263, "lineto": 269, "args": [ { "name": "values_out", "type": "const char **", "comment": "An array of num_attr entries that will have string\n pointers written into it for the values of the attributes.\n You should not modify or free the values that are written\n into this array (although of course, you should free the\n array itself if you allocated it)." }, { "name": "repo", "type": "git_repository *", "comment": "The repository containing the path." }, { "name": "opts", "type": "git_attr_options *", "comment": "The `git_attr_options` to use when querying these attributes." }, { "name": "path", "type": "const char *", "comment": "The path inside the repo to check attributes. This\n does not have to exist, but if it does not, then\n it will be treated as a plain file (i.e. not a directory)." }, { "name": "num_attr", "type": "size_t", "comment": "The number of attributes being looked up" }, { "name": "names", "type": "const char **", "comment": "An array of num_attr strings containing attribute names." } ], "argline": "const char **values_out, git_repository *repo, git_attr_options *opts, const char *path, size_t num_attr, const char **names", "sig": "const char **::git_repository *::git_attr_options *::const char *::size_t::const char **", "return": { "type": "int", "comment": null }, "description": "Look up a list of git attributes for path with extended options.
\n", "comments": "", "group": "attr" }, "git_attr_foreach": { "type": "function", "file": "git2/attr.h", "line": 302, "lineto": 307, "args": [ { "name": "repo", "type": "git_repository *", "comment": "The repository containing the path." }, { "name": "flags", "type": "uint32_t", "comment": "A combination of GIT_ATTR_CHECK... flags." }, { "name": "path", "type": "const char *", "comment": "Path inside the repo to check attributes. This does not have\n to exist, but if it does not, then it will be treated as a\n plain file (i.e. not a directory)." }, { "name": "callback", "type": "git_attr_foreach_cb", "comment": "Function to invoke on each attribute name and value.\n See git_attr_foreach_cb." }, { "name": "payload", "type": "void *", "comment": "Passed on as extra parameter to callback function." } ], "argline": "git_repository *repo, uint32_t flags, const char *path, git_attr_foreach_cb callback, void *payload", "sig": "git_repository *::uint32_t::const char *::git_attr_foreach_cb::void *", "return": { "type": "int", "comment": " 0 on success, non-zero callback return value, or error code" }, "description": "Loop over all the git attributes for a path.
\n", "comments": "", "group": "attr" }, "git_attr_foreach_ext": { "type": "function", "file": "git2/attr.h", "line": 322, "lineto": 327, "args": [ { "name": "repo", "type": "git_repository *", "comment": "The repository containing the path." }, { "name": "opts", "type": "git_attr_options *", "comment": "The `git_attr_options` to use when querying these attributes." }, { "name": "path", "type": "const char *", "comment": "Path inside the repo to check attributes. This does not have\n to exist, but if it does not, then it will be treated as a\n plain file (i.e. not a directory)." }, { "name": "callback", "type": "git_attr_foreach_cb", "comment": "Function to invoke on each attribute name and value.\n See git_attr_foreach_cb." }, { "name": "payload", "type": "void *", "comment": "Passed on as extra parameter to callback function." } ], "argline": "git_repository *repo, git_attr_options *opts, const char *path, git_attr_foreach_cb callback, void *payload", "sig": "git_repository *::git_attr_options *::const char *::git_attr_foreach_cb::void *", "return": { "type": "int", "comment": " 0 on success, non-zero callback return value, or error code" }, "description": "Loop over all the git attributes for a path with extended options.
\n", "comments": "", "group": "attr" }, "git_attr_cache_flush": { "type": "function", "file": "git2/attr.h", "line": 340, "lineto": 341, "args": [ { "name": "repo", "type": "git_repository *", "comment": "The repository containing the gitattributes cache" } ], "argline": "git_repository *repo", "sig": "git_repository *", "return": { "type": "int", "comment": " 0 on success, or an error code" }, "description": "Flush the gitattributes cache.
\n", "comments": "Call this if you have reason to believe that the attributes files on disk no longer match the cached contents of memory. This will cause the attributes files to be reloaded the next time that an attribute access function is called.
\n", "group": "attr" }, "git_attr_add_macro": { "type": "function", "file": "git2/attr.h", "line": 353, "lineto": 356, "args": [ { "name": "repo", "type": "git_repository *", "comment": null }, { "name": "name", "type": "const char *", "comment": null }, { "name": "values", "type": "const char *", "comment": null } ], "argline": "git_repository *repo, const char *name, const char *values", "sig": "git_repository *::const char *::const char *", "return": { "type": "int", "comment": null }, "description": "Add a macro definition.
\n", "comments": "Macros will automatically be loaded from the top level .gitattributes file of the repository (plus the build-in "binary" macro). This function allows you to add others. For example, to add the default macro, you would call:
git_attr_add_macro(repo, "binary", "-diff -crlf");\n\n",
"group": "attr"
},
"git_blame_options_init": {
"type": "function",
"file": "git2/blame.h",
"line": 138,
"lineto": 140,
"args": [
{
"name": "opts",
"type": "git_blame_options *",
"comment": "The `git_blame_options` struct to initialize."
},
{
"name": "version",
"type": "unsigned int",
"comment": "The struct version; pass `GIT_BLAME_OPTIONS_VERSION`."
}
],
"argline": "git_blame_options *opts, unsigned int version",
"sig": "git_blame_options *::unsigned int",
"return": {
"type": "int",
"comment": " Zero on success; -1 on failure."
},
"description": "Initialize git_blame_options structure
\n", "comments": "Initializes a git_blame_options with default values. Equivalent to creating an instance with GIT_BLAME_OPTIONS_INIT.
Gets the number of hunks that exist in the blame structure.
\n", "comments": "", "group": "blame" }, "git_blame_get_hunk_byindex": { "type": "function", "file": "git2/blame.h", "line": 216, "lineto": 218, "args": [ { "name": "blame", "type": "git_blame *", "comment": "the blame structure to query" }, { "name": "index", "type": "uint32_t", "comment": "index of the hunk to retrieve" } ], "argline": "git_blame *blame, uint32_t index", "sig": "git_blame *::uint32_t", "return": { "type": "const git_blame_hunk *", "comment": " the hunk at the given index, or NULL on error" }, "description": "Gets the blame hunk at the given index.
\n", "comments": "", "group": "blame" }, "git_blame_get_hunk_byline": { "type": "function", "file": "git2/blame.h", "line": 227, "lineto": 229, "args": [ { "name": "blame", "type": "git_blame *", "comment": "the blame structure to query" }, { "name": "lineno", "type": "size_t", "comment": "the (1-based) line number to find a hunk for" } ], "argline": "git_blame *blame, size_t lineno", "sig": "git_blame *::size_t", "return": { "type": "const git_blame_hunk *", "comment": " the hunk that contains the given line, or NULL on error" }, "description": "Gets the hunk that relates to the given line number in the newest commit.
\n", "comments": "", "group": "blame", "examples": { "blame.c": [ "ex/v1.3.1/blame.html#git_blame_get_hunk_byline-1" ] } }, "git_blame_file": { "type": "function", "file": "git2/blame.h", "line": 242, "lineto": 246, "args": [ { "name": "out", "type": "git_blame **", "comment": "pointer that will receive the blame object" }, { "name": "repo", "type": "git_repository *", "comment": "repository whose history is to be walked" }, { "name": "path", "type": "const char *", "comment": "path to file to consider" }, { "name": "options", "type": "git_blame_options *", "comment": "options for the blame operation. If NULL, this is treated as\n though GIT_BLAME_OPTIONS_INIT were passed." } ], "argline": "git_blame **out, git_repository *repo, const char *path, git_blame_options *options", "sig": "git_blame **::git_repository *::const char *::git_blame_options *", "return": { "type": "int", "comment": " 0 on success, or an error code. (use git_error_last for information\n about the error.)" }, "description": "Get the blame for a single file.
\n", "comments": "", "group": "blame", "examples": { "blame.c": [ "ex/v1.3.1/blame.html#git_blame_file-2" ] } }, "git_blame_buffer": { "type": "function", "file": "git2/blame.h", "line": 266, "lineto": 270, "args": [ { "name": "out", "type": "git_blame **", "comment": "pointer that will receive the resulting blame data" }, { "name": "reference", "type": "git_blame *", "comment": "cached blame from the history of the file (usually the output\n from git_blame_file)" }, { "name": "buffer", "type": "const char *", "comment": "the (possibly) modified contents of the file" }, { "name": "buffer_len", "type": "size_t", "comment": "number of valid bytes in the buffer" } ], "argline": "git_blame **out, git_blame *reference, const char *buffer, size_t buffer_len", "sig": "git_blame **::git_blame *::const char *::size_t", "return": { "type": "int", "comment": " 0 on success, or an error code. (use git_error_last for information\n about the error)" }, "description": "Get blame data for a file that has been modified in memory. The reference\n parameter is a pre-calculated blame for the in-odb history of the file. This\n means that once a file blame is completed (which can be expensive), updating\n the buffer blame is very fast.
Lines that differ between the buffer and the committed version are marked as having a zero OID for their final_commit_id.
\n", "group": "blame" }, "git_blame_free": { "type": "function", "file": "git2/blame.h", "line": 277, "lineto": 277, "args": [ { "name": "blame", "type": "git_blame *", "comment": "the blame structure to free" } ], "argline": "git_blame *blame", "sig": "git_blame *", "return": { "type": "void", "comment": null }, "description": "Free memory allocated by git_blame_file or git_blame_buffer.
\n", "comments": "", "group": "blame", "examples": { "blame.c": [ "ex/v1.3.1/blame.html#git_blame_free-3" ] } }, "git_blob_lookup": { "type": "function", "file": "git2/blob.h", "line": 33, "lineto": 33, "args": [ { "name": "blob", "type": "git_blob **", "comment": "pointer to the looked up blob" }, { "name": "repo", "type": "git_repository *", "comment": "the repo to use when locating the blob." }, { "name": "id", "type": "const git_oid *", "comment": "identity of the blob to locate." } ], "argline": "git_blob **blob, git_repository *repo, const git_oid *id", "sig": "git_blob **::git_repository *::const git_oid *", "return": { "type": "int", "comment": " 0 or an error code" }, "description": "Lookup a blob object from a repository.
\n", "comments": "", "group": "blob", "examples": { "blame.c": [ "ex/v1.3.1/blame.html#git_blob_lookup-4" ], "general.c": [ "ex/v1.3.1/general.html#git_blob_lookup-1" ] } }, "git_blob_lookup_prefix": { "type": "function", "file": "git2/blob.h", "line": 47, "lineto": 47, "args": [ { "name": "blob", "type": "git_blob **", "comment": "pointer to the looked up blob" }, { "name": "repo", "type": "git_repository *", "comment": "the repo to use when locating the blob." }, { "name": "id", "type": "const git_oid *", "comment": "identity of the blob to locate." }, { "name": "len", "type": "size_t", "comment": "the length of the short identifier" } ], "argline": "git_blob **blob, git_repository *repo, const git_oid *id, size_t len", "sig": "git_blob **::git_repository *::const git_oid *::size_t", "return": { "type": "int", "comment": " 0 or an error code" }, "description": "Lookup a blob object from a repository,\n given a prefix of its identifier (short id).
\n", "comments": "", "group": "blob" }, "git_blob_free": { "type": "function", "file": "git2/blob.h", "line": 60, "lineto": 60, "args": [ { "name": "blob", "type": "git_blob *", "comment": "the blob to close" } ], "argline": "git_blob *blob", "sig": "git_blob *", "return": { "type": "void", "comment": null }, "description": "Close an open blob
\n", "comments": "This is a wrapper around git_object_free()
\n\nIMPORTANT: It is necessary to call this method when you stop using a blob. Failure to do so will cause a memory leak.
\n", "group": "blob", "examples": { "blame.c": [ "ex/v1.3.1/blame.html#git_blob_free-5" ], "general.c": [ "ex/v1.3.1/general.html#git_blob_free-2" ] } }, "git_blob_id": { "type": "function", "file": "git2/blob.h", "line": 68, "lineto": 68, "args": [ { "name": "blob", "type": "const git_blob *", "comment": "a previously loaded blob." } ], "argline": "const git_blob *blob", "sig": "const git_blob *", "return": { "type": "const git_oid *", "comment": " SHA1 hash for this blob." }, "description": "Get the id of a blob.
\n", "comments": "", "group": "blob" }, "git_blob_owner": { "type": "function", "file": "git2/blob.h", "line": 76, "lineto": 76, "args": [ { "name": "blob", "type": "const git_blob *", "comment": "A previously loaded blob." } ], "argline": "const git_blob *blob", "sig": "const git_blob *", "return": { "type": "git_repository *", "comment": " Repository that contains this blob." }, "description": "Get the repository that contains the blob.
\n", "comments": "", "group": "blob" }, "git_blob_rawcontent": { "type": "function", "file": "git2/blob.h", "line": 89, "lineto": 89, "args": [ { "name": "blob", "type": "const git_blob *", "comment": "pointer to the blob" } ], "argline": "const git_blob *blob", "sig": "const git_blob *", "return": { "type": "const void *", "comment": " the pointer, or NULL on error" }, "description": "Get a read-only buffer with the raw content of a blob.
\n", "comments": "A pointer to the raw content of a blob is returned; this pointer is owned internally by the object and shall not be free'd. The pointer may be invalidated at a later time.
\n", "group": "blob", "examples": { "blame.c": [ "ex/v1.3.1/blame.html#git_blob_rawcontent-6" ], "cat-file.c": [ "ex/v1.3.1/cat-file.html#git_blob_rawcontent-1" ], "general.c": [ "ex/v1.3.1/general.html#git_blob_rawcontent-3" ] } }, "git_blob_rawsize": { "type": "function", "file": "git2/blob.h", "line": 97, "lineto": 97, "args": [ { "name": "blob", "type": "const git_blob *", "comment": "pointer to the blob" } ], "argline": "const git_blob *blob", "sig": "const git_blob *", "return": { "type": "git_object_size_t", "comment": " size on bytes" }, "description": "Get the size in bytes of the contents of a blob
\n", "comments": "", "group": "blob", "examples": { "blame.c": [ "ex/v1.3.1/blame.html#git_blob_rawsize-7" ], "cat-file.c": [ "ex/v1.3.1/cat-file.html#git_blob_rawsize-2" ], "general.c": [ "ex/v1.3.1/general.html#git_blob_rawsize-4", "ex/v1.3.1/general.html#git_blob_rawsize-5" ] } }, "git_blob_filter_options_init": { "type": "function", "file": "git2/blob.h", "line": 164, "lineto": 164, "args": [ { "name": "opts", "type": "git_blob_filter_options *", "comment": "The `git_blob_filter_options` struct to initialize." }, { "name": "version", "type": "unsigned int", "comment": "The struct version; pass `GIT_BLOB_FILTER_OPTIONS_VERSION`." } ], "argline": "git_blob_filter_options *opts, unsigned int version", "sig": "git_blob_filter_options *::unsigned int", "return": { "type": "int", "comment": " Zero on success; -1 on failure." }, "description": "Initialize git_blob_filter_options structure
\n", "comments": "Initializes a git_blob_filter_options with default values. Equivalent to creating an instance with GIT_BLOB_FILTER_OPTIONS_INIT.
Get a buffer with the filtered content of a blob.
\n", "comments": "This applies filters as if the blob was being checked out to the working directory under the specified filename. This may apply CRLF filtering or other types of changes depending on the file attributes set for the blob and the content detected in it.
\n\nThe output is written into a git_buf which the caller must free when done (via git_buf_dispose).
If no filters need to be applied, then the out buffer will just be populated with a pointer to the raw content of the blob. In that case, be careful to not free the blob until done with the buffer or copy it into memory you own.
Read a file from the working folder of a repository\n and write it to the Object Database as a loose blob
\n", "comments": "", "group": "blob" }, "git_blob_create_from_disk": { "type": "function", "file": "git2/blob.h", "line": 217, "lineto": 217, "args": [ { "name": "id", "type": "git_oid *", "comment": "return the id of the written blob" }, { "name": "repo", "type": "git_repository *", "comment": "repository where the blob will be written.\n\tthis repository can be bare or not" }, { "name": "path", "type": "const char *", "comment": "file from which the blob will be created" } ], "argline": "git_oid *id, git_repository *repo, const char *path", "sig": "git_oid *::git_repository *::const char *", "return": { "type": "int", "comment": " 0 or an error code" }, "description": "Read a file from the filesystem and write its content\n to the Object Database as a loose blob
\n", "comments": "", "group": "blob" }, "git_blob_create_from_stream": { "type": "function", "file": "git2/blob.h", "line": 244, "lineto": 247, "args": [ { "name": "out", "type": "git_writestream **", "comment": "the stream into which to write" }, { "name": "repo", "type": "git_repository *", "comment": "Repository where the blob will be written.\n This repository can be bare or not." }, { "name": "hintpath", "type": "const char *", "comment": "If not NULL, will be used to select data filters\n to apply onto the content of the blob to be created." } ], "argline": "git_writestream **out, git_repository *repo, const char *hintpath", "sig": "git_writestream **::git_repository *::const char *", "return": { "type": "int", "comment": " 0 or error code" }, "description": "Create a stream to write a new blob into the object db
\n", "comments": "This function may need to buffer the data on disk and will in general not be the right choice if you know the size of the data to write. If you have data in memory, use git_blob_create_from_buffer(). If you do not, but know the size of the contents (and don't want/need to perform filtering), use git_odb_open_wstream().
Don't close this stream yourself but pass it to git_blob_create_from_stream_commit() to commit the write to the object db and get the object id.
If the hintpath parameter is filled, it will be used to determine what git filters should be applied to the object before it is written to the object database.
Close the stream and write the blob to the object db
\n", "comments": "The stream will be closed and freed.
\n", "group": "blob" }, "git_blob_create_from_buffer": { "type": "function", "file": "git2/blob.h", "line": 271, "lineto": 272, "args": [ { "name": "id", "type": "git_oid *", "comment": "return the id of the written blob" }, { "name": "repo", "type": "git_repository *", "comment": "repository where the blob will be written" }, { "name": "buffer", "type": "const void *", "comment": "data to be written into the blob" }, { "name": "len", "type": "size_t", "comment": "length of the data" } ], "argline": "git_oid *id, git_repository *repo, const void *buffer, size_t len", "sig": "git_oid *::git_repository *::const void *::size_t", "return": { "type": "int", "comment": " 0 or an error code" }, "description": "Write an in-memory buffer to the ODB as a blob
\n", "comments": "", "group": "blob" }, "git_blob_is_binary": { "type": "function", "file": "git2/blob.h", "line": 285, "lineto": 285, "args": [ { "name": "blob", "type": "const git_blob *", "comment": "The blob which content should be analyzed" } ], "argline": "const git_blob *blob", "sig": "const git_blob *", "return": { "type": "int", "comment": " 1 if the content of the blob is detected\n as binary; 0 otherwise." }, "description": "Determine if the blob content is most certainly binary or not.
\n", "comments": "The heuristic used to guess if a file is binary is taken from core git: Searching for NUL bytes and looking for a reasonable ratio of printable to non-printable characters among the first 8000 bytes.
\n", "group": "blob" }, "git_blob_dup": { "type": "function", "file": "git2/blob.h", "line": 294, "lineto": 294, "args": [ { "name": "out", "type": "git_blob **", "comment": "Pointer to store the copy of the object" }, { "name": "source", "type": "git_blob *", "comment": "Original object to copy" } ], "argline": "git_blob **out, git_blob *source", "sig": "git_blob **::git_blob *", "return": { "type": "int", "comment": null }, "description": "Create an in-memory copy of a blob. The copy must be explicitly\n free'd or it will leak.
\n", "comments": "", "group": "blob" }, "git_branch_create": { "type": "function", "file": "git2/branch.h", "line": 50, "lineto": 55, "args": [ { "name": "out", "type": "git_reference **", "comment": "Pointer where to store the underlying reference." }, { "name": "repo", "type": "git_repository *", "comment": null }, { "name": "branch_name", "type": "const char *", "comment": "Name for the branch; this name is\n validated for consistency. It should also not conflict with\n an already existing branch name." }, { "name": "target", "type": "const git_commit *", "comment": "Commit to which this branch should point. This object\n must belong to the given `repo`." }, { "name": "force", "type": "int", "comment": "Overwrite existing branch." } ], "argline": "git_reference **out, git_repository *repo, const char *branch_name, const git_commit *target, int force", "sig": "git_reference **::git_repository *::const char *::const git_commit *::int", "return": { "type": "int", "comment": " 0, GIT_EINVALIDSPEC or an error code.\n A proper reference is written in the refs/heads namespace\n pointing to the provided target commit." }, "description": "Create a new branch pointing at a target commit
\n", "comments": "A new direct reference will be created pointing to this target commit. If force is true and a reference already exists with the given name, it'll be replaced.
The returned reference must be freed by the user.
\n\nThe branch name will be checked for validity. See git_tag_create() for rules about valid names.
Create a new branch pointing at a target commit
\n", "comments": "This behaves like git_branch_create() but takes an annotated commit, which lets you specify which extended sha syntax string was specified by a user, allowing for more exact reflog messages.
See the documentation for git_branch_create().
Delete an existing branch reference.
\n", "comments": "Note that if the deletion succeeds, the reference object will not be valid anymore, and should be freed immediately by the user using git_reference_free().
Create an iterator which loops over the requested branches.
\n", "comments": "", "group": "branch" }, "git_branch_next": { "type": "function", "file": "git2/branch.h", "line": 114, "lineto": 114, "args": [ { "name": "out", "type": "git_reference **", "comment": "the reference" }, { "name": "out_type", "type": "git_branch_t *", "comment": "the type of branch (local or remote-tracking)" }, { "name": "iter", "type": "git_branch_iterator *", "comment": "the branch iterator" } ], "argline": "git_reference **out, git_branch_t *out_type, git_branch_iterator *iter", "sig": "git_reference **::git_branch_t *::git_branch_iterator *", "return": { "type": "int", "comment": " 0 on success, GIT_ITEROVER if there are no more branches or an error code." }, "description": "Retrieve the next branch from the iterator
\n", "comments": "", "group": "branch" }, "git_branch_iterator_free": { "type": "function", "file": "git2/branch.h", "line": 121, "lineto": 121, "args": [ { "name": "iter", "type": "git_branch_iterator *", "comment": "the iterator to free" } ], "argline": "git_branch_iterator *iter", "sig": "git_branch_iterator *", "return": { "type": "void", "comment": null }, "description": "Free a branch iterator
\n", "comments": "", "group": "branch" }, "git_branch_move": { "type": "function", "file": "git2/branch.h", "line": 144, "lineto": 148, "args": [ { "name": "out", "type": "git_reference **", "comment": "New reference object for the updated name." }, { "name": "branch", "type": "git_reference *", "comment": "Current underlying reference of the branch." }, { "name": "new_branch_name", "type": "const char *", "comment": "Target name of the branch once the move\n is performed; this name is validated for consistency." }, { "name": "force", "type": "int", "comment": "Overwrite existing branch." } ], "argline": "git_reference **out, git_reference *branch, const char *new_branch_name, int force", "sig": "git_reference **::git_reference *::const char *::int", "return": { "type": "int", "comment": " 0 on success, GIT_EINVALIDSPEC or an error code." }, "description": "Move/rename an existing local branch reference.
\n", "comments": "The new branch name will be checked for validity. See git_tag_create() for rules about valid names.
Note that if the move succeeds, the old reference object will not + be valid anymore, and should be freed immediately by the user using + git_reference_free().
Lookup a branch by its name in a repository.
\n", "comments": "The generated reference must be freed by the user. The branch name will be checked for validity.
\n", "group": "branch" }, "git_branch_name": { "type": "function", "file": "git2/branch.h", "line": 189, "lineto": 191, "args": [ { "name": "out", "type": "const char **", "comment": "Pointer to the abbreviated reference name.\n Owned by ref, do not free." }, { "name": "ref", "type": "const git_reference *", "comment": "A reference object, ideally pointing to a branch" } ], "argline": "const char **out, const git_reference *ref", "sig": "const char **::const git_reference *", "return": { "type": "int", "comment": " 0 on success; GIT_EINVALID if the reference isn't either a local or\n remote branch, otherwise an error code." }, "description": "Get the branch name
\n", "comments": "Given a reference object, this will check that it really is a branch (ie. it lives under "refs/heads/" or "refs/remotes/"), and return the branch part of it.
\n", "group": "branch", "examples": { "merge.c": [ "ex/v1.3.1/merge.html#git_branch_name-4" ] } }, "git_branch_upstream": { "type": "function", "file": "git2/branch.h", "line": 207, "lineto": 209, "args": [ { "name": "out", "type": "git_reference **", "comment": "Pointer where to store the retrieved reference." }, { "name": "branch", "type": "const git_reference *", "comment": "Current underlying reference of the branch." } ], "argline": "git_reference **out, const git_reference *branch", "sig": "git_reference **::const git_reference *", "return": { "type": "int", "comment": " 0 on success; GIT_ENOTFOUND when no remote tracking\n reference exists, otherwise an error code." }, "description": "Get the upstream of a branch
\n", "comments": "Given a reference, this will return a new reference object corresponding to its remote tracking branch. The reference must be a local branch.
\n", "group": "branch" }, "git_branch_set_upstream": { "type": "function", "file": "git2/branch.h", "line": 226, "lineto": 228, "args": [ { "name": "branch", "type": "git_reference *", "comment": "the branch to configure" }, { "name": "branch_name", "type": "const char *", "comment": "remote-tracking or local branch to set as upstream." } ], "argline": "git_reference *branch, const char *branch_name", "sig": "git_reference *::const char *", "return": { "type": "int", "comment": " 0 on success; GIT_ENOTFOUND if there's no branch named `branch_name`\n or an error code" }, "description": "Set a branch's upstream branch
\n", "comments": "This will update the configuration to set the branch named branch_name as the upstream of branch. Pass a NULL name to unset the upstream information.
Get the upstream name of a branch
\n", "comments": "Given a local branch, this will return its remote-tracking branch information, as a full reference name, ie. "feature/nice" would become "refs/remote/origin/feature/nice", depending on that branch's configuration.
\n", "group": "branch" }, "git_branch_is_head": { "type": "function", "file": "git2/branch.h", "line": 257, "lineto": 258, "args": [ { "name": "branch", "type": "const git_reference *", "comment": "A reference to a local branch." } ], "argline": "const git_reference *branch", "sig": "const git_reference *", "return": { "type": "int", "comment": " 1 if HEAD points at the branch, 0 if it isn't, or a negative value\n \t\t as an error code." }, "description": "Determine if HEAD points to the given branch
\n", "comments": "", "group": "branch" }, "git_branch_is_checked_out": { "type": "function", "file": "git2/branch.h", "line": 270, "lineto": 271, "args": [ { "name": "branch", "type": "const git_reference *", "comment": "A reference to a local branch." } ], "argline": "const git_reference *branch", "sig": "const git_reference *", "return": { "type": "int", "comment": " 1 if branch is checked out, 0 if it isn't, an error code otherwise." }, "description": "Determine if any HEAD points to the current branch
\n", "comments": "This will iterate over all known linked repositories (usually in the form of worktrees) and report whether any HEAD is pointing at the current branch.
\n", "group": "branch" }, "git_branch_remote_name": { "type": "function", "file": "git2/branch.h", "line": 289, "lineto": 292, "args": [ { "name": "out", "type": "git_buf *", "comment": "The buffer into which the name will be written." }, { "name": "repo", "type": "git_repository *", "comment": "The repository where the branch lives." }, { "name": "refname", "type": "const char *", "comment": "complete name of the remote tracking branch." } ], "argline": "git_buf *out, git_repository *repo, const char *refname", "sig": "git_buf *::git_repository *::const char *", "return": { "type": "int", "comment": " 0 on success, GIT_ENOTFOUND when no matching remote was found,\n GIT_EAMBIGUOUS when the branch maps to several remotes,\n otherwise an error code." }, "description": "Find the remote name of a remote-tracking branch
\n", "comments": "This will return the name of the remote whose fetch refspec is matching the given branch. E.g. given a branch "refs/remotes/test/master", it will extract the "test" part. If refspecs from multiple remotes match, the function will return GIT_EAMBIGUOUS.
\n", "group": "branch" }, "git_branch_upstream_remote": { "type": "function", "file": "git2/branch.h", "line": 305, "lineto": 305, "args": [ { "name": "buf", "type": "git_buf *", "comment": "the buffer into which to write the name" }, { "name": "repo", "type": "git_repository *", "comment": "the repository in which to look" }, { "name": "refname", "type": "const char *", "comment": "the full name of the branch" } ], "argline": "git_buf *buf, git_repository *repo, const char *refname", "sig": "git_buf *::git_repository *::const char *", "return": { "type": "int", "comment": " 0 or an error code" }, "description": "Retrieve the upstream remote of a local branch
\n", "comments": "This will return the currently configured "branch.*.remote" for a given branch. This branch must be local.
\n", "group": "branch" }, "git_branch_upstream_merge": { "type": "function", "file": "git2/branch.h", "line": 318, "lineto": 318, "args": [ { "name": "buf", "type": "git_buf *", "comment": "the buffer into which to write the name" }, { "name": "repo", "type": "git_repository *", "comment": "the repository in which to look" }, { "name": "refname", "type": "const char *", "comment": "the full name of the branch" } ], "argline": "git_buf *buf, git_repository *repo, const char *refname", "sig": "git_buf *::git_repository *::const char *", "return": { "type": "int", "comment": " 0 or an error code" }, "description": "Retrieve the upstream merge of a local branch
\n", "comments": "This will return the currently configured "branch.*.merge" for a given branch. This branch must be local.
\n", "group": "branch" }, "git_branch_name_is_valid": { "type": "function", "file": "git2/branch.h", "line": 330, "lineto": 330, "args": [ { "name": "valid", "type": "int *", "comment": "output pointer to set with validity of given branch name" }, { "name": "name", "type": "const char *", "comment": "a branch name to test" } ], "argline": "int *valid, const char *name", "sig": "int *::const char *", "return": { "type": "int", "comment": " 0 on success or an error code" }, "description": "Determine whether a branch name is valid, meaning that (when prefixed\n with refs/heads/) that it is a valid reference name, and that any\n additional branch name restrictions are imposed (eg, it cannot start\n with a -).
Free the memory referred to by the git_buf.
\n", "comments": "Note that this does not free the git_buf itself, just the memory pointed to by buffer->ptr. This will not free the memory if it looks like it was not allocated internally, but it will clear the buffer back to the empty state.
Resize the buffer allocation to make more space.
\n", "comments": "This will attempt to grow the buffer to accommodate the target size.
\n\nIf the buffer refers to memory that was not allocated by libgit2 (i.e. the asize field is zero), then ptr will be replaced with a newly allocated block of data. Be careful so that memory allocated by the caller is not lost. As a special variant, if you pass target_size as 0 and the memory is not allocated by libgit2, this will allocate a new buffer of size size and copy the external data into it.
Currently, this will never shrink a buffer, only expand it.
\n\nIf the allocation fails, this will return an error and the buffer will be marked as invalid for future operations, invaliding the contents.
\n", "group": "buf" }, "git_buf_set": { "type": "function", "file": "git2/deprecated.h", "line": 230, "lineto": 231, "args": [ { "name": "buffer", "type": "git_buf *", "comment": "The buffer to set" }, { "name": "data", "type": "const void *", "comment": "The data to copy into the buffer" }, { "name": "datalen", "type": "size_t", "comment": "The length of the data to copy into the buffer" } ], "argline": "git_buf *buffer, const void *data, size_t datalen", "sig": "git_buf *::const void *::size_t", "return": { "type": "int", "comment": " 0 on success, -1 on allocation failure" }, "description": "Set buffer to a copy of some raw data.
\n", "comments": "", "group": "buf" }, "git_buf_is_binary": { "type": "function", "file": "git2/deprecated.h", "line": 239, "lineto": 239, "args": [ { "name": "buf", "type": "const git_buf *", "comment": "Buffer to check" } ], "argline": "const git_buf *buf", "sig": "const git_buf *", "return": { "type": "int", "comment": " 1 if buffer looks like non-text data" }, "description": "Check quickly if buffer looks like it contains binary data
\n", "comments": "", "group": "buf" }, "git_buf_contains_nul": { "type": "function", "file": "git2/deprecated.h", "line": 247, "lineto": 247, "args": [ { "name": "buf", "type": "const git_buf *", "comment": "Buffer to check" } ], "argline": "const git_buf *buf", "sig": "const git_buf *", "return": { "type": "int", "comment": " 1 if buffer contains a NUL byte" }, "description": "Check quickly if buffer contains a NUL byte
\n", "comments": "", "group": "buf" }, "git_checkout_options_init": { "type": "function", "file": "git2/checkout.h", "line": 357, "lineto": 359, "args": [ { "name": "opts", "type": "git_checkout_options *", "comment": "The `git_checkout_options` struct to initialize." }, { "name": "version", "type": "unsigned int", "comment": "The struct version; pass `GIT_CHECKOUT_OPTIONS_VERSION`." } ], "argline": "git_checkout_options *opts, unsigned int version", "sig": "git_checkout_options *::unsigned int", "return": { "type": "int", "comment": " Zero on success; -1 on failure." }, "description": "Initialize git_checkout_options structure
\n", "comments": "Initializes a git_checkout_options with default values. Equivalent to creating an instance with GIT_CHECKOUT_OPTIONS_INIT.
| Web Proxy Viewer | New URL | Original Page |