Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Carlos Martín Nieto
On Thu, 2015-04-16 at 17:03 +0200, Johannes Schindelin wrote: Hi Carlos, On 2015-04-16 16:05, Carlos Martín Nieto wrote: Some text editors like Notepad or LibreOffice write an UTF-8 BOM in order to indicate that the file is Unicode text rather than whatever the current locale would

Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Carlos Martín Nieto
On Thu, 2015-04-16 at 16:05 +0200, Carlos Martín Nieto wrote: Some text editors like Notepad or LibreOffice write an UTF-8 BOM in order to indicate that the file is Unicode text rather than whatever the current locale would indicate. If someone uses such an editor to edit a gitignore file,

Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Johannes Schindelin
Hi Carlos, On 2015-04-16 16:05, Carlos Martín Nieto wrote: Some text editors like Notepad or LibreOffice write an UTF-8 BOM in order to indicate that the file is Unicode text rather than whatever the current locale would indicate. If someone uses such an editor to edit a gitignore file, we

Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Junio C Hamano
Carlos Martín Nieto c...@elego.de writes: diff --git a/dir.c b/dir.c index 0943a81..6368247 100644 --- a/dir.c +++ b/dir.c @@ -581,6 +581,7 @@ int add_excludes_from_file_to_list(const char *fname, struct stat st; int fd, i, lineno = 1; size_t size = 0; + static

Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Jeff King
On Thu, Apr 16, 2015 at 08:39:55AM -0700, Junio C Hamano wrote: test_expect_success 'status untracked directory with --ignored' ' echo ignored .gitignore + sed -e s/^/\xef\xbb\xbf/ .gitignore .gitignore.new + mv .gitignore.new .gitignore Is this write literal in \xHEX on

Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Johannes Schindelin
Hi, On 2015-04-16 17:39, Junio C Hamano wrote: Also do we need a similar change to the attribute side, or are we already covered and we forgot to do the same for the ignore files? I fear so: https://github.com/git/git/blob/v2.3.5/attr.c#L359-L376 As for the config, we are safe:

Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Torsten Bögershausen
On 2015-04-16 16.05, Carlos Martín Nieto wrote: [] May be it is easier to move this into an own function, like remove_utf8_bom() ? dir.c | 8 +++- t/t7061-wtstatus-ignore.sh | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dir.c b/dir.c index

Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Thu, Apr 16, 2015 at 08:39:55AM -0700, Junio C Hamano wrote: test_expect_success 'status untracked directory with --ignored' ' echo ignored .gitignore + sed -e s/^/\xef\xbb\xbf/ .gitignore .gitignore.new + mv .gitignore.new .gitignore Is

[PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Carlos Martín Nieto
Some text editors like Notepad or LibreOffice write an UTF-8 BOM in order to indicate that the file is Unicode text rather than whatever the current locale would indicate. If someone uses such an editor to edit a gitignore file, we are left with those three bytes at the beginning of the file. If

Re: [PATCH] dir: allow a BOM at the beginning of exclude files

2015-04-16 Thread Carlos Martín Nieto
On Thu, 2015-04-16 at 10:16 -0700, Junio C Hamano wrote: Jeff King p...@peff.net writes: On Thu, Apr 16, 2015 at 08:39:55AM -0700, Junio C Hamano wrote: test_expect_success 'status untracked directory with --ignored' ' echo ignored .gitignore +sed -e