From: Junio C Hamano Date: Thu, 19 Oct 2006 05:08:46 +0000 (-0700) Subject: Merge early part of branch 'jc/diff-apply-patch' X-Git-Tag: v1.4.4-rc1~87 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/17250ac172b44acd3bdf4ddffb4ed6d915b69246?ds=inline;hp=-c Merge early part of branch 'jc/diff-apply-patch' --- 17250ac172b44acd3bdf4ddffb4ed6d915b69246 diff --combined builtin-apply.c index cbe597771b,a7317d7544..0bdcf63904 --- a/builtin-apply.c +++ b/builtin-apply.c @@@ -360,7 -360,7 +360,7 @@@ static int gitdiff_hdrend(const char *l static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, const char *oldnew) { if (!orig_name && !isnull) - return find_name(line, NULL, 1, 0); + return find_name(line, NULL, 1, TERM_TAB); if (orig_name) { int len; @@@ -370,7 -370,7 +370,7 @@@ len = strlen(name); if (isnull) die("git-apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr); - another = find_name(line, NULL, 1, 0); + another = find_name(line, NULL, 1, TERM_TAB); if (!another || memcmp(another, name, len)) die("git-apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr); free(another); @@@ -1783,6 -1783,8 +1783,6 @@@ static int apply_binary(struct buffer_d { const char *name = patch->old_name ? patch->old_name : patch->new_name; unsigned char sha1[20]; - unsigned char hdr[50]; - int hdrlen; /* For safety, we require patch index line to contain * full 40-byte textual SHA1 for old and new, at least for now. @@@ -1798,7 -1800,8 +1798,7 @@@ /* See if the old one matches what the patch * applies to. */ - write_sha1_file_prepare(desc->buffer, desc->size, - blob_type, sha1, hdr, &hdrlen); + hash_sha1_file(desc->buffer, desc->size, blob_type, sha1); if (strcmp(sha1_to_hex(sha1), patch->old_sha1_prefix)) return error("the patch applies to '%s' (%s), " "which does not match the " @@@ -1843,7 -1846,8 +1843,7 @@@ name); /* verify that the result matches */ - write_sha1_file_prepare(desc->buffer, desc->size, blob_type, - sha1, hdr, &hdrlen); + hash_sha1_file(desc->buffer, desc->size, blob_type, sha1); if (strcmp(sha1_to_hex(sha1), patch->new_sha1_prefix)) return error("binary patch to '%s' creates incorrect result (expecting %s, got %s)", name, patch->new_sha1_prefix, sha1_to_hex(sha1)); } @@@ -2108,7 -2112,7 +2108,7 @@@ static void numstat_patch_list(struct p quote_c_style(name, NULL, stdout, 0); else fputs(name, stdout); - putchar('\n'); + putchar(line_termination); } }