Skip to content

Commit

Permalink
git-format-patch: add --no-binary to omit binary changes in the patch.
Browse files Browse the repository at this point in the history
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 e47f306, 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>
  • Loading branch information
Caio Marcelo de Oliveira Filho authored and Junio C Hamano committed May 11, 2008
1 parent c998ae9 commit 37c22a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Documentation/git-format-patch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ want a filename like `0001-description-of-my-change.patch`, and
the first letter does not have to be a dot. Leaving it empty would
not add any suffix.

--no-binary::
Don't output contents of changes in binary files, just take note
that they differ. Note that this disable the patch to be properly
applied. By default the contents of changes in those files are
encoded in the patch.

CONFIGURATION
-------------
You can specify extra mail header lines to be added to each message
Expand Down
5 changes: 4 additions & 1 deletion builtin-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
int thread = 0;
int cover_letter = 0;
int boundary_count = 0;
int no_binary_diff = 0;
struct commit *origin = NULL, *head = NULL;
const char *in_reply_to = NULL;
struct patch_ids ids;
Expand Down Expand Up @@ -862,6 +863,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
fmt_patch_suffix = argv[i] + 9;
else if (!strcmp(argv[i], "--cover-letter"))
cover_letter = 1;
else if (!strcmp(argv[i], "--no-binary"))
no_binary_diff = 1;
else
argv[j++] = argv[i];
}
Expand Down Expand Up @@ -914,7 +917,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
if (!rev.diffopt.output_format)
rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;

if (!DIFF_OPT_TST(&rev.diffopt, TEXT))
if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)
DIFF_OPT_SET(&rev.diffopt, BINARY);

if (!output_directory && !use_stdout)
Expand Down

0 comments on commit 37c22a4

Please sign in to comment.