Merge branch 'tr/maint-bundle-long-subject'
* tr/maint-bundle-long-subject: t5704: match tests to modern style strbuf: improve strbuf_get*line documentation bundle: use a strbuf to scan the log for boundary commits bundle: put strbuf_readline_fd in strbuf.c with adjustments
This commit is contained in:
16
strbuf.c
16
strbuf.c
@ -383,6 +383,22 @@ int strbuf_getline(struct strbuf *sb, FILE *fp, int term)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int strbuf_getwholeline_fd(struct strbuf *sb, int fd, int term)
|
||||
{
|
||||
strbuf_reset(sb);
|
||||
|
||||
while (1) {
|
||||
char ch;
|
||||
ssize_t len = xread(fd, &ch, 1);
|
||||
if (len <= 0)
|
||||
return EOF;
|
||||
strbuf_addch(sb, ch);
|
||||
if (ch == term)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint)
|
||||
{
|
||||
int fd, len;
|
||||
|
||||
Reference in New Issue
Block a user