summaryrefslogtreecommitdiff
path: root/t/t3307-notes-man.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-05-09 03:21:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-05-09 05:30:02 (GMT)
commit8d6888ec6aee97f8b2b395e7e075dd00d9689c25 (patch)
treed6511d9df9a552d8cb7008fb7931a2ed53b0834d /t/t3307-notes-man.sh
parent9eb3f816dea9fa00e7c20204516b0cb288219057 (diff)
downloadgit-8d6888ec6aee97f8b2b395e7e075dd00d9689c25.zip
git-8d6888ec6aee97f8b2b395e7e075dd00d9689c25.tar.gz
git-8d6888ec6aee97f8b2b395e7e075dd00d9689c25.tar.bz2
Documentation/notes: describe content of notes blobs
stripspace/text-based formatting kicks in when specifying the notes content with -m or -F, or when an editor is used to edit the notes. To binary-safely create notes from files, the following construct is required: git notes add -C $(git hash-object -w <file>) <object> Explain this trick (thanks, Johan!) in the manual. Add an ordinary example, too, to keep this esoteric one company. Cc: Johan Herland <johan@herland.net> Cc: Thomas Rast <trast@student.ethz.ch> Cc: Jeff King <peff@peff.net> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3307-notes-man.sh')
-rwxr-xr-xt/t3307-notes-man.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t3307-notes-man.sh b/t/t3307-notes-man.sh
new file mode 100755
index 0000000..3269f2e
--- /dev/null
+++ b/t/t3307-notes-man.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='Examples from the git-notes man page
+
+Make sure the manual is not full of lies.'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit A &&
+ test_commit B &&
+ test_commit C
+'
+
+test_expect_success 'example 1: notes to add an Acked-by line' '
+ cat <<-\EOF >expect &&
+ B
+
+ Notes:
+ Acked-by: A C Ker <acker@example.com>
+ EOF
+ git notes add -m "Acked-by: A C Ker <acker@example.com>" B &&
+ git show -s B^{commit} >log &&
+ tail -n 4 log >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'example 2: binary notes' '
+ cp "$TEST_DIRECTORY"/test4012.png .
+ git checkout B &&
+ blob=$(git hash-object -w test4012.png) &&
+ git notes --ref=logo add -C "$blob" &&
+ git notes --ref=logo copy B C &&
+ git notes --ref=logo show C >actual &&
+ test_cmp test4012.png actual
+'
+
+test_done