diff options
author | Junio C Hamano <junkio@cox.net> | 2005-11-09 21:09:43 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-11-09 21:09:43 -0800 |
commit | 23ea3e201cea0deea909569e08e950a9ec2345f7 (patch) | |
tree | 614520079f232d1459467b6e718182a8721aadd5 /apply.c | |
parent | 5ca15b8af7f018b9ae9da30130f9dcd1a896e0b3 (diff) | |
parent | a1c292958f9968565f4048a17196d99fd16fc7ca (diff) |
GIT 0.99.9gv0.99.9g
Another snapshot, as slow and steady marth towards 1.0 continues.
Major changes include:
- Jim Radford's RPM split.
- Fredrik's recursive merge strategy is now default for two heads merge.
- Yaacov's SVN importer updates.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'apply.c')
-rw-r--r-- | apply.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -53,7 +53,7 @@ struct fragment { struct patch { char *new_name, *old_name, *def_name; unsigned int old_mode, new_mode; - int is_rename, is_copy, is_new, is_delete; + int is_rename, is_copy, is_new, is_delete, is_binary; int lines_added, lines_deleted; int score; struct fragment *fragments; @@ -890,8 +890,18 @@ static int parse_chunk(char *buffer, unsigned long size, struct patch *patch) patchsize = parse_single_patch(buffer + offset + hdrsize, size - offset - hdrsize, patch); - if (!patchsize && !metadata_changes(patch)) - die("patch with only garbage at line %d", linenr); + if (!patchsize && !metadata_changes(patch)) { + static const char binhdr[] = "Binary files "; + + if (sizeof(binhdr) - 1 < size - offset - hdrsize && + !memcmp(binhdr, buffer + hdrsize, sizeof(binhdr)-1)) + patch->is_binary = 1; + + if (patch->is_binary && !apply && !check) + ; + else + die("patch with only garbage at line %d", linenr); + } return offset + hdrsize + patchsize; } @@ -949,9 +959,12 @@ static void show_stats(struct patch *patch) add = (add * max + max_change / 2) / max_change; del = total - add; } - printf(" %s%-*s |%5d %.*s%.*s\n", prefix, - len, name, patch->lines_added + patch->lines_deleted, - add, pluses, del, minuses); + if (patch->is_binary) + printf(" %s%-*s | Bin\n", prefix, len, name); + else + printf(" %s%-*s |%5d %.*s%.*s\n", prefix, + len, name, patch->lines_added + patch->lines_deleted, + add, pluses, del, minuses); if (qname) free(qname); } |