@@ -112,6 +112,59 @@ void test_email_create__commit(void)
112112 email , "9264b96c6d104d0e07ae33d3007b6a48246c6f92" , NULL );
113113}
114114
115+ void test_email_create__binary (void )
116+ {
117+ const char * expected =
118+ "From 8d7523f6fcb2404257889abe0d96f093d9f524f9 Mon Sep 17 00:00:00 2001\n" \
119+ "From: Jacques Germishuys <jacquesg@striata.com>\n" \
120+ "Date: Sun, 13 Apr 2014 18:10:18 +0200\n" \
121+ "Subject: [PATCH] Modified binary file\n" \
122+ "\n" \
123+ "---\n" \
124+ " binary.bin | Bin 3 -> 5 bytes\n" \
125+ " 1 file changed, 0 insertions(+), 0 deletions(-)\n" \
126+ "\n" \
127+ "diff --git a/binary.bin b/binary.bin\n" \
128+ "index bd474b2519cc15eab801ff851cc7d50f0dee49a1..9ac35ff15cd8864aeafd889e4826a3150f0b06c4 100644\n" \
129+ "GIT binary patch\n" \
130+ "literal 5\n" \
131+ "Mc${NkU}WL~000&M4gdfE\n" \
132+ "\n" \
133+ "literal 3\n" \
134+ "Kc${Nk-~s>u4FC%O\n" \
135+ "\n" \
136+ "--\n" \
137+ "libgit2 " LIBGIT2_VERSION "\n" \
138+ "\n" ;
139+
140+ assert_email_match (expected , "8d7523f6fcb2404257889abe0d96f093d9f524f9" , NULL );
141+ }
142+
143+ void test_email_create__binary_not_included (void )
144+ {
145+ const char * expected =
146+ "From 8d7523f6fcb2404257889abe0d96f093d9f524f9 Mon Sep 17 00:00:00 2001\n" \
147+ "From: Jacques Germishuys <jacquesg@striata.com>\n" \
148+ "Date: Sun, 13 Apr 2014 18:10:18 +0200\n" \
149+ "Subject: [PATCH] Modified binary file\n" \
150+ "\n" \
151+ "---\n" \
152+ " binary.bin | Bin 3 -> 5 bytes\n" \
153+ " 1 file changed, 0 insertions(+), 0 deletions(-)\n" \
154+ "\n" \
155+ "diff --git a/binary.bin b/binary.bin\n" \
156+ "index bd474b2..9ac35ff 100644\n" \
157+ "Binary files a/binary.bin and b/binary.bin differ\n" \
158+ "--\n" \
159+ "libgit2 " LIBGIT2_VERSION "\n" \
160+ "\n" ;
161+
162+ git_email_create_options opts = GIT_EMAIL_CREATE_OPTIONS_INIT ;
163+ opts .diff_opts .flags &= ~GIT_DIFF_SHOW_BINARY ;
164+
165+ assert_email_match (expected , "8d7523f6fcb2404257889abe0d96f093d9f524f9" , & opts );
166+ }
167+
115168void test_email_create__custom_summary_and_body (void )
116169{
117170 const char * expected = "From 627e7e12d87e07a83fad5b6bfa25e86ead4a5270 Mon Sep 17 00:00:00 2001\n" \
0 commit comments