Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
#include "builtin.h"
|
2007-08-14 15:18:38 +02:00
|
|
|
#include "cache.h"
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
#include "attr.h"
|
|
|
|
#include "quote.h"
|
2008-10-07 02:16:52 +02:00
|
|
|
#include "parse-options.h"
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
|
2011-08-04 06:36:30 +02:00
|
|
|
static int all_attrs;
|
2011-09-22 23:44:20 +02:00
|
|
|
static int cached_attrs;
|
2008-10-07 02:16:52 +02:00
|
|
|
static int stdin_paths;
|
|
|
|
static const char * const check_attr_usage[] = {
|
2012-08-20 14:31:57 +02:00
|
|
|
N_("git check-attr [-a | --all | attr...] [--] pathname..."),
|
|
|
|
N_("git check-attr --stdin [-a | --all | attr...] < <list-of-paths>"),
|
2008-10-07 02:16:52 +02:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static int null_term_line;
|
|
|
|
|
|
|
|
static const struct option check_attr_options[] = {
|
2012-08-20 14:31:57 +02:00
|
|
|
OPT_BOOLEAN('a', "all", &all_attrs, N_("report all attributes set on file")),
|
|
|
|
OPT_BOOLEAN(0, "cached", &cached_attrs, N_("use .gitattributes only from the index")),
|
|
|
|
OPT_BOOLEAN(0 , "stdin", &stdin_paths, N_("read file names from stdin")),
|
2008-10-07 02:16:52 +02:00
|
|
|
OPT_BOOLEAN('z', NULL, &null_term_line,
|
2012-08-20 14:31:57 +02:00
|
|
|
N_("input paths are terminated by a null character")),
|
2008-10-07 02:16:52 +02:00
|
|
|
OPT_END()
|
|
|
|
};
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
|
2011-08-04 06:36:24 +02:00
|
|
|
static void output_attr(int cnt, struct git_attr_check *check,
|
2011-08-04 06:36:18 +02:00
|
|
|
const char *file)
|
2008-10-07 02:14:18 +02:00
|
|
|
{
|
|
|
|
int j;
|
|
|
|
for (j = 0; j < cnt; j++) {
|
|
|
|
const char *value = check[j].value;
|
|
|
|
|
|
|
|
if (ATTR_TRUE(value))
|
|
|
|
value = "set";
|
|
|
|
else if (ATTR_FALSE(value))
|
|
|
|
value = "unset";
|
|
|
|
else if (ATTR_UNSET(value))
|
|
|
|
value = "unspecified";
|
|
|
|
|
|
|
|
quote_c_style(file, NULL, stdout, 0);
|
2011-08-04 06:36:18 +02:00
|
|
|
printf(": %s: %s\n", git_attr_name(check[j].attr), value);
|
2008-10-07 02:14:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-04 06:47:46 +02:00
|
|
|
static void check_attr(const char *prefix, int cnt,
|
|
|
|
struct git_attr_check *check, const char *file)
|
2011-08-04 06:36:24 +02:00
|
|
|
{
|
2011-08-04 06:47:46 +02:00
|
|
|
char *full_path =
|
|
|
|
prefix_path(prefix, prefix ? strlen(prefix) : 0, file);
|
2011-08-04 06:36:30 +02:00
|
|
|
if (check != NULL) {
|
2011-08-04 06:47:46 +02:00
|
|
|
if (git_check_attr(full_path, cnt, check))
|
2011-08-04 06:36:33 +02:00
|
|
|
die("git_check_attr died");
|
2011-08-04 06:36:30 +02:00
|
|
|
output_attr(cnt, check, file);
|
|
|
|
} else {
|
2011-08-04 06:47:46 +02:00
|
|
|
if (git_all_attrs(full_path, &cnt, &check))
|
2011-08-04 06:36:30 +02:00
|
|
|
die("git_all_attrs died");
|
|
|
|
output_attr(cnt, check, file);
|
|
|
|
free(check);
|
|
|
|
}
|
2011-08-04 06:47:46 +02:00
|
|
|
free(full_path);
|
2011-08-04 06:36:24 +02:00
|
|
|
}
|
|
|
|
|
2011-08-04 06:47:46 +02:00
|
|
|
static void check_attr_stdin_paths(const char *prefix, int cnt,
|
|
|
|
struct git_attr_check *check)
|
2008-10-07 02:16:52 +02:00
|
|
|
{
|
|
|
|
struct strbuf buf, nbuf;
|
|
|
|
int line_termination = null_term_line ? 0 : '\n';
|
|
|
|
|
|
|
|
strbuf_init(&buf, 0);
|
|
|
|
strbuf_init(&nbuf, 0);
|
|
|
|
while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
|
|
|
|
if (line_termination && buf.buf[0] == '"') {
|
|
|
|
strbuf_reset(&nbuf);
|
|
|
|
if (unquote_c_style(&nbuf, buf.buf, NULL))
|
|
|
|
die("line is badly quoted");
|
|
|
|
strbuf_swap(&buf, &nbuf);
|
|
|
|
}
|
2011-08-04 06:47:46 +02:00
|
|
|
check_attr(prefix, cnt, check, buf.buf);
|
2008-10-07 02:16:52 +02:00
|
|
|
maybe_flush_or_die(stdout, "attribute to stdout");
|
|
|
|
}
|
|
|
|
strbuf_release(&buf);
|
|
|
|
strbuf_release(&nbuf);
|
|
|
|
}
|
|
|
|
|
2011-08-04 06:36:26 +02:00
|
|
|
static NORETURN void error_with_usage(const char *msg)
|
|
|
|
{
|
|
|
|
error("%s", msg);
|
|
|
|
usage_with_options(check_attr_usage, check_attr_options);
|
|
|
|
}
|
|
|
|
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
int cmd_check_attr(int argc, const char **argv, const char *prefix)
|
|
|
|
{
|
|
|
|
struct git_attr_check *check;
|
2011-08-04 06:36:25 +02:00
|
|
|
int cnt, i, doubledash, filei;
|
2008-10-07 02:16:52 +02:00
|
|
|
|
2011-10-06 20:22:24 +02:00
|
|
|
git_config(git_default_config, NULL);
|
|
|
|
|
2009-05-23 20:53:12 +02:00
|
|
|
argc = parse_options(argc, argv, prefix, check_attr_options,
|
|
|
|
check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
|
2007-08-14 15:18:38 +02:00
|
|
|
if (read_cache() < 0) {
|
|
|
|
die("invalid cache");
|
|
|
|
}
|
|
|
|
|
2011-09-22 23:44:20 +02:00
|
|
|
if (cached_attrs)
|
|
|
|
git_attr_set_direction(GIT_ATTR_INDEX, NULL);
|
|
|
|
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
doubledash = -1;
|
2008-10-07 02:16:52 +02:00
|
|
|
for (i = 0; doubledash < 0 && i < argc; i++) {
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
if (!strcmp(argv[i], "--"))
|
|
|
|
doubledash = i;
|
|
|
|
}
|
|
|
|
|
2011-08-04 06:36:30 +02:00
|
|
|
/* Process --all and/or attribute arguments: */
|
|
|
|
if (all_attrs) {
|
|
|
|
if (doubledash >= 1)
|
|
|
|
error_with_usage("Attributes and --all both specified");
|
|
|
|
|
|
|
|
cnt = 0;
|
|
|
|
filei = doubledash + 1;
|
|
|
|
} else if (doubledash == 0) {
|
2011-08-04 06:36:28 +02:00
|
|
|
error_with_usage("No attribute specified");
|
|
|
|
} else if (doubledash < 0) {
|
|
|
|
if (!argc)
|
|
|
|
error_with_usage("No attribute specified");
|
|
|
|
|
2011-08-04 06:36:32 +02:00
|
|
|
if (stdin_paths) {
|
|
|
|
/* Treat all arguments as attribute names. */
|
|
|
|
cnt = argc;
|
|
|
|
filei = argc;
|
|
|
|
} else {
|
|
|
|
/* Treat exactly one argument as an attribute name. */
|
|
|
|
cnt = 1;
|
|
|
|
filei = 1;
|
|
|
|
}
|
2011-08-04 06:36:25 +02:00
|
|
|
} else {
|
2008-10-07 02:16:52 +02:00
|
|
|
cnt = doubledash;
|
2011-08-04 06:36:25 +02:00
|
|
|
filei = doubledash + 1;
|
|
|
|
}
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
|
2011-08-04 06:36:28 +02:00
|
|
|
/* Check file argument(s): */
|
2011-08-04 06:36:29 +02:00
|
|
|
if (stdin_paths) {
|
|
|
|
if (filei < argc)
|
|
|
|
error_with_usage("Can't specify files with --stdin");
|
|
|
|
} else {
|
|
|
|
if (filei >= argc)
|
|
|
|
error_with_usage("No file specified");
|
|
|
|
}
|
2008-10-07 02:16:52 +02:00
|
|
|
|
2011-08-04 06:36:30 +02:00
|
|
|
if (all_attrs) {
|
|
|
|
check = NULL;
|
|
|
|
} else {
|
|
|
|
check = xcalloc(cnt, sizeof(*check));
|
|
|
|
for (i = 0; i < cnt; i++) {
|
|
|
|
const char *name;
|
|
|
|
struct git_attr *a;
|
|
|
|
name = argv[i];
|
|
|
|
a = git_attr(name);
|
|
|
|
if (!a)
|
|
|
|
return error("%s: not a valid attribute name",
|
|
|
|
name);
|
|
|
|
check[i].attr = a;
|
|
|
|
}
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
}
|
|
|
|
|
2008-10-07 02:16:52 +02:00
|
|
|
if (stdin_paths)
|
2011-08-04 06:47:46 +02:00
|
|
|
check_attr_stdin_paths(prefix, cnt, check);
|
2008-10-07 02:16:52 +02:00
|
|
|
else {
|
2011-08-04 06:36:25 +02:00
|
|
|
for (i = filei; i < argc; i++)
|
2011-08-04 06:47:46 +02:00
|
|
|
check_attr(prefix, cnt, check, argv[i]);
|
2008-10-07 02:16:52 +02:00
|
|
|
maybe_flush_or_die(stdout, "attribute to stdout");
|
|
|
|
}
|
Add basic infrastructure to assign attributes to paths
This adds the basic infrastructure to assign attributes to
paths, in a way similar to what the exclusion mechanism does
based on $GIT_DIR/info/exclude and .gitignore files.
An attribute is just a simple string that does not contain any
whitespace. They can be specified in $GIT_DIR/info/attributes
file, and .gitattributes file in each directory.
Each line in these files defines a pattern matching rule.
Similar to the exclusion mechanism, a later match overrides an
earlier match in the same file, and entries from .gitattributes
file in the same directory takes precedence over the ones from
parent directories. Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
A line is either a comment (an empty line, or a line that begins
with a '#'), or a rule, which is a whitespace separated list of
tokens. The first token on the line is a shell glob pattern.
The rest are names of attributes, each of which can optionally
be prefixed with '!'. Such a line means "if a path matches this
glob, this attribute is set (or unset -- if the attribute name
is prefixed with '!'). For glob matching, the same "if the
pattern does not have a slash in it, the basename of the path is
matched with fnmatch(3) against the pattern, otherwise, the path
is matched with the pattern with FNM_PATHNAME" rule as the
exclusion mechanism is used.
This does not define what an attribute means. Tying an
attribute to various effects it has on git operation for paths
that have it will be specified separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-12 10:07:32 +02:00
|
|
|
return 0;
|
|
|
|
}
|