summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad94657)
raw | patch | inline | side by side (parent: ad94657)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Fri, 17 Apr 2009 22:17:58 +0000 (00:17 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 18 Apr 2009 04:05:49 +0000 (21:05 -0700) |
This instructs attr mechanism, not to look into working .gitattributes
at all. Needed by tools that does not handle working directory, such
as "git archive".
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
at all. Needed by tools that does not handle working directory, such
as "git archive".
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c | patch | blob | history | |
attr.h | patch | blob | history |
index 43259e5b01f7c8368e5b5d53d8ed4af9dba593ee..f1ca4f58599c14c98473f3638a3d0d6eed2aafaa 100644 (file)
--- a/attr.c
+++ b/attr.c
if (!res)
res = read_attr_from_file(path, macro_ok);
}
- else {
+ else if (direction == GIT_ATTR_CHECKIN) {
res = read_attr_from_file(path, macro_ok);
if (!res)
/*
*/
res = read_attr_from_index(path, macro_ok);
}
+ else
+ res = read_attr_from_index(path, macro_ok);
if (!res)
res = xcalloc(1, sizeof(*res));
return res;
elem->prev = attr_stack;
attr_stack = elem;
- if (!is_bare_repository()) {
+ if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {
elem = read_attr(GITATTRIBUTES_FILE, 1);
elem->origin = strdup("");
elem->prev = attr_stack;
/*
* Read from parent directories and push them down
*/
- if (!is_bare_repository()) {
+ if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {
while (1) {
char *cp;
void git_attr_set_direction(enum git_attr_direction new, struct index_state *istate)
{
enum git_attr_direction old = direction;
+
+ if (is_bare_repository() && new != GIT_ATTR_INDEX)
+ die("BUG: non-INDEX attr direction in a bare repo");
+
direction = new;
if (new != old)
drop_attr_stack();
index 3a2f4ec1a09cca06fadedeb32bd86c5e279ad75c..69b5767ebc2189a8bf9d98ff88c1885ec8fcdb7d 100644 (file)
--- a/attr.h
+++ b/attr.h
enum git_attr_direction {
GIT_ATTR_CHECKIN,
- GIT_ATTR_CHECKOUT
+ GIT_ATTR_CHECKOUT,
+ GIT_ATTR_INDEX,
};
void git_attr_set_direction(enum git_attr_direction, struct index_state *);