aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bundle.c4
-rwxr-xr-xt/t5704-bundle.sh6
2 files changed, 8 insertions, 2 deletions
diff --git a/bundle.c b/bundle.c
index 08020bc3a..8a1d53ba2 100644
--- a/bundle.c
+++ b/bundle.c
@@ -31,8 +31,8 @@ static int strbuf_readline_fd(struct strbuf *sb, int fd)
while (1) {
char ch;
ssize_t len = xread(fd, &ch, 1);
- if (len < 0)
- return -1;
+ if (len <= 0)
+ return len;
strbuf_addch(sb, ch);
if (ch == '\n')
break;
diff --git a/t/t5704-bundle.sh b/t/t5704-bundle.sh
index 728ccd88c..4ae127d10 100755
--- a/t/t5704-bundle.sh
+++ b/t/t5704-bundle.sh
@@ -53,4 +53,10 @@ test_expect_failure 'bundle --stdin <rev-list options>' '
'
+test_expect_success 'empty bundle file is rejected' '
+
+ >empty-bundle && test_must_fail git fetch empty-bundle
+
+'
+
test_done