attr: rename function and struct related to checking attributes
The traditional API to check attributes is to prepare an N-element array of "struct git_attr_check" and pass N and the array to the function "git_check_attr()" as arguments. In preparation to revamp the API to pass a single structure, in which these N elements are held, rename the type used for these individual array elements to "struct attr_check_item" and rename the function to "git_check_attrs()". Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -24,8 +24,8 @@ static const struct option check_attr_options[] = {
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
static void output_attr(int cnt, struct git_attr_check *check,
|
||||
const char *file)
|
||||
static void output_attr(int cnt, struct attr_check_item *check,
|
||||
const char *file)
|
||||
{
|
||||
int j;
|
||||
for (j = 0; j < cnt; j++) {
|
||||
@ -51,14 +51,15 @@ static void output_attr(int cnt, struct git_attr_check *check,
|
||||
}
|
||||
}
|
||||
|
||||
static void check_attr(const char *prefix, int cnt,
|
||||
struct git_attr_check *check, const char *file)
|
||||
static void check_attr(const char *prefix,
|
||||
int cnt, struct attr_check_item *check,
|
||||
const char *file)
|
||||
{
|
||||
char *full_path =
|
||||
prefix_path(prefix, prefix ? strlen(prefix) : 0, file);
|
||||
if (check != NULL) {
|
||||
if (git_check_attr(full_path, cnt, check))
|
||||
die("git_check_attr died");
|
||||
if (git_check_attrs(full_path, cnt, check))
|
||||
die("git_check_attrs died");
|
||||
output_attr(cnt, check, file);
|
||||
} else {
|
||||
if (git_all_attrs(full_path, &cnt, &check))
|
||||
@ -69,8 +70,8 @@ static void check_attr(const char *prefix, int cnt,
|
||||
free(full_path);
|
||||
}
|
||||
|
||||
static void check_attr_stdin_paths(const char *prefix, int cnt,
|
||||
struct git_attr_check *check)
|
||||
static void check_attr_stdin_paths(const char *prefix,
|
||||
int cnt, struct attr_check_item *check)
|
||||
{
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
struct strbuf unquoted = STRBUF_INIT;
|
||||
@ -99,7 +100,7 @@ static NORETURN void error_with_usage(const char *msg)
|
||||
|
||||
int cmd_check_attr(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
struct git_attr_check *check;
|
||||
struct attr_check_item *check;
|
||||
int cnt, i, doubledash, filei;
|
||||
|
||||
if (!is_bare_repository())
|
||||
|
Reference in New Issue
Block a user