diff options
| author | Patrick Steinhardt <ps@pks.im> | 2015-11-24 13:43:43 +0100 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2015-12-01 10:12:53 +0100 |
| commit | 254e0a33ee66c65948e15efbe93a810c4077e324 (patch) | |
| tree | 5d1729f99eb588a1caacd6cd764958643889bfd8 /tests | |
| parent | 7f8fe1d45e086adc9e7f3f0c33b624eeb3774033 (diff) | |
| download | libgit2-254e0a33ee66c65948e15efbe93a810c4077e324.tar.gz | |
diff: include commit message when formatting patch
When formatting a patch as email we do not include the commit's
message in the formatted patch output. Implement this and add a
test that verifies behavior.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/diff/format_email.c | 41 | ||||
| -rw-r--r-- | tests/resources/diff_format_email/.gitted/index | bin | 256 -> 289 bytes | |||
| -rw-r--r-- | tests/resources/diff_format_email/.gitted/objects/62/7e7e12d87e07a83fad5b6bfa25e86ead4a5270 | 1 | ||||
| -rw-r--r-- | tests/resources/diff_format_email/.gitted/objects/73/09653445ecf038d3e3dd9ed55edb6cb541a4ba | bin | 0 -> 28 bytes | |||
| -rw-r--r-- | tests/resources/diff_format_email/.gitted/objects/d5/ff67764c82f729b13c26a09576570d884d9687 | bin | 0 -> 121 bytes | |||
| -rw-r--r-- | tests/resources/diff_format_email/.gitted/refs/heads/master | 2 | ||||
| -rw-r--r-- | tests/resources/diff_format_email/file3.txt | 1 |
7 files changed, 44 insertions, 1 deletions
diff --git a/tests/diff/format_email.c b/tests/diff/format_email.c index 18ad99bd5..8a0128898 100644 --- a/tests/diff/format_email.c +++ b/tests/diff/format_email.c @@ -97,6 +97,47 @@ void test_diff_format_email__simple(void) email, "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts); } +void test_diff_format_email__with_message(void) +{ + git_diff_format_email_options opts = GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT; + const char *email = "From 627e7e12d87e07a83fad5b6bfa25e86ead4a5270 Mon Sep 17 00:00:00 2001\n" \ + "From: Patrick Steinhardt <ps@pks.im>\n" \ + "Date: Tue, 24 Nov 2015 13:34:39 +0100\n" \ + "Subject: [PATCH] Modify content with message\n" \ + "\n" \ + "Modify content of file3.txt by appending a new line. Make this\n" \ + "commit message somewhat longer to test behavior with newlines\n" \ + "embedded in the message body.\n" \ + "\n" \ + "Also test if new paragraphs are included correctly.\n" \ + "---\n" \ + " file3.txt | 1 +\n" \ + " 1 file changed, 1 insertion(+), 0 deletions(-)\n" \ + "\n" \ + "diff --git a/file3.txt b/file3.txt\n" \ + "index 9a2d780..7309653 100644\n" \ + "--- a/file3.txt\n" \ + "+++ b/file3.txt\n" \ + "@@ -3,3 +3,4 @@ file3!\n" \ + " file3\n" \ + " file3\n" \ + " file3\n" \ + "+file3\n" \ + "--\n" \ + "libgit2 0.23.0\n" \ + "\n"; + + opts.body = "Modify content of file3.txt by appending a new line. Make this\n" \ + "commit message somewhat longer to test behavior with newlines\n" \ + "embedded in the message body.\n" \ + "\n" \ + "Also test if new paragraphs are included correctly."; + + assert_email_match( + email, "627e7e12d87e07a83fad5b6bfa25e86ead4a5270", &opts); +} + + void test_diff_format_email__multiple(void) { git_oid oid; diff --git a/tests/resources/diff_format_email/.gitted/index b/tests/resources/diff_format_email/.gitted/index Binary files differindex f73027e56..d94f87de8 100644 --- a/tests/resources/diff_format_email/.gitted/index +++ b/tests/resources/diff_format_email/.gitted/index diff --git a/tests/resources/diff_format_email/.gitted/objects/62/7e7e12d87e07a83fad5b6bfa25e86ead4a5270 b/tests/resources/diff_format_email/.gitted/objects/62/7e7e12d87e07a83fad5b6bfa25e86ead4a5270 new file mode 100644 index 000000000..269a5bcf4 --- /dev/null +++ b/tests/resources/diff_format_email/.gitted/objects/62/7e7e12d87e07a83fad5b6bfa25e86ead4a5270 @@ -0,0 +1 @@ +xMN0YGر] !8@%$Nqb5#{Jq+`ޛE!*RR8=5(MT b)⺗AQގE3` W3- cZLO{}O3Bh.Px쇾gޏ$;f\Ntkzc⊼O{|L3Hx5&hN]G5oxYܺRL7SnG15jl~1f.f_*
wt6T;
\ No newline at end of file diff --git a/tests/resources/diff_format_email/.gitted/objects/73/09653445ecf038d3e3dd9ed55edb6cb541a4ba b/tests/resources/diff_format_email/.gitted/objects/73/09653445ecf038d3e3dd9ed55edb6cb541a4ba Binary files differnew file mode 100644 index 000000000..ba9c5fa57 --- /dev/null +++ b/tests/resources/diff_format_email/.gitted/objects/73/09653445ecf038d3e3dd9ed55edb6cb541a4ba diff --git a/tests/resources/diff_format_email/.gitted/objects/d5/ff67764c82f729b13c26a09576570d884d9687 b/tests/resources/diff_format_email/.gitted/objects/d5/ff67764c82f729b13c26a09576570d884d9687 Binary files differnew file mode 100644 index 000000000..e838eeb25 --- /dev/null +++ b/tests/resources/diff_format_email/.gitted/objects/d5/ff67764c82f729b13c26a09576570d884d9687 diff --git a/tests/resources/diff_format_email/.gitted/refs/heads/master b/tests/resources/diff_format_email/.gitted/refs/heads/master index f0f3f932a..3bc734d47 100644 --- a/tests/resources/diff_format_email/.gitted/refs/heads/master +++ b/tests/resources/diff_format_email/.gitted/refs/heads/master @@ -1 +1 @@ -873806f6f27e631eb0b23e4b56bea2bfac14a373 +627e7e12d87e07a83fad5b6bfa25e86ead4a5270 diff --git a/tests/resources/diff_format_email/file3.txt b/tests/resources/diff_format_email/file3.txt index 9a2d780ac..730965344 100644 --- a/tests/resources/diff_format_email/file3.txt +++ b/tests/resources/diff_format_email/file3.txt @@ -3,3 +3,4 @@ file3! file3 file3 file3 +file3 |
