Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/imh-pyth.../include/git2
File: attr.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_attr_h__
[6] Fix | Delete
#define INCLUDE_git_attr_h__
[7] Fix | Delete
[8] Fix | Delete
#include "common.h"
[9] Fix | Delete
#include "types.h"
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* @file git2/attr.h
[13] Fix | Delete
* @brief Git attribute management routines
[14] Fix | Delete
* @defgroup git_attr Git attribute management routines
[15] Fix | Delete
* @ingroup Git
[16] Fix | Delete
* @{
[17] Fix | Delete
*/
[18] Fix | Delete
GIT_BEGIN_DECL
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* GIT_ATTR_TRUE checks if an attribute is set on. In core git
[22] Fix | Delete
* parlance, this the value for "Set" attributes.
[23] Fix | Delete
*
[24] Fix | Delete
* For example, if the attribute file contains:
[25] Fix | Delete
*
[26] Fix | Delete
* *.c foo
[27] Fix | Delete
*
[28] Fix | Delete
* Then for file `xyz.c` looking up attribute "foo" gives a value for
[29] Fix | Delete
* which `GIT_ATTR_TRUE(value)` is true.
[30] Fix | Delete
*/
[31] Fix | Delete
#define GIT_ATTR_IS_TRUE(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_TRUE)
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* GIT_ATTR_FALSE checks if an attribute is set off. In core git
[35] Fix | Delete
* parlance, this is the value for attributes that are "Unset" (not to
[36] Fix | Delete
* be confused with values that a "Unspecified").
[37] Fix | Delete
*
[38] Fix | Delete
* For example, if the attribute file contains:
[39] Fix | Delete
*
[40] Fix | Delete
* *.h -foo
[41] Fix | Delete
*
[42] Fix | Delete
* Then for file `zyx.h` looking up attribute "foo" gives a value for
[43] Fix | Delete
* which `GIT_ATTR_FALSE(value)` is true.
[44] Fix | Delete
*/
[45] Fix | Delete
#define GIT_ATTR_IS_FALSE(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_FALSE)
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* GIT_ATTR_UNSPECIFIED checks if an attribute is unspecified. This
[49] Fix | Delete
* may be due to the attribute not being mentioned at all or because
[50] Fix | Delete
* the attribute was explicitly set unspecified via the `!` operator.
[51] Fix | Delete
*
[52] Fix | Delete
* For example, if the attribute file contains:
[53] Fix | Delete
*
[54] Fix | Delete
* *.c foo
[55] Fix | Delete
* *.h -foo
[56] Fix | Delete
* onefile.c !foo
[57] Fix | Delete
*
[58] Fix | Delete
* Then for `onefile.c` looking up attribute "foo" yields a value with
[59] Fix | Delete
* `GIT_ATTR_UNSPECIFIED(value)` of true. Also, looking up "foo" on
[60] Fix | Delete
* file `onefile.rb` or looking up "bar" on any file will all give
[61] Fix | Delete
* `GIT_ATTR_UNSPECIFIED(value)` of true.
[62] Fix | Delete
*/
[63] Fix | Delete
#define GIT_ATTR_IS_UNSPECIFIED(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_UNSPECIFIED)
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* GIT_ATTR_HAS_VALUE checks if an attribute is set to a value (as
[67] Fix | Delete
* opposed to TRUE, FALSE or UNSPECIFIED). This would be the case if
[68] Fix | Delete
* for a file with something like:
[69] Fix | Delete
*
[70] Fix | Delete
* *.txt eol=lf
[71] Fix | Delete
*
[72] Fix | Delete
* Given this, looking up "eol" for `onefile.txt` will give back the
[73] Fix | Delete
* string "lf" and `GIT_ATTR_SET_TO_VALUE(attr)` will return true.
[74] Fix | Delete
*/
[75] Fix | Delete
#define GIT_ATTR_HAS_VALUE(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_STRING)
[76] Fix | Delete
[77] Fix | Delete
/**
[78] Fix | Delete
* Possible states for an attribute
[79] Fix | Delete
*/
[80] Fix | Delete
typedef enum {
[81] Fix | Delete
GIT_ATTR_VALUE_UNSPECIFIED = 0, /**< The attribute has been left unspecified */
[82] Fix | Delete
GIT_ATTR_VALUE_TRUE, /**< The attribute has been set */
[83] Fix | Delete
GIT_ATTR_VALUE_FALSE, /**< The attribute has been unset */
[84] Fix | Delete
GIT_ATTR_VALUE_STRING, /**< This attribute has a value */
[85] Fix | Delete
} git_attr_value_t;
[86] Fix | Delete
[87] Fix | Delete
/**
[88] Fix | Delete
* Return the value type for a given attribute.
[89] Fix | Delete
*
[90] Fix | Delete
* This can be either `TRUE`, `FALSE`, `UNSPECIFIED` (if the attribute
[91] Fix | Delete
* was not set at all), or `VALUE`, if the attribute was set to an
[92] Fix | Delete
* actual string.
[93] Fix | Delete
*
[94] Fix | Delete
* If the attribute has a `VALUE` string, it can be accessed normally
[95] Fix | Delete
* as a NULL-terminated C string.
[96] Fix | Delete
*
[97] Fix | Delete
* @param attr The attribute
[98] Fix | Delete
* @return the value type for the attribute
[99] Fix | Delete
*/
[100] Fix | Delete
GIT_EXTERN(git_attr_value_t) git_attr_value(const char *attr);
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Check attribute flags: Reading values from index and working directory.
[104] Fix | Delete
*
[105] Fix | Delete
* When checking attributes, it is possible to check attribute files
[106] Fix | Delete
* in both the working directory (if there is one) and the index (if
[107] Fix | Delete
* there is one). You can explicitly choose where to check and in
[108] Fix | Delete
* which order using the following flags.
[109] Fix | Delete
*
[110] Fix | Delete
* Core git usually checks the working directory then the index,
[111] Fix | Delete
* except during a checkout when it checks the index first. It will
[112] Fix | Delete
* use index only for creating archives or for a bare repo (if an
[113] Fix | Delete
* index has been specified for the bare repo).
[114] Fix | Delete
*/
[115] Fix | Delete
#define GIT_ATTR_CHECK_FILE_THEN_INDEX 0
[116] Fix | Delete
#define GIT_ATTR_CHECK_INDEX_THEN_FILE 1
[117] Fix | Delete
#define GIT_ATTR_CHECK_INDEX_ONLY 2
[118] Fix | Delete
[119] Fix | Delete
/**
[120] Fix | Delete
* Check attribute flags: controlling extended attribute behavior.
[121] Fix | Delete
*
[122] Fix | Delete
* Normally, attribute checks include looking in the /etc (or system
[123] Fix | Delete
* equivalent) directory for a `gitattributes` file. Passing this
[124] Fix | Delete
* flag will cause attribute checks to ignore that file.
[125] Fix | Delete
* equivalent) directory for a `gitattributes` file. Passing the
[126] Fix | Delete
* `GIT_ATTR_CHECK_NO_SYSTEM` flag will cause attribute checks to
[127] Fix | Delete
* ignore that file.
[128] Fix | Delete
*
[129] Fix | Delete
* Passing the `GIT_ATTR_CHECK_INCLUDE_HEAD` flag will use attributes
[130] Fix | Delete
* from a `.gitattributes` file in the repository at the HEAD revision.
[131] Fix | Delete
*/
[132] Fix | Delete
#define GIT_ATTR_CHECK_NO_SYSTEM (1 << 2)
[133] Fix | Delete
#define GIT_ATTR_CHECK_INCLUDE_HEAD (1 << 3)
[134] Fix | Delete
[135] Fix | Delete
/**
[136] Fix | Delete
* Look up the value of one git attribute for path.
[137] Fix | Delete
*
[138] Fix | Delete
* @param value_out Output of the value of the attribute. Use the GIT_ATTR_...
[139] Fix | Delete
* macros to test for TRUE, FALSE, UNSPECIFIED, etc. or just
[140] Fix | Delete
* use the string value for attributes set to a value. You
[141] Fix | Delete
* should NOT modify or free this value.
[142] Fix | Delete
* @param repo The repository containing the path.
[143] Fix | Delete
* @param flags A combination of GIT_ATTR_CHECK... flags.
[144] Fix | Delete
* @param path The path to check for attributes. Relative paths are
[145] Fix | Delete
* interpreted relative to the repo root. The file does
[146] Fix | Delete
* not have to exist, but if it does not, then it will be
[147] Fix | Delete
* treated as a plain file (not a directory).
[148] Fix | Delete
* @param name The name of the attribute to look up.
[149] Fix | Delete
*/
[150] Fix | Delete
GIT_EXTERN(int) git_attr_get(
[151] Fix | Delete
const char **value_out,
[152] Fix | Delete
git_repository *repo,
[153] Fix | Delete
uint32_t flags,
[154] Fix | Delete
const char *path,
[155] Fix | Delete
const char *name);
[156] Fix | Delete
[157] Fix | Delete
/**
[158] Fix | Delete
* Look up a list of git attributes for path.
[159] Fix | Delete
*
[160] Fix | Delete
* Use this if you have a known list of attributes that you want to
[161] Fix | Delete
* look up in a single call. This is somewhat more efficient than
[162] Fix | Delete
* calling `git_attr_get()` multiple times.
[163] Fix | Delete
*
[164] Fix | Delete
* For example, you might write:
[165] Fix | Delete
*
[166] Fix | Delete
* const char *attrs[] = { "crlf", "diff", "foo" };
[167] Fix | Delete
* const char **values[3];
[168] Fix | Delete
* git_attr_get_many(values, repo, 0, "my/fun/file.c", 3, attrs);
[169] Fix | Delete
*
[170] Fix | Delete
* Then you could loop through the 3 values to get the settings for
[171] Fix | Delete
* the three attributes you asked about.
[172] Fix | Delete
*
[173] Fix | Delete
* @param values_out An array of num_attr entries that will have string
[174] Fix | Delete
* pointers written into it for the values of the attributes.
[175] Fix | Delete
* You should not modify or free the values that are written
[176] Fix | Delete
* into this array (although of course, you should free the
[177] Fix | Delete
* array itself if you allocated it).
[178] Fix | Delete
* @param repo The repository containing the path.
[179] Fix | Delete
* @param flags A combination of GIT_ATTR_CHECK... flags.
[180] Fix | Delete
* @param path The path inside the repo to check attributes. This
[181] Fix | Delete
* does not have to exist, but if it does not, then
[182] Fix | Delete
* it will be treated as a plain file (i.e. not a directory).
[183] Fix | Delete
* @param num_attr The number of attributes being looked up
[184] Fix | Delete
* @param names An array of num_attr strings containing attribute names.
[185] Fix | Delete
*/
[186] Fix | Delete
GIT_EXTERN(int) git_attr_get_many(
[187] Fix | Delete
const char **values_out,
[188] Fix | Delete
git_repository *repo,
[189] Fix | Delete
uint32_t flags,
[190] Fix | Delete
const char *path,
[191] Fix | Delete
size_t num_attr,
[192] Fix | Delete
const char **names);
[193] Fix | Delete
[194] Fix | Delete
/**
[195] Fix | Delete
* The callback used with git_attr_foreach.
[196] Fix | Delete
*
[197] Fix | Delete
* This callback will be invoked only once per attribute name, even if there
[198] Fix | Delete
* are multiple rules for a given file. The highest priority rule will be
[199] Fix | Delete
* used.
[200] Fix | Delete
*
[201] Fix | Delete
* @see git_attr_foreach.
[202] Fix | Delete
*
[203] Fix | Delete
* @param name The attribute name.
[204] Fix | Delete
* @param value The attribute value. May be NULL if the attribute is explicitly
[205] Fix | Delete
* set to UNSPECIFIED using the '!' sign.
[206] Fix | Delete
* @param payload A user-specified pointer.
[207] Fix | Delete
* @return 0 to continue looping, non-zero to stop. This value will be returned
[208] Fix | Delete
* from git_attr_foreach.
[209] Fix | Delete
*/
[210] Fix | Delete
typedef int GIT_CALLBACK(git_attr_foreach_cb)(const char *name, const char *value, void *payload);
[211] Fix | Delete
[212] Fix | Delete
/**
[213] Fix | Delete
* Loop over all the git attributes for a path.
[214] Fix | Delete
*
[215] Fix | Delete
* @param repo The repository containing the path.
[216] Fix | Delete
* @param flags A combination of GIT_ATTR_CHECK... flags.
[217] Fix | Delete
* @param path Path inside the repo to check attributes. This does not have
[218] Fix | Delete
* to exist, but if it does not, then it will be treated as a
[219] Fix | Delete
* plain file (i.e. not a directory).
[220] Fix | Delete
* @param callback Function to invoke on each attribute name and value.
[221] Fix | Delete
* See git_attr_foreach_cb.
[222] Fix | Delete
* @param payload Passed on as extra parameter to callback function.
[223] Fix | Delete
* @return 0 on success, non-zero callback return value, or error code
[224] Fix | Delete
*/
[225] Fix | Delete
GIT_EXTERN(int) git_attr_foreach(
[226] Fix | Delete
git_repository *repo,
[227] Fix | Delete
uint32_t flags,
[228] Fix | Delete
const char *path,
[229] Fix | Delete
git_attr_foreach_cb callback,
[230] Fix | Delete
void *payload);
[231] Fix | Delete
[232] Fix | Delete
/**
[233] Fix | Delete
* Flush the gitattributes cache.
[234] Fix | Delete
*
[235] Fix | Delete
* Call this if you have reason to believe that the attributes files on
[236] Fix | Delete
* disk no longer match the cached contents of memory. This will cause
[237] Fix | Delete
* the attributes files to be reloaded the next time that an attribute
[238] Fix | Delete
* access function is called.
[239] Fix | Delete
*
[240] Fix | Delete
* @param repo The repository containing the gitattributes cache
[241] Fix | Delete
* @return 0 on success, or an error code
[242] Fix | Delete
*/
[243] Fix | Delete
GIT_EXTERN(int) git_attr_cache_flush(
[244] Fix | Delete
git_repository *repo);
[245] Fix | Delete
[246] Fix | Delete
/**
[247] Fix | Delete
* Add a macro definition.
[248] Fix | Delete
*
[249] Fix | Delete
* Macros will automatically be loaded from the top level `.gitattributes`
[250] Fix | Delete
* file of the repository (plus the build-in "binary" macro). This
[251] Fix | Delete
* function allows you to add others. For example, to add the default
[252] Fix | Delete
* macro, you would call:
[253] Fix | Delete
*
[254] Fix | Delete
* git_attr_add_macro(repo, "binary", "-diff -crlf");
[255] Fix | Delete
*/
[256] Fix | Delete
GIT_EXTERN(int) git_attr_add_macro(
[257] Fix | Delete
git_repository *repo,
[258] Fix | Delete
const char *name,
[259] Fix | Delete
const char *values);
[260] Fix | Delete
[261] Fix | Delete
/** @} */
[262] Fix | Delete
GIT_END_DECL
[263] Fix | Delete
#endif
[264] Fix | Delete
[265] Fix | Delete
[266] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function