Skip to content

Commit 451d7b4

Browse files
julliardJunio C Hamano
authored andcommitted
ls-files: Don't require exclude files to end with a newline.
Without this patch, the last line of an exclude file is silently ignored if it doesn't end with a newline. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent f5ef535 commit 451d7b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ls-files.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ static int add_excludes_from_file_1(const char *fname,
9292
close(fd);
9393
return 0;
9494
}
95-
buf = xmalloc(size);
95+
buf = xmalloc(size+1);
9696
if (read(fd, buf, size) != size)
9797
goto err;
9898
close(fd);
9999

100+
buf[size++] = '\n';
100101
entry = buf;
101102
for (i = 0; i < size; i++) {
102103
if (buf[i] == '\n') {

0 commit comments

Comments
 (0)