Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/imh-pyth.../include/git2
File: blame.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
[6] Fix | Delete
#ifndef INCLUDE_git_blame_h__
[7] Fix | Delete
#define INCLUDE_git_blame_h__
[8] Fix | Delete
[9] Fix | Delete
#include "common.h"
[10] Fix | Delete
#include "oid.h"
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* @file git2/blame.h
[14] Fix | Delete
* @brief Git blame routines
[15] Fix | Delete
* @defgroup git_blame Git blame routines
[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
* Flags for indicating option behavior for git_blame APIs.
[23] Fix | Delete
*/
[24] Fix | Delete
typedef enum {
[25] Fix | Delete
/** Normal blame, the default */
[26] Fix | Delete
GIT_BLAME_NORMAL = 0,
[27] Fix | Delete
/** Track lines that have moved within a file (like `git blame -M`).
[28] Fix | Delete
* NOT IMPLEMENTED. */
[29] Fix | Delete
GIT_BLAME_TRACK_COPIES_SAME_FILE = (1<<0),
[30] Fix | Delete
/** Track lines that have moved across files in the same commit (like `git blame -C`).
[31] Fix | Delete
* NOT IMPLEMENTED. */
[32] Fix | Delete
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = (1<<1),
[33] Fix | Delete
/** Track lines that have been copied from another file that exists in the
[34] Fix | Delete
* same commit (like `git blame -CC`). Implies SAME_FILE.
[35] Fix | Delete
* NOT IMPLEMENTED. */
[36] Fix | Delete
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = (1<<2),
[37] Fix | Delete
/** Track lines that have been copied from another file that exists in *any*
[38] Fix | Delete
* commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
[39] Fix | Delete
* NOT IMPLEMENTED. */
[40] Fix | Delete
GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = (1<<3),
[41] Fix | Delete
/** Restrict the search of commits to those reachable following only the
[42] Fix | Delete
* first parents. */
[43] Fix | Delete
GIT_BLAME_FIRST_PARENT = (1<<4),
[44] Fix | Delete
/** Use mailmap file to map author and committer names and email addresses
[45] Fix | Delete
* to canonical real names and email addresses. The mailmap will be read
[46] Fix | Delete
* from the working directory, or HEAD in a bare repository. */
[47] Fix | Delete
GIT_BLAME_USE_MAILMAP = (1<<5),
[48] Fix | Delete
/** Ignore whitespace differences */
[49] Fix | Delete
GIT_BLAME_IGNORE_WHITESPACE = (1<<6),
[50] Fix | Delete
} git_blame_flag_t;
[51] Fix | Delete
[52] Fix | Delete
/**
[53] Fix | Delete
* Blame options structure
[54] Fix | Delete
*
[55] Fix | Delete
* Initialize with `GIT_BLAME_OPTIONS_INIT`. Alternatively, you can
[56] Fix | Delete
* use `git_blame_options_init`.
[57] Fix | Delete
*
[58] Fix | Delete
*/
[59] Fix | Delete
typedef struct git_blame_options {
[60] Fix | Delete
unsigned int version;
[61] Fix | Delete
[62] Fix | Delete
/** A combination of `git_blame_flag_t` */
[63] Fix | Delete
uint32_t flags;
[64] Fix | Delete
/** The lower bound on the number of alphanumeric
[65] Fix | Delete
* characters that must be detected as moving/copying within a file for it to
[66] Fix | Delete
* associate those lines with the parent commit. The default value is 20.
[67] Fix | Delete
* This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
[68] Fix | Delete
* flags are specified.
[69] Fix | Delete
*/
[70] Fix | Delete
uint16_t min_match_characters;
[71] Fix | Delete
/** The id of the newest commit to consider. The default is HEAD. */
[72] Fix | Delete
git_oid newest_commit;
[73] Fix | Delete
/**
[74] Fix | Delete
* The id of the oldest commit to consider.
[75] Fix | Delete
* The default is the first commit encountered with a NULL parent.
[76] Fix | Delete
*/
[77] Fix | Delete
git_oid oldest_commit;
[78] Fix | Delete
/**
[79] Fix | Delete
* The first line in the file to blame.
[80] Fix | Delete
* The default is 1 (line numbers start with 1).
[81] Fix | Delete
*/
[82] Fix | Delete
size_t min_line;
[83] Fix | Delete
/**
[84] Fix | Delete
* The last line in the file to blame.
[85] Fix | Delete
* The default is the last line of the file.
[86] Fix | Delete
*/
[87] Fix | Delete
size_t max_line;
[88] Fix | Delete
} git_blame_options;
[89] Fix | Delete
[90] Fix | Delete
#define GIT_BLAME_OPTIONS_VERSION 1
[91] Fix | Delete
#define GIT_BLAME_OPTIONS_INIT {GIT_BLAME_OPTIONS_VERSION}
[92] Fix | Delete
[93] Fix | Delete
/**
[94] Fix | Delete
* Initialize git_blame_options structure
[95] Fix | Delete
*
[96] Fix | Delete
* Initializes a `git_blame_options` with default values. Equivalent to creating
[97] Fix | Delete
* an instance with GIT_BLAME_OPTIONS_INIT.
[98] Fix | Delete
*
[99] Fix | Delete
* @param opts The `git_blame_options` struct to initialize.
[100] Fix | Delete
* @param version The struct version; pass `GIT_BLAME_OPTIONS_VERSION`.
[101] Fix | Delete
* @return Zero on success; -1 on failure.
[102] Fix | Delete
*/
[103] Fix | Delete
GIT_EXTERN(int) git_blame_options_init(
[104] Fix | Delete
git_blame_options *opts,
[105] Fix | Delete
unsigned int version);
[106] Fix | Delete
[107] Fix | Delete
/**
[108] Fix | Delete
* Structure that represents a blame hunk.
[109] Fix | Delete
*
[110] Fix | Delete
* - `lines_in_hunk` is the number of lines in this hunk
[111] Fix | Delete
* - `final_commit_id` is the OID of the commit where this line was last
[112] Fix | Delete
* changed.
[113] Fix | Delete
* - `final_start_line_number` is the 1-based line number where this hunk
[114] Fix | Delete
* begins, in the final version of the file
[115] Fix | Delete
* - `final_signature` is the author of `final_commit_id`. If
[116] Fix | Delete
* `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
[117] Fix | Delete
* real name and email address.
[118] Fix | Delete
* - `orig_commit_id` is the OID of the commit where this hunk was found. This
[119] Fix | Delete
* will usually be the same as `final_commit_id`, except when
[120] Fix | Delete
* `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
[121] Fix | Delete
* - `orig_path` is the path to the file where this hunk originated, as of the
[122] Fix | Delete
* commit specified by `orig_commit_id`.
[123] Fix | Delete
* - `orig_start_line_number` is the 1-based line number where this hunk begins
[124] Fix | Delete
* in the file named by `orig_path` in the commit specified by
[125] Fix | Delete
* `orig_commit_id`.
[126] Fix | Delete
* - `orig_signature` is the author of `orig_commit_id`. If
[127] Fix | Delete
* `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
[128] Fix | Delete
* real name and email address.
[129] Fix | Delete
* - `boundary` is 1 iff the hunk has been tracked to a boundary commit (the
[130] Fix | Delete
* root, or the commit specified in git_blame_options.oldest_commit)
[131] Fix | Delete
*/
[132] Fix | Delete
typedef struct git_blame_hunk {
[133] Fix | Delete
size_t lines_in_hunk;
[134] Fix | Delete
[135] Fix | Delete
git_oid final_commit_id;
[136] Fix | Delete
size_t final_start_line_number;
[137] Fix | Delete
git_signature *final_signature;
[138] Fix | Delete
[139] Fix | Delete
git_oid orig_commit_id;
[140] Fix | Delete
const char *orig_path;
[141] Fix | Delete
size_t orig_start_line_number;
[142] Fix | Delete
git_signature *orig_signature;
[143] Fix | Delete
[144] Fix | Delete
char boundary;
[145] Fix | Delete
} git_blame_hunk;
[146] Fix | Delete
[147] Fix | Delete
[148] Fix | Delete
/** Opaque structure to hold blame results */
[149] Fix | Delete
typedef struct git_blame git_blame;
[150] Fix | Delete
[151] Fix | Delete
/**
[152] Fix | Delete
* Gets the number of hunks that exist in the blame structure.
[153] Fix | Delete
*/
[154] Fix | Delete
GIT_EXTERN(uint32_t) git_blame_get_hunk_count(git_blame *blame);
[155] Fix | Delete
[156] Fix | Delete
/**
[157] Fix | Delete
* Gets the blame hunk at the given index.
[158] Fix | Delete
*
[159] Fix | Delete
* @param blame the blame structure to query
[160] Fix | Delete
* @param index index of the hunk to retrieve
[161] Fix | Delete
* @return the hunk at the given index, or NULL on error
[162] Fix | Delete
*/
[163] Fix | Delete
GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byindex(
[164] Fix | Delete
git_blame *blame,
[165] Fix | Delete
uint32_t index);
[166] Fix | Delete
[167] Fix | Delete
/**
[168] Fix | Delete
* Gets the hunk that relates to the given line number in the newest commit.
[169] Fix | Delete
*
[170] Fix | Delete
* @param blame the blame structure to query
[171] Fix | Delete
* @param lineno the (1-based) line number to find a hunk for
[172] Fix | Delete
* @return the hunk that contains the given line, or NULL on error
[173] Fix | Delete
*/
[174] Fix | Delete
GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byline(
[175] Fix | Delete
git_blame *blame,
[176] Fix | Delete
size_t lineno);
[177] Fix | Delete
[178] Fix | Delete
/**
[179] Fix | Delete
* Get the blame for a single file.
[180] Fix | Delete
*
[181] Fix | Delete
* @param out pointer that will receive the blame object
[182] Fix | Delete
* @param repo repository whose history is to be walked
[183] Fix | Delete
* @param path path to file to consider
[184] Fix | Delete
* @param options options for the blame operation. If NULL, this is treated as
[185] Fix | Delete
* though GIT_BLAME_OPTIONS_INIT were passed.
[186] Fix | Delete
* @return 0 on success, or an error code. (use git_error_last for information
[187] Fix | Delete
* about the error.)
[188] Fix | Delete
*/
[189] Fix | Delete
GIT_EXTERN(int) git_blame_file(
[190] Fix | Delete
git_blame **out,
[191] Fix | Delete
git_repository *repo,
[192] Fix | Delete
const char *path,
[193] Fix | Delete
git_blame_options *options);
[194] Fix | Delete
[195] Fix | Delete
[196] Fix | Delete
/**
[197] Fix | Delete
* Get blame data for a file that has been modified in memory. The `reference`
[198] Fix | Delete
* parameter is a pre-calculated blame for the in-odb history of the file. This
[199] Fix | Delete
* means that once a file blame is completed (which can be expensive), updating
[200] Fix | Delete
* the buffer blame is very fast.
[201] Fix | Delete
*
[202] Fix | Delete
* Lines that differ between the buffer and the committed version are marked as
[203] Fix | Delete
* having a zero OID for their final_commit_id.
[204] Fix | Delete
*
[205] Fix | Delete
* @param out pointer that will receive the resulting blame data
[206] Fix | Delete
* @param reference cached blame from the history of the file (usually the output
[207] Fix | Delete
* from git_blame_file)
[208] Fix | Delete
* @param buffer the (possibly) modified contents of the file
[209] Fix | Delete
* @param buffer_len number of valid bytes in the buffer
[210] Fix | Delete
* @return 0 on success, or an error code. (use git_error_last for information
[211] Fix | Delete
* about the error)
[212] Fix | Delete
*/
[213] Fix | Delete
GIT_EXTERN(int) git_blame_buffer(
[214] Fix | Delete
git_blame **out,
[215] Fix | Delete
git_blame *reference,
[216] Fix | Delete
const char *buffer,
[217] Fix | Delete
size_t buffer_len);
[218] Fix | Delete
[219] Fix | Delete
/**
[220] Fix | Delete
* Free memory allocated by git_blame_file or git_blame_buffer.
[221] Fix | Delete
*
[222] Fix | Delete
* @param blame the blame structure to free
[223] Fix | Delete
*/
[224] Fix | Delete
GIT_EXTERN(void) git_blame_free(git_blame *blame);
[225] Fix | Delete
[226] Fix | Delete
/** @} */
[227] Fix | Delete
GIT_END_DECL
[228] Fix | Delete
#endif
[229] Fix | Delete
[230] Fix | Delete
[231] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function