Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-27 11:05:51 +0400
committerJunio C Hamano <gitster@pobox.com>2012-02-27 11:05:51 +0400
commitac1373f1c26d545ef303a71bedcd31b9279f55bd (patch)
treea509334659acdd61ebb4cba0e89159df7c71c9a4 /strbuf.c
parent200e96e4af5e604174dff2f1487b26d3c42426f1 (diff)
parent8a557bb77fc009b00f7952f0d3d6ebd33079f70e (diff)
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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index ff0b96b416..5135d5950d 100644
--- a/strbuf.c
+++ b/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;