Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
for-each-ref: Fix --format=%(subject) for log message without newlines
author
Johan Herland
<johan@herland.net>
Wed, 24 Sep 2008 23:10:54 +0000
(
01:10
+0200)
committer
Shawn O. Pearce
<spearce@spearce.org>
Thu, 25 Sep 2008 00:02:05 +0000
(17:02 -0700)
'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>
builtin-for-each-ref.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
da65e7c
)
diff --git
a/builtin-for-each-ref.c
b/builtin-for-each-ref.c
index 21e92bbcb577c0361df51bd81e6fb5ab546619ea..be9dc9e3f0dbbd9bdda20db7fd5c5fad8e427bd2 100644
(file)
--- 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');
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);
}
return xmemdupz(buf, eol - buf);
}