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:
authorJohan Herland <johan@herland.net>2008-09-25 03:10:54 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-09-25 04:02:05 +0400
commit85cf643f1b17ee5680ae816eb061f569b4e00478 (patch)
treef7536d9b7505a550da2737a537157d42a798c7f6 /builtin-for-each-ref.c
parentda65e7c133cd316c9076fbb6b0aeee7bc42a6db8 (diff)
for-each-ref: Fix --format=%(subject) for log message without newlines
'git for-each-ref --format=%(subject)' currently returns an empty string if the log message does not contain a newline. This patch teaches 'git for-each-ref' to return the entire log message (instead of an empty string) if there is no newline in the log message. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'builtin-for-each-ref.c')
-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 21e92bbcb5..be9dc9e3f0 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);
}