summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 11766ca)
raw | patch | inline | side by side (parent: 11766ca)
author | Eli Barzilay <eli@barzilay.org> | |
Thu, 25 Mar 2010 02:51:52 +0000 (22:51 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 6 Apr 2010 06:02:33 +0000 (23:02 -0700) |
Also update the documentation text and add a test.
Signed-off-by: Eli Barzilay <eli@barzilay.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eli Barzilay <eli@barzilay.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/pretty-formats.txt | patch | blob | history | |
pretty.c | patch | blob | history | |
t/t6006-rev-list-format.sh | patch | blob | history |
index 1686a54d22a746036b997d6eb8d5b85ca1d79c5d..bd760d3bd107d2f1101efbc75693e3ac5e81139b 100644 (file)
- '%s': subject
- '%f': sanitized subject line, suitable for a filename
- '%b': body
+- '%B': raw body (unwrapped subject and body)
- '%N': commit notes
- '%gD': reflog selector, e.g., `refs/stash@\{1\}`
- '%gd': shortened reflog selector, e.g., `stash@\{1\}`
diff --git a/pretty.c b/pretty.c
index 6ba3da89b7d29ef35a6ac9215b4f3e0abe7a582f..14c9568c54c8c4cfb73103ee066f39addff57def 100644 (file)
--- a/pretty.c
+++ b/pretty.c
case 'e': /* encoding */
strbuf_add(sb, msg + c->encoding.off, c->encoding.len);
return 1;
+ case 'B': /* raw body */
+ /* message_off is always left at the initial newline */
+ strbuf_addstr(sb, msg + c->message_off + 1);
+ return 1;
}
/* Now we need to parse the commit message. */
index b0047d3c6b593795561ce908ab8e10ff574d3dbc..5d15f1836625d1a40b2575ad967a3053230f2408 100755 (executable)
commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873
EOF
+test_format raw-body %B <<'EOF'
+commit 131a310eb913d107dd3c09a65d1651175898735d
+changed foo
+
+commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873
+added foo
+
+EOF
+
test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF'
commit 131a310eb913d107dd3c09a65d1651175898735d
\e[31mfoo\e[32mbar\e[34mbaz\e[mxyzzy