git-format-patch: add --no-binary to omit binary changes in the patch.
Add a new option --no-binary to git-format-patch so that no binary changes are included in the generated patches, only notices that those files changed. This generate patches that cannot be applied, but still is useful for generating mails for code review purposes. See also: commit e47f306d4bf964def1a0b29e8f7cea419471dffd, where --binary option was turned on by default. Signed-off-by: Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Caio Marcelo de Oliveira Filho committed
May 9, 2008 at 19:55 UTC
37c22a4bf801403f71a5e9674d8e314ce575945e
2 files changed
+10
-1
Documentation/git-format-patch.txt
+6
@@ -156,6 +156,12 @@ want a filename like `0001-description-of-my-change.patch`, and
156
the first letter does not have to be a dot. Leaving it empty would
157
not add any suffix.
158
159
+--no-binary::
160
+ Don't output contents of changes in binary files, just take note
161
+ that they differ. Note that this disable the patch to be properly
162
+ applied. By default the contents of changes in those files are
163
+ encoded in the patch.
164
+
165
CONFIGURATION
166
-------------
167
You can specify extra mail header lines to be added to each message
builtin-log.c
+4
-1
@@ -757,6 +757,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
757
int thread = 0;
758
int cover_letter = 0;
759
int boundary_count = 0;
760
+ int no_binary_diff = 0;
761
struct commit *origin = NULL, *head = NULL;
762
const char *in_reply_to = NULL;
763
struct patch_ids ids;
@@ -862,6 +863,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
863
fmt_patch_suffix = argv[i] + 9;
864
else if (!strcmp(argv[i], "--cover-letter"))
865
cover_letter = 1;
866
+ else if (!strcmp(argv[i], "--no-binary"))
867
+ no_binary_diff = 1;
868
else
869
argv[j++] = argv[i];
870
}
@@ -914,7 +917,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
917
if (!rev.diffopt.output_format)
918
rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;
919
917
- if (!DIFF_OPT_TST(&rev.diffopt, TEXT))
920
+ if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)
921
DIFF_OPT_SET(&rev.diffopt, BINARY);
922
923
if (!output_directory && !use_stdout)