summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-05-08 22:36:40 -0700
committerJunio C Hamano <gitster@pobox.com>2010-05-08 22:36:40 -0700
commit67e5c87cd60668c97712b14af8562b558239a757 (patch)
tree508a43b693a187a2c0f6e7513193a23c4d7c24c5
parentea28baed79981e065a5a6d39323c4fb7d2b51685 (diff)
parent1367b12ad623e28546ba40c435015d94e7fbb248 (diff)
downloadgit-67e5c87cd60668c97712b14af8562b558239a757.tar.gz
Merge branch 'eb/unpretty-b-format'
* eb/unpretty-b-format: Add `%B' in format strings for raw commit body in `git log' and friends
-rw-r--r--Documentation/pretty-formats.txt1
-rw-r--r--pretty.c4
-rwxr-xr-xt/t6006-rev-list-format.sh9
3 files changed, 14 insertions, 0 deletions
diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
index 1686a54d22..bd760d3bd1 100644
--- a/Documentation/pretty-formats.txt
+++ b/Documentation/pretty-formats.txt
@@ -123,6 +123,7 @@ The placeholders are:
- '%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 7cb3a2af50..742b48bbd6 100644
--- a/pretty.c
+++ b/pretty.c
@@ -800,6 +800,10 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
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. */
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index a49b7c5722..9992be69f4 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -101,6 +101,15 @@ commit 131a310eb913d107dd3c09a65d1651175898735d
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
foobarbazxyzzy