attr.c: make bootstrap_attr_stack() leave early
Thas would de-dent the body of a function that has grown rather large over time, making it a bit easier to read. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
65
attr.c
65
attr.c
@ -488,48 +488,49 @@ static int git_attr_config(const char *var, const char *value, void *dummy)
|
|||||||
|
|
||||||
static void bootstrap_attr_stack(void)
|
static void bootstrap_attr_stack(void)
|
||||||
{
|
{
|
||||||
if (!attr_stack) {
|
struct attr_stack *elem;
|
||||||
struct attr_stack *elem;
|
|
||||||
|
|
||||||
elem = read_attr_from_array(builtin_attr);
|
if (attr_stack)
|
||||||
elem->origin = NULL;
|
return;
|
||||||
elem->prev = attr_stack;
|
|
||||||
attr_stack = elem;
|
|
||||||
|
|
||||||
if (git_attr_system()) {
|
elem = read_attr_from_array(builtin_attr);
|
||||||
elem = read_attr_from_file(git_etc_gitattributes(), 1);
|
elem->origin = NULL;
|
||||||
if (elem) {
|
elem->prev = attr_stack;
|
||||||
elem->origin = NULL;
|
attr_stack = elem;
|
||||||
elem->prev = attr_stack;
|
|
||||||
attr_stack = elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
git_config(git_attr_config, NULL);
|
if (git_attr_system()) {
|
||||||
if (attributes_file) {
|
elem = read_attr_from_file(git_etc_gitattributes(), 1);
|
||||||
elem = read_attr_from_file(attributes_file, 1);
|
if (elem) {
|
||||||
if (elem) {
|
elem->origin = NULL;
|
||||||
elem->origin = NULL;
|
|
||||||
elem->prev = attr_stack;
|
|
||||||
attr_stack = elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {
|
|
||||||
elem = read_attr(GITATTRIBUTES_FILE, 1);
|
|
||||||
elem->origin = strdup("");
|
|
||||||
elem->prev = attr_stack;
|
elem->prev = attr_stack;
|
||||||
attr_stack = elem;
|
attr_stack = elem;
|
||||||
debug_push(elem);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
elem = read_attr_from_file(git_path(INFOATTRIBUTES_FILE), 1);
|
git_config(git_attr_config, NULL);
|
||||||
if (!elem)
|
if (attributes_file) {
|
||||||
elem = xcalloc(1, sizeof(*elem));
|
elem = read_attr_from_file(attributes_file, 1);
|
||||||
elem->origin = NULL;
|
if (elem) {
|
||||||
|
elem->origin = NULL;
|
||||||
|
elem->prev = attr_stack;
|
||||||
|
attr_stack = elem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {
|
||||||
|
elem = read_attr(GITATTRIBUTES_FILE, 1);
|
||||||
|
elem->origin = strdup("");
|
||||||
elem->prev = attr_stack;
|
elem->prev = attr_stack;
|
||||||
attr_stack = elem;
|
attr_stack = elem;
|
||||||
|
debug_push(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elem = read_attr_from_file(git_path(INFOATTRIBUTES_FILE), 1);
|
||||||
|
if (!elem)
|
||||||
|
elem = xcalloc(1, sizeof(*elem));
|
||||||
|
elem->origin = NULL;
|
||||||
|
elem->prev = attr_stack;
|
||||||
|
attr_stack = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prepare_attr_stack(const char *path, int dirlen)
|
static void prepare_attr_stack(const char *path, int dirlen)
|
||||||
|
Reference in New Issue
Block a user