Rename git_checkattr() to git_check_attr()
Suggested by: Junio Hamano <gitster@pobox.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ca64d061e0
commit
d932f4eb9f
@ -19,7 +19,7 @@ Data Structure
|
|||||||
`struct git_attr_check`::
|
`struct git_attr_check`::
|
||||||
|
|
||||||
This structure represents a set of attributes to check in a call
|
This structure represents a set of attributes to check in a call
|
||||||
to `git_checkattr()` function, and receives the results.
|
to `git_check_attr()` function, and receives the results.
|
||||||
|
|
||||||
|
|
||||||
Attribute Values
|
Attribute Values
|
||||||
@ -52,7 +52,7 @@ Querying Specific Attributes
|
|||||||
attributes you would want to check. To populate this array, you would
|
attributes you would want to check. To populate this array, you would
|
||||||
need to define necessary attributes by calling `git_attr()` function.
|
need to define necessary attributes by calling `git_attr()` function.
|
||||||
|
|
||||||
* Call `git_checkattr()` to check the attributes for the path.
|
* Call `git_check_attr()` to check the attributes for the path.
|
||||||
|
|
||||||
* Inspect `git_attr_check` structure to see how each of the attribute in
|
* Inspect `git_attr_check` structure to see how each of the attribute in
|
||||||
the array is defined for the path.
|
the array is defined for the path.
|
||||||
@ -78,13 +78,13 @@ static void setup_check(void)
|
|||||||
}
|
}
|
||||||
------------
|
------------
|
||||||
|
|
||||||
. Call `git_checkattr()` with the prepared array of `struct git_attr_check`:
|
. Call `git_check_attr()` with the prepared array of `struct git_attr_check`:
|
||||||
|
|
||||||
------------
|
------------
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
setup_check();
|
setup_check();
|
||||||
git_checkattr(path, ARRAY_SIZE(check), check);
|
git_check_attr(path, ARRAY_SIZE(check), check);
|
||||||
------------
|
------------
|
||||||
|
|
||||||
. Act on `.value` member of the result, left in `check[]`:
|
. Act on `.value` member of the result, left in `check[]`:
|
||||||
|
@ -123,7 +123,7 @@ static int write_archive_entry(const unsigned char *sha1, const char *base,
|
|||||||
path_without_prefix = path.buf + args->baselen;
|
path_without_prefix = path.buf + args->baselen;
|
||||||
|
|
||||||
setup_archive_check(check);
|
setup_archive_check(check);
|
||||||
if (!git_checkattr(path_without_prefix, ARRAY_SIZE(check), check)) {
|
if (!git_check_attr(path_without_prefix, ARRAY_SIZE(check), check)) {
|
||||||
if (ATTR_TRUE(check[0].value))
|
if (ATTR_TRUE(check[0].value))
|
||||||
return 0;
|
return 0;
|
||||||
convert = ATTR_TRUE(check[1].value);
|
convert = ATTR_TRUE(check[1].value);
|
||||||
|
2
attr.c
2
attr.c
@ -731,7 +731,7 @@ static void collect_all_attrs(const char *path)
|
|||||||
rem = fill(path, pathlen, stk, rem);
|
rem = fill(path, pathlen, stk, rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_checkattr(const char *path, int num, struct git_attr_check *check)
|
int git_check_attr(const char *path, int num, struct git_attr_check *check)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
4
attr.h
4
attr.h
@ -20,7 +20,7 @@ extern const char git_attr__false[];
|
|||||||
#define ATTR_UNSET(v) ((v) == NULL)
|
#define ATTR_UNSET(v) ((v) == NULL)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send one or more git_attr_check to git_checkattr(), and
|
* Send one or more git_attr_check to git_check_attr(), and
|
||||||
* each 'value' member tells what its value is.
|
* each 'value' member tells what its value is.
|
||||||
* Unset one is returned as NULL.
|
* Unset one is returned as NULL.
|
||||||
*/
|
*/
|
||||||
@ -36,7 +36,7 @@ struct git_attr_check {
|
|||||||
*/
|
*/
|
||||||
char *git_attr_name(struct git_attr *);
|
char *git_attr_name(struct git_attr *);
|
||||||
|
|
||||||
int git_checkattr(const char *path, int, struct git_attr_check *);
|
int git_check_attr(const char *path, int, struct git_attr_check *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve all attributes that apply to the specified path. *num
|
* Retrieve all attributes that apply to the specified path. *num
|
||||||
|
@ -45,8 +45,8 @@ static void check_attr(int cnt, struct git_attr_check *check,
|
|||||||
const char *file)
|
const char *file)
|
||||||
{
|
{
|
||||||
if (check != NULL) {
|
if (check != NULL) {
|
||||||
if (git_checkattr(file, cnt, check))
|
if (git_check_attr(file, cnt, check))
|
||||||
die("git_checkattr died");
|
die("git_check_attr died");
|
||||||
output_attr(cnt, check, file);
|
output_attr(cnt, check, file);
|
||||||
} else {
|
} else {
|
||||||
if (git_all_attrs(file, &cnt, &check))
|
if (git_all_attrs(file, &cnt, &check))
|
||||||
|
@ -634,7 +634,7 @@ static int no_try_delta(const char *path)
|
|||||||
struct git_attr_check check[1];
|
struct git_attr_check check[1];
|
||||||
|
|
||||||
setup_delta_attr_check(check);
|
setup_delta_attr_check(check);
|
||||||
if (git_checkattr(path, ARRAY_SIZE(check), check))
|
if (git_check_attr(path, ARRAY_SIZE(check), check))
|
||||||
return 0;
|
return 0;
|
||||||
if (ATTR_FALSE(check->value))
|
if (ATTR_FALSE(check->value))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -727,7 +727,7 @@ static void convert_attrs(struct conv_attrs *ca, const char *path)
|
|||||||
git_config(read_convert_config, NULL);
|
git_config(read_convert_config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!git_checkattr(path, NUM_CONV_ATTRS, ccheck)) {
|
if (!git_check_attr(path, NUM_CONV_ATTRS, ccheck)) {
|
||||||
ca->crlf_action = git_path_check_crlf(path, ccheck + 4);
|
ca->crlf_action = git_path_check_crlf(path, ccheck + 4);
|
||||||
if (ca->crlf_action == CRLF_GUESS)
|
if (ca->crlf_action == CRLF_GUESS)
|
||||||
ca->crlf_action = git_path_check_crlf(path, ccheck + 0);
|
ca->crlf_action = git_path_check_crlf(path, ccheck + 0);
|
||||||
|
@ -330,7 +330,7 @@ static int git_path_check_merge(const char *path, struct git_attr_check check[2]
|
|||||||
check[0].attr = git_attr("merge");
|
check[0].attr = git_attr("merge");
|
||||||
check[1].attr = git_attr("conflict-marker-size");
|
check[1].attr = git_attr("conflict-marker-size");
|
||||||
}
|
}
|
||||||
return git_checkattr(path, 2, check);
|
return git_check_attr(path, 2, check);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void normalize_file(mmfile_t *mm, const char *path)
|
static void normalize_file(mmfile_t *mm, const char *path)
|
||||||
@ -387,7 +387,7 @@ int ll_merge_marker_size(const char *path)
|
|||||||
|
|
||||||
if (!check.attr)
|
if (!check.attr)
|
||||||
check.attr = git_attr("conflict-marker-size");
|
check.attr = git_attr("conflict-marker-size");
|
||||||
if (!git_checkattr(path, 1, &check) && check.value) {
|
if (!git_check_attr(path, 1, &check) && check.value) {
|
||||||
marker_size = atoi(check.value);
|
marker_size = atoi(check.value);
|
||||||
if (marker_size <= 0)
|
if (marker_size <= 0)
|
||||||
marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
|
marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
|
||||||
|
@ -270,7 +270,7 @@ struct userdiff_driver *userdiff_find_by_path(const char *path)
|
|||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (git_checkattr(path, 1, &check))
|
if (git_check_attr(path, 1, &check))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (ATTR_TRUE(check.value))
|
if (ATTR_TRUE(check.value))
|
||||||
|
2
ws.c
2
ws.c
@ -88,7 +88,7 @@ unsigned whitespace_rule(const char *pathname)
|
|||||||
struct git_attr_check attr_whitespace_rule;
|
struct git_attr_check attr_whitespace_rule;
|
||||||
|
|
||||||
setup_whitespace_attr_check(&attr_whitespace_rule);
|
setup_whitespace_attr_check(&attr_whitespace_rule);
|
||||||
if (!git_checkattr(pathname, 1, &attr_whitespace_rule)) {
|
if (!git_check_attr(pathname, 1, &attr_whitespace_rule)) {
|
||||||
const char *value;
|
const char *value;
|
||||||
|
|
||||||
value = attr_whitespace_rule.value;
|
value = attr_whitespace_rule.value;
|
||||||
|
Loading…
Reference in New Issue
Block a user