aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-for-each-ref.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 21e92bbcb..be9dc9e3f 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -321,8 +321,8 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
static const char *copy_line(const char *buf)
{
const char *eol = strchr(buf, '\n');
- if (!eol)
- return "";
+ if (!eol) // simulate strchrnul()
+ eol = buf + strlen(buf);
return xmemdupz(buf, eol - buf);
}