diff options
author | Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> | 2010-05-19 22:43:11 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-19 20:42:34 -0700 |
commit | 5ec3e67052289217c84e53d2cda90d939ac5725b (patch) | |
tree | 925b092d3514202f5bb0af98f9e19dd639f74a99 /convert.c | |
parent | Add per-repository eol normalization (diff) | |
download | tgif-5ec3e67052289217c84e53d2cda90d939ac5725b.tar.xz |
Rename the "crlf" attribute "text"
As discussed on the list, "crlf" is not an optimal name. Linus
suggested "text", which is much better.
Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.c')
-rw-r--r-- | convert.c | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -439,12 +439,14 @@ static int read_convert_config(const char *var, const char *value, void *cb) static void setup_convert_check(struct git_attr_check *check) { + static struct git_attr *attr_text; static struct git_attr *attr_crlf; static struct git_attr *attr_eol; static struct git_attr *attr_ident; static struct git_attr *attr_filter; - if (!attr_crlf) { + if (!attr_text) { + attr_text = git_attr("text"); attr_crlf = git_attr("crlf"); attr_eol = git_attr("eol"); attr_ident = git_attr("ident"); @@ -456,6 +458,7 @@ static void setup_convert_check(struct git_attr_check *check) check[1].attr = attr_ident; check[2].attr = attr_filter; check[3].attr = attr_eol; + check[4].attr = attr_text; } static int count_ident(const char *cp, unsigned long size) @@ -651,20 +654,20 @@ static int git_path_check_ident(const char *path, struct git_attr_check *check) return !!ATTR_TRUE(value); } -enum action determine_action(enum action crlf_attr, enum eol eol_attr) { - if (crlf_attr == CRLF_BINARY) +enum action determine_action(enum action text_attr, enum eol eol_attr) { + if (text_attr == CRLF_BINARY) return CRLF_BINARY; if (eol_attr == EOL_LF) return CRLF_INPUT; if (eol_attr == EOL_CRLF) return CRLF_CRLF; - return crlf_attr; + return text_attr; } int convert_to_git(const char *path, const char *src, size_t len, struct strbuf *dst, enum safe_crlf checksafe) { - struct git_attr_check check[4]; + struct git_attr_check check[5]; enum action action = CRLF_GUESS; enum eol eol = EOL_UNSET; int ident = 0, ret = 0; @@ -673,7 +676,9 @@ int convert_to_git(const char *path, const char *src, size_t len, setup_convert_check(check); if (!git_checkattr(path, ARRAY_SIZE(check), check)) { struct convert_driver *drv; - action = git_path_check_crlf(path, check + 0); + action = git_path_check_crlf(path, check + 4); + if (action == CRLF_GUESS) + action = git_path_check_crlf(path, check + 0); ident = git_path_check_ident(path, check + 1); drv = git_path_check_convert(path, check + 2); eol = git_path_check_eol(path, check + 3); @@ -697,7 +702,7 @@ int convert_to_git(const char *path, const char *src, size_t len, int convert_to_working_tree(const char *path, const char *src, size_t len, struct strbuf *dst) { - struct git_attr_check check[4]; + struct git_attr_check check[5]; enum action action = CRLF_GUESS; enum eol eol = EOL_UNSET; int ident = 0, ret = 0; @@ -706,7 +711,9 @@ int convert_to_working_tree(const char *path, const char *src, size_t len, struc setup_convert_check(check); if (!git_checkattr(path, ARRAY_SIZE(check), check)) { struct convert_driver *drv; - action = git_path_check_crlf(path, check + 0); + action = git_path_check_crlf(path, check + 4); + if (action == CRLF_GUESS) + action = git_path_check_crlf(path, check + 0); ident = git_path_check_ident(path, check + 1); drv = git_path_check_convert(path, check + 2); eol = git_path_check_eol(path, check + 3); |