diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-02-27 08:05:51 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-27 08:05:51 +0100 |
commit | ac1373f1c26d545ef303a71bedcd31b9279f55bd (patch) | |
tree | a509334659acdd61ebb4cba0e89159df7c71c9a4 /strbuf.c | |
parent | Merge branch 'sp/smart-http-failure-to-push' (diff) | |
parent | t5704: match tests to modern style (diff) | |
download | git-ac1373f1c26d545ef303a71bedcd31b9279f55bd.tar.xz git-ac1373f1c26d545ef303a71bedcd31b9279f55bd.zip |
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; |