diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-02-26 23:05:51 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-26 23:05:51 -0800 |
commit | ac1373f1c26d545ef303a71bedcd31b9279f55bd (patch) | |
tree | a509334659acdd61ebb4cba0e89159df7c71c9a4 /strbuf.c | |
parent | 200e96e4af5e604174dff2f1487b26d3c42426f1 (diff) | |
parent | 8a557bb77fc009b00f7952f0d3d6ebd33079f70e (diff) | |
download | git-ac1373f1c26d545ef303a71bedcd31b9279f55bd.tar.gz |
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
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; |