diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-05-13 14:05:51 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-13 14:05:51 -0700 |
commit | 8a1d89745d1b60d0d9e8bd91e4e9564673b6c22a (patch) | |
tree | eef6bd2437ba2a1188dbe1b4023b27ef99531b65 /dir.c | |
parent | ebb464f0cba9efcb5552fad02f452f09f68fc9b2 (diff) | |
parent | 27547e5fccda134560ad0441aa5bfa187387cec0 (diff) | |
download | git-8a1d89745d1b60d0d9e8bd91e4e9564673b6c22a.tar.gz |
Merge branch 'cn/bom-in-gitignore' into maint
Teach the codepaths that read .gitignore and .gitattributes files
that these files encoded in UTF-8 may have UTF-8 BOM marker at the
beginning; this makes it in line with what we do for configuration
files already.
* cn/bom-in-gitignore:
attr: skip UTF8 BOM at the beginning of the input file
config: use utf8_bom[] from utf.[ch] in git_parse_source()
utf8-bom: introduce skip_utf8_bom() helper
add_excludes_from_file: clarify the bom skipping logic
dir: allow a BOM at the beginning of exclude files
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -12,6 +12,7 @@ #include "refs.h" #include "wildmatch.h" #include "pathspec.h" +#include "utf8.h" struct path_simplify { int len; @@ -617,7 +618,12 @@ int add_excludes_from_file_to_list(const char *fname, } el->filebuf = buf; + + if (skip_utf8_bom(&buf, size)) + size -= buf - el->filebuf; + entry = buf; + for (i = 0; i < size; i++) { if (buf[i] == '\n') { if (entry != buf + i && entry[0] != '#') { |