patch 164 builtin/add.c int interactive_add(int argc, const char **argv, const char *prefix, int patch) patch 175 builtin/add.c patch ? "--patch" : NULL, patch 165 builtin/apply.c const char *patch; patch 208 builtin/apply.c struct patch *next; patch 219 builtin/apply.c free((char *)list->patch); patch 225 builtin/apply.c static void free_patch(struct patch *patch) patch 227 builtin/apply.c free_fragment_list(patch->fragments); patch 228 builtin/apply.c free(patch->def_name); patch 229 builtin/apply.c free(patch->old_name); patch 230 builtin/apply.c free(patch->new_name); patch 231 builtin/apply.c free(patch->result); patch 232 builtin/apply.c free(patch); patch 235 builtin/apply.c static void free_patch_list(struct patch *list) patch 238 builtin/apply.c struct patch *next = list->next; patch 391 builtin/apply.c static void say_patch_name(FILE *output, const char *fmt, struct patch *patch) patch 395 builtin/apply.c if (patch->old_name && patch->new_name && patch 396 builtin/apply.c strcmp(patch->old_name, patch->new_name)) { patch 397 builtin/apply.c quote_c_style(patch->old_name, &sb, NULL, 0); patch 399 builtin/apply.c quote_c_style(patch->new_name, &sb, NULL, 0); patch 401 builtin/apply.c const char *n = patch->new_name; patch 403 builtin/apply.c n = patch->old_name; patch 867 builtin/apply.c static void parse_traditional_patch(const char *first, const char *second, struct patch *patch) patch 884 builtin/apply.c patch->is_new = 1; patch 885 builtin/apply.c patch->is_delete = 0; patch 887 builtin/apply.c patch->new_name = name; patch 889 builtin/apply.c patch->is_new = 0; patch 890 builtin/apply.c patch->is_delete = 1; patch 892 builtin/apply.c patch->old_name = name; patch 899 builtin/apply.c patch->is_new = 1; patch 900 builtin/apply.c patch->is_delete = 0; patch 901 builtin/apply.c patch->new_name = name; patch 903 builtin/apply.c patch->is_new = 0; patch 904 builtin/apply.c patch->is_delete = 1; patch 905 builtin/apply.c patch->old_name = name; patch 907 builtin/apply.c patch->old_name = name; patch 908 builtin/apply.c patch->new_name = xstrdup_or_null(name); patch 915 builtin/apply.c static int gitdiff_hdrend(const char *line, struct patch *patch) patch 961 builtin/apply.c static int gitdiff_oldname(const char *line, struct patch *patch) patch 963 builtin/apply.c char *orig = patch->old_name; patch 964 builtin/apply.c patch->old_name = gitdiff_verify_name(line, patch->is_new, patch->old_name, patch 966 builtin/apply.c if (orig != patch->old_name) patch 971 builtin/apply.c static int gitdiff_newname(const char *line, struct patch *patch) patch 973 builtin/apply.c char *orig = patch->new_name; patch 974 builtin/apply.c patch->new_name = gitdiff_verify_name(line, patch->is_delete, patch->new_name, patch 976 builtin/apply.c if (orig != patch->new_name) patch 981 builtin/apply.c static int gitdiff_oldmode(const char *line, struct patch *patch) patch 983 builtin/apply.c patch->old_mode = strtoul(line, NULL, 8); patch 987 builtin/apply.c static int gitdiff_newmode(const char *line, struct patch *patch) patch 989 builtin/apply.c patch->new_mode = strtoul(line, NULL, 8); patch 993 builtin/apply.c static int gitdiff_delete(const char *line, struct patch *patch) patch 995 builtin/apply.c patch->is_delete = 1; patch 996 builtin/apply.c free(patch->old_name); patch 997 builtin/apply.c patch->old_name = xstrdup_or_null(patch->def_name); patch 998 builtin/apply.c return gitdiff_oldmode(line, patch); patch 1001 builtin/apply.c static int gitdiff_newfile(const char *line, struct patch *patch) patch 1003 builtin/apply.c patch->is_new = 1; patch 1004 builtin/apply.c free(patch->new_name); patch 1005 builtin/apply.c patch->new_name = xstrdup_or_null(patch->def_name); patch 1006 builtin/apply.c return gitdiff_newmode(line, patch); patch 1009 builtin/apply.c static int gitdiff_copysrc(const char *line, struct patch *patch) patch 1011 builtin/apply.c patch->is_copy = 1; patch 1012 builtin/apply.c free(patch->old_name); patch 1013 builtin/apply.c patch->old_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0); patch 1017 builtin/apply.c static int gitdiff_copydst(const char *line, struct patch *patch) patch 1019 builtin/apply.c patch->is_copy = 1; patch 1020 builtin/apply.c free(patch->new_name); patch 1021 builtin/apply.c patch->new_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0); patch 1025 builtin/apply.c static int gitdiff_renamesrc(const char *line, struct patch *patch) patch 1027 builtin/apply.c patch->is_rename = 1; patch 1028 builtin/apply.c free(patch->old_name); patch 1029 builtin/apply.c patch->old_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0); patch 1033 builtin/apply.c static int gitdiff_renamedst(const char *line, struct patch *patch) patch 1035 builtin/apply.c patch->is_rename = 1; patch 1036 builtin/apply.c free(patch->new_name); patch 1037 builtin/apply.c patch->new_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0); patch 1041 builtin/apply.c static int gitdiff_similarity(const char *line, struct patch *patch) patch 1045 builtin/apply.c patch->score = val; patch 1049 builtin/apply.c static int gitdiff_dissimilarity(const char *line, struct patch *patch) patch 1053 builtin/apply.c patch->score = val; patch 1057 builtin/apply.c static int gitdiff_index(const char *line, struct patch *patch) patch 1070 builtin/apply.c memcpy(patch->old_sha1_prefix, line, len); patch 1071 builtin/apply.c patch->old_sha1_prefix[len] = 0; patch 1083 builtin/apply.c memcpy(patch->new_sha1_prefix, line, len); patch 1084 builtin/apply.c patch->new_sha1_prefix[len] = 0; patch 1086 builtin/apply.c patch->old_mode = strtoul(ptr+1, NULL, 8); patch 1094 builtin/apply.c static int gitdiff_unrecognized(const char *line, struct patch *patch) patch 1265 builtin/apply.c static int parse_git_header(const char *line, int len, unsigned int size, struct patch *patch) patch 1270 builtin/apply.c patch->is_new = 0; patch 1271 builtin/apply.c patch->is_delete = 0; patch 1279 builtin/apply.c patch->def_name = git_header_name(line, len); patch 1280 builtin/apply.c if (patch->def_name && root) { patch 1281 builtin/apply.c char *s = xstrfmt("%s%s", root, patch->def_name); patch 1282 builtin/apply.c free(patch->def_name); patch 1283 builtin/apply.c patch->def_name = s; patch 1292 builtin/apply.c int (*fn)(const char *, struct patch *); patch 1322 builtin/apply.c if (p->fn(line + oplen, patch) < 0) patch 1447 builtin/apply.c static int find_header(const char *line, unsigned long size, int *hdrsize, struct patch *patch) patch 1451 builtin/apply.c patch->is_toplevel_relative = 0; patch 1452 builtin/apply.c patch->is_rename = patch->is_copy = 0; patch 1453 builtin/apply.c patch->is_new = patch->is_delete = -1; patch 1454 builtin/apply.c patch->old_mode = patch->new_mode = 0; patch 1455 builtin/apply.c patch->old_name = patch->new_name = NULL; patch 1488 builtin/apply.c int git_hdr_len = parse_git_header(line, len, size, patch); patch 1491 builtin/apply.c if (!patch->old_name && !patch->new_name) { patch 1492 builtin/apply.c if (!patch->def_name) patch 1499 builtin/apply.c patch->old_name = xstrdup(patch->def_name); patch 1500 builtin/apply.c patch->new_name = xstrdup(patch->def_name); patch 1502 builtin/apply.c if (!patch->is_delete && !patch->new_name) patch 1505 builtin/apply.c patch->is_toplevel_relative = 1; patch 1524 builtin/apply.c parse_traditional_patch(line, line+len, patch); patch 1564 builtin/apply.c struct patch *patch, struct fragment *fragment) patch 1574 builtin/apply.c if (offset > 0 && patch->recount) patch 1606 builtin/apply.c check_whitespace(line, len, patch->ws_rule); patch 1611 builtin/apply.c check_whitespace(line, len, patch->ws_rule); patch 1619 builtin/apply.c check_whitespace(line, len, patch->ws_rule); patch 1655 builtin/apply.c patch->lines_added += added; patch 1656 builtin/apply.c patch->lines_deleted += deleted; patch 1658 builtin/apply.c if (0 < patch->is_new && oldlines) patch 1660 builtin/apply.c if (0 < patch->is_delete && newlines) patch 1673 builtin/apply.c static int parse_single_patch(const char *line, unsigned long size, struct patch *patch) patch 1677 builtin/apply.c struct fragment **fragp = &patch->fragments; patch 1685 builtin/apply.c len = parse_fragment(line, size, patch, fragment); patch 1688 builtin/apply.c fragment->patch = line; patch 1715 builtin/apply.c if (patch->is_new < 0 && patch 1716 builtin/apply.c (oldlines || (patch->fragments && patch->fragments->next))) patch 1717 builtin/apply.c patch->is_new = 0; patch 1718 builtin/apply.c if (patch->is_delete < 0 && patch 1719 builtin/apply.c (newlines || (patch->fragments && patch->fragments->next))) patch 1720 builtin/apply.c patch->is_delete = 0; patch 1722 builtin/apply.c if (0 < patch->is_new && oldlines) patch 1723 builtin/apply.c die(_("new file %s depends on old contents"), patch->new_name); patch 1724 builtin/apply.c if (0 < patch->is_delete && newlines) patch 1725 builtin/apply.c die(_("deleted file %s still has contents"), patch->old_name); patch 1726 builtin/apply.c if (!patch->is_delete && !newlines && context) patch 1730 builtin/apply.c patch->new_name); patch 1735 builtin/apply.c static inline int metadata_changes(struct patch *patch) patch 1737 builtin/apply.c return patch->is_rename > 0 || patch 1738 builtin/apply.c patch->is_copy > 0 || patch 1739 builtin/apply.c patch->is_new > 0 || patch 1740 builtin/apply.c patch->is_delete || patch 1741 builtin/apply.c (patch->old_mode && patch->new_mode && patch 1742 builtin/apply.c patch->old_mode != patch->new_mode); patch 1859 builtin/apply.c frag->patch = inflate_it(data, hunk_size, origlen); patch 1861 builtin/apply.c if (!frag->patch) patch 1879 builtin/apply.c static int parse_binary(char *buffer, unsigned long size, struct patch *patch) patch 1916 builtin/apply.c free((void*) forward->patch); patch 1921 builtin/apply.c patch->fragments = forward; patch 1922 builtin/apply.c patch->is_binary = 1; patch 1935 builtin/apply.c static void prefix_patch(struct patch *p) patch 1957 builtin/apply.c static int use_patch(struct patch *p) patch 1993 builtin/apply.c static int parse_chunk(char *buffer, unsigned long size, struct patch *patch) patch 1996 builtin/apply.c int offset = find_header(buffer, size, &hdrsize, patch); patch 2001 builtin/apply.c prefix_patch(patch); patch 2003 builtin/apply.c if (!use_patch(patch)) patch 2004 builtin/apply.c patch->ws_rule = 0; patch 2006 builtin/apply.c patch->ws_rule = whitespace_rule(patch->new_name patch 2007 builtin/apply.c ? patch->new_name patch 2008 builtin/apply.c : patch->old_name); patch 2011 builtin/apply.c size - offset - hdrsize, patch); patch 2023 builtin/apply.c size - hd - llen, patch); patch 2041 builtin/apply.c patch->is_binary = 1; patch 2053 builtin/apply.c (!patch->is_binary && !metadata_changes(patch))) patch 2069 builtin/apply.c static void reverse_patches(struct patch *p) patch 2092 builtin/apply.c static void show_stats(struct patch *patch) patch 2095 builtin/apply.c char *cp = patch->new_name ? patch->new_name : patch->old_name; patch 2114 builtin/apply.c if (patch->is_binary) { patch 2127 builtin/apply.c add = patch->lines_added; patch 2128 builtin/apply.c del = patch->lines_deleted; patch 2135 builtin/apply.c printf("%5d %.*s%.*s\n", patch->lines_added + patch->lines_deleted, patch 2684 builtin/apply.c const char *patch = frag->patch; patch 2704 builtin/apply.c int len = linelen(patch, size); patch 2721 builtin/apply.c if (len < size && patch[len] == '\\') patch 2723 builtin/apply.c first = *patch; patch 2745 builtin/apply.c ws_blank_line(patch + 1, plen, ws_rule)) patch 2748 builtin/apply.c memcpy(old, patch + 1, plen); patch 2764 builtin/apply.c strbuf_add(&newlines, patch + 1, plen); patch 2767 builtin/apply.c ws_fix_copy(&newlines, patch + 1, plen, ws_rule, &applied_after_fixing_ws); patch 2773 builtin/apply.c ws_blank_line(patch + 1, plen, ws_rule)) patch 2794 builtin/apply.c patch += len; patch 2931 builtin/apply.c static int apply_binary_fragment(struct image *img, struct patch *patch) patch 2933 builtin/apply.c struct fragment *fragment = patch->fragments; patch 2939 builtin/apply.c patch->new_name ? patch 2940 builtin/apply.c patch->new_name : patch 2941 builtin/apply.c patch->old_name); patch 2948 builtin/apply.c patch->new_name patch 2949 builtin/apply.c ? patch->new_name : patch->old_name); patch 2954 builtin/apply.c dst = patch_delta(img->buf, img->len, fragment->patch, patch 2965 builtin/apply.c img->buf = xmemdupz(fragment->patch, img->len); patch 2977 builtin/apply.c static int apply_binary(struct image *img, struct patch *patch) patch 2979 builtin/apply.c const char *name = patch->old_name ? patch->old_name : patch->new_name; patch 2986 builtin/apply.c if (strlen(patch->old_sha1_prefix) != 40 || patch 2987 builtin/apply.c strlen(patch->new_sha1_prefix) != 40 || patch 2988 builtin/apply.c get_sha1_hex(patch->old_sha1_prefix, sha1) || patch 2989 builtin/apply.c get_sha1_hex(patch->new_sha1_prefix, sha1)) patch 2993 builtin/apply.c if (patch->old_name) { patch 2999 builtin/apply.c if (strcmp(sha1_to_hex(sha1), patch->old_sha1_prefix)) patch 3012 builtin/apply.c get_sha1_hex(patch->new_sha1_prefix, sha1); patch 3028 builtin/apply.c patch->new_sha1_prefix, name); patch 3038 builtin/apply.c if (apply_binary_fragment(img, patch)) patch 3044 builtin/apply.c if (strcmp(sha1_to_hex(sha1), patch->new_sha1_prefix)) patch 3046 builtin/apply.c name, patch->new_sha1_prefix, sha1_to_hex(sha1)); patch 3052 builtin/apply.c static int apply_fragments(struct image *img, struct patch *patch) patch 3054 builtin/apply.c struct fragment *frag = patch->fragments; patch 3055 builtin/apply.c const char *name = patch->old_name ? patch->old_name : patch->new_name; patch 3056 builtin/apply.c unsigned ws_rule = patch->ws_rule; patch 3057 builtin/apply.c unsigned inaccurate_eof = patch->inaccurate_eof; patch 3060 builtin/apply.c if (patch->is_binary) patch 3061 builtin/apply.c return apply_binary(img, patch); patch 3102 builtin/apply.c static struct patch *in_fn_table(const char *name) patch 3111 builtin/apply.c return (struct patch *)item->util; patch 3128 builtin/apply.c #define PATH_TO_BE_DELETED ((struct patch *) -2) patch 3129 builtin/apply.c #define PATH_WAS_DELETED ((struct patch *) -1) patch 3131 builtin/apply.c static int to_be_deleted(struct patch *patch) patch 3133 builtin/apply.c return patch == PATH_TO_BE_DELETED; patch 3136 builtin/apply.c static int was_deleted(struct patch *patch) patch 3138 builtin/apply.c return patch == PATH_WAS_DELETED; patch 3141 builtin/apply.c static void add_to_fn_table(struct patch *patch) patch 3150 builtin/apply.c if (patch->new_name != NULL) { patch 3151 builtin/apply.c item = string_list_insert(&fn_table, patch->new_name); patch 3152 builtin/apply.c item->util = patch; patch 3159 builtin/apply.c if ((patch->new_name == NULL) || (patch->is_rename)) { patch 3160 builtin/apply.c item = string_list_insert(&fn_table, patch->old_name); patch 3165 builtin/apply.c static void prepare_fn_table(struct patch *patch) patch 3170 builtin/apply.c while (patch) { patch 3171 builtin/apply.c if ((patch->new_name == NULL) || (patch->is_rename)) { patch 3173 builtin/apply.c item = string_list_insert(&fn_table, patch->old_name); patch 3176 builtin/apply.c patch = patch->next; patch 3194 builtin/apply.c static struct patch *previous_patch(struct patch *patch, int *gone) patch 3196 builtin/apply.c struct patch *previous; patch 3199 builtin/apply.c if (patch->is_copy || patch->is_rename) patch 3202 builtin/apply.c previous = in_fn_table(patch->old_name); patch 3260 builtin/apply.c struct patch *patch, struct stat *st, patch 3266 builtin/apply.c struct patch *previous; patch 3269 builtin/apply.c previous = previous_patch(patch, &status); patch 3272 builtin/apply.c patch->old_name); patch 3278 builtin/apply.c patch->old_name, patch->old_mode); patch 3288 builtin/apply.c free_fragment_list(patch->fragments); patch 3289 builtin/apply.c patch->fragments = NULL; patch 3291 builtin/apply.c return error(_("read of %s failed"), patch->old_name); patch 3296 builtin/apply.c prepare_image(image, img, len, !patch->is_binary); patch 3336 builtin/apply.c static int load_current(struct image *image, struct patch *patch) patch 3344 builtin/apply.c char *name = patch->new_name; patch 3345 builtin/apply.c unsigned mode = patch->new_mode; patch 3347 builtin/apply.c if (!patch->is_new) patch 3348 builtin/apply.c die("BUG: patch to %s is not a creation", patch->old_name); patch 3369 builtin/apply.c prepare_image(image, img, len, !patch->is_binary); patch 3373 builtin/apply.c static int try_threeway(struct image *image, struct patch *patch, patch 3384 builtin/apply.c if (patch->is_delete || patch 3385 builtin/apply.c S_ISGITLINK(patch->old_mode) || S_ISGITLINK(patch->new_mode)) patch 3389 builtin/apply.c if (patch->is_new) patch 3391 builtin/apply.c else if (get_sha1(patch->old_sha1_prefix, pre_sha1) || patch 3392 builtin/apply.c read_blob_object(&buf, pre_sha1, patch->old_mode)) patch 3400 builtin/apply.c if (apply_fragments(&tmp_image, patch) < 0) { patch 3409 builtin/apply.c if (patch->is_new) { patch 3410 builtin/apply.c if (load_current(&tmp_image, patch)) patch 3412 builtin/apply.c patch->new_name); patch 3414 builtin/apply.c if (load_preimage(&tmp_image, patch, st, ce)) patch 3416 builtin/apply.c patch->old_name); patch 3422 builtin/apply.c status = three_way_merge(image, patch->new_name, patch 3430 builtin/apply.c patch->conflicted_threeway = 1; patch 3431 builtin/apply.c if (patch->is_new) patch 3432 builtin/apply.c oidclr(&patch->threeway_stage[0]); patch 3434 builtin/apply.c hashcpy(patch->threeway_stage[0].hash, pre_sha1); patch 3435 builtin/apply.c hashcpy(patch->threeway_stage[1].hash, our_sha1); patch 3436 builtin/apply.c hashcpy(patch->threeway_stage[2].hash, post_sha1); patch 3437 builtin/apply.c fprintf(stderr, "Applied patch to '%s' with conflicts.\n", patch->new_name); patch 3439 builtin/apply.c fprintf(stderr, "Applied patch to '%s' cleanly.\n", patch->new_name); patch 3444 builtin/apply.c static int apply_data(struct patch *patch, struct stat *st, const struct cache_entry *ce) patch 3448 builtin/apply.c if (load_preimage(&image, patch, st, ce) < 0) patch 3451 builtin/apply.c if (patch->direct_to_threeway || patch 3452 builtin/apply.c apply_fragments(&image, patch) < 0) { patch 3454 builtin/apply.c if (!threeway || try_threeway(&image, patch, st, ce) < 0) patch 3457 builtin/apply.c patch->result = image.buf; patch 3458 builtin/apply.c patch->resultsize = image.len; patch 3459 builtin/apply.c add_to_fn_table(patch); patch 3462 builtin/apply.c if (0 < patch->is_delete && patch->resultsize) patch 3479 builtin/apply.c static int check_preimage(struct patch *patch, struct cache_entry **ce, struct stat *st) patch 3481 builtin/apply.c const char *old_name = patch->old_name; patch 3482 builtin/apply.c struct patch *previous = NULL; patch 3489 builtin/apply.c assert(patch->is_new <= 0); patch 3490 builtin/apply.c previous = previous_patch(patch, &status); patch 3505 builtin/apply.c if (patch->is_new < 0) patch 3519 builtin/apply.c if (patch->is_new < 0) patch 3527 builtin/apply.c if (patch->is_new < 0) patch 3528 builtin/apply.c patch->is_new = 0; patch 3529 builtin/apply.c if (!patch->old_mode) patch 3530 builtin/apply.c patch->old_mode = st_mode; patch 3531 builtin/apply.c if ((st_mode ^ patch->old_mode) & S_IFMT) patch 3533 builtin/apply.c if (st_mode != patch->old_mode) patch 3535 builtin/apply.c old_name, st_mode, patch->old_mode); patch 3536 builtin/apply.c if (!patch->new_mode && !patch->is_delete) patch 3537 builtin/apply.c patch->new_mode = st_mode; patch 3541 builtin/apply.c patch->is_new = 1; patch 3542 builtin/apply.c patch->is_delete = 0; patch 3543 builtin/apply.c free(patch->old_name); patch 3544 builtin/apply.c patch->old_name = NULL; patch 3618 builtin/apply.c static void prepare_symlink_changes(struct patch *patch) patch 3620 builtin/apply.c for ( ; patch; patch = patch->next) { patch 3621 builtin/apply.c if ((patch->old_name && S_ISLNK(patch->old_mode)) && patch 3622 builtin/apply.c (patch->is_rename || patch->is_delete)) patch 3624 builtin/apply.c register_symlink_changes(patch->old_name, SYMLINK_GOES_AWAY); patch 3626 builtin/apply.c if (patch->new_name && S_ISLNK(patch->new_mode)) patch 3628 builtin/apply.c register_symlink_changes(patch->new_name, SYMLINK_IN_RESULT); patch 3681 builtin/apply.c static void die_on_unsafe_path(struct patch *patch) patch 3685 builtin/apply.c if (patch->is_delete) patch 3686 builtin/apply.c old_name = patch->old_name; patch 3687 builtin/apply.c else if (!patch->is_new && !patch->is_copy) patch 3688 builtin/apply.c old_name = patch->old_name; patch 3689 builtin/apply.c if (!patch->is_delete) patch 3690 builtin/apply.c new_name = patch->new_name; patch 3702 builtin/apply.c static int check_patch(struct patch *patch) patch 3705 builtin/apply.c const char *old_name = patch->old_name; patch 3706 builtin/apply.c const char *new_name = patch->new_name; patch 3709 builtin/apply.c struct patch *tpatch; patch 3713 builtin/apply.c patch->rejected = 1; /* we will drop this after we succeed */ patch 3715 builtin/apply.c status = check_preimage(patch, &ce, &st); patch 3718 builtin/apply.c old_name = patch->old_name; patch 3741 builtin/apply.c ((0 < patch->is_new) || patch->is_rename || patch->is_copy)) { patch 3745 builtin/apply.c patch->direct_to_threeway = 1; patch 3759 builtin/apply.c if (!patch->new_mode) { patch 3760 builtin/apply.c if (0 < patch->is_new) patch 3761 builtin/apply.c patch->new_mode = S_IFREG | 0644; patch 3763 builtin/apply.c patch->new_mode = patch->old_mode; patch 3769 builtin/apply.c if (!patch->new_mode) patch 3770 builtin/apply.c patch->new_mode = patch->old_mode; patch 3771 builtin/apply.c if ((patch->old_mode ^ patch->new_mode) & S_IFMT) { patch 3775 builtin/apply.c patch->new_mode, new_name, patch 3776 builtin/apply.c patch->old_mode); patch 3780 builtin/apply.c patch->new_mode, new_name, patch 3781 builtin/apply.c patch->old_mode, old_name); patch 3786 builtin/apply.c die_on_unsafe_path(patch); patch 3797 builtin/apply.c if (!patch->is_delete && path_is_beyond_symlink(patch->new_name)) patch 3799 builtin/apply.c patch->new_name); patch 3801 builtin/apply.c if (apply_data(patch, &st, ce) < 0) patch 3803 builtin/apply.c patch->rejected = 0; patch 3807 builtin/apply.c static int check_patch_list(struct patch *patch) patch 3811 builtin/apply.c prepare_symlink_changes(patch); patch 3812 builtin/apply.c prepare_fn_table(patch); patch 3813 builtin/apply.c while (patch) { patch 3816 builtin/apply.c _("Checking patch %s..."), patch); patch 3817 builtin/apply.c err |= check_patch(patch); patch 3818 builtin/apply.c patch = patch->next; patch 3837 builtin/apply.c static int preimage_sha1_in_gitlink_patch(struct patch *p, unsigned char sha1[20]) patch 3858 builtin/apply.c (preimage = memchr(hunk->patch, '\n', hunk->size)) != NULL && patch 3872 builtin/apply.c static void build_fake_ancestor(struct patch *list, const char *filename) patch 3874 builtin/apply.c struct patch *patch; patch 3881 builtin/apply.c for (patch = list; patch; patch = patch->next) { patch 3886 builtin/apply.c name = patch->old_name ? patch->old_name : patch->new_name; patch 3887 builtin/apply.c if (0 < patch->is_new) patch 3890 builtin/apply.c if (S_ISGITLINK(patch->old_mode)) { patch 3891 builtin/apply.c if (!preimage_sha1_in_gitlink_patch(patch, sha1)) patch 3896 builtin/apply.c } else if (!get_sha1_blob(patch->old_sha1_prefix, sha1)) { patch 3898 builtin/apply.c } else if (!patch->lines_added && !patch->lines_deleted) { patch 3900 builtin/apply.c if (get_current_sha1(patch->old_name, sha1)) patch 3907 builtin/apply.c ce = make_cache_entry(patch->old_mode, sha1, name, 0, 0); patch 3921 builtin/apply.c static void stat_patch_list(struct patch *patch) patch 3925 builtin/apply.c for (files = adds = dels = 0 ; patch ; patch = patch->next) { patch 3927 builtin/apply.c adds += patch->lines_added; patch 3928 builtin/apply.c dels += patch->lines_deleted; patch 3929 builtin/apply.c show_stats(patch); patch 3935 builtin/apply.c static void numstat_patch_list(struct patch *patch) patch 3937 builtin/apply.c for ( ; patch; patch = patch->next) { patch 3939 builtin/apply.c name = patch->new_name ? patch->new_name : patch->old_name; patch 3940 builtin/apply.c if (patch->is_binary) patch 3943 builtin/apply.c printf("%d\t%d\t", patch->lines_added, patch->lines_deleted); patch 3956 builtin/apply.c static void show_mode_change(struct patch *p, int show_name) patch 3968 builtin/apply.c static void show_rename_copy(struct patch *p) patch 4001 builtin/apply.c static void summary_patch_list(struct patch *patch) patch 4003 builtin/apply.c struct patch *p; patch 4005 builtin/apply.c for (p = patch; p; p = p->next) { patch 4026 builtin/apply.c static void patch_stats(struct patch *patch) patch 4028 builtin/apply.c int lines = patch->lines_added + patch->lines_deleted; patch 4032 builtin/apply.c if (patch->old_name) { patch 4033 builtin/apply.c int len = quote_c_style(patch->old_name, NULL, NULL, 0); patch 4035 builtin/apply.c len = strlen(patch->old_name); patch 4039 builtin/apply.c if (patch->new_name) { patch 4040 builtin/apply.c int len = quote_c_style(patch->new_name, NULL, NULL, 0); patch 4042 builtin/apply.c len = strlen(patch->new_name); patch 4048 builtin/apply.c static void remove_file(struct patch *patch, int rmdir_empty) patch 4051 builtin/apply.c if (remove_file_from_cache(patch->old_name) < 0) patch 4052 builtin/apply.c die(_("unable to remove %s from index"), patch->old_name); patch 4055 builtin/apply.c if (!remove_or_warn(patch->old_mode, patch->old_name) && rmdir_empty) { patch 4056 builtin/apply.c remove_path(patch->old_name); patch 4178 builtin/apply.c static void add_conflicted_stages_file(struct patch *patch) patch 4186 builtin/apply.c namelen = strlen(patch->new_name); patch 4188 builtin/apply.c mode = patch->new_mode ? patch->new_mode : (S_IFREG | 0644); patch 4190 builtin/apply.c remove_file_from_cache(patch->new_name); patch 4192 builtin/apply.c if (is_null_oid(&patch->threeway_stage[stage - 1])) patch 4195 builtin/apply.c memcpy(ce->name, patch->new_name, namelen); patch 4199 builtin/apply.c hashcpy(ce->sha1, patch->threeway_stage[stage - 1].hash); patch 4201 builtin/apply.c die(_("unable to add cache entry for %s"), patch->new_name); patch 4205 builtin/apply.c static void create_file(struct patch *patch) patch 4207 builtin/apply.c char *path = patch->new_name; patch 4208 builtin/apply.c unsigned mode = patch->new_mode; patch 4209 builtin/apply.c unsigned long size = patch->resultsize; patch 4210 builtin/apply.c char *buf = patch->result; patch 4216 builtin/apply.c if (patch->conflicted_threeway) patch 4217 builtin/apply.c add_conflicted_stages_file(patch); patch 4223 builtin/apply.c static void write_out_one_result(struct patch *patch, int phase) patch 4225 builtin/apply.c if (patch->is_delete > 0) { patch 4227 builtin/apply.c remove_file(patch, 1); patch 4230 builtin/apply.c if (patch->is_new > 0 || patch->is_copy) { patch 4232 builtin/apply.c create_file(patch); patch 4240 builtin/apply.c remove_file(patch, patch->is_rename); patch 4242 builtin/apply.c create_file(patch); patch 4245 builtin/apply.c static int write_out_one_reject(struct patch *patch) patch 4253 builtin/apply.c for (cnt = 0, frag = patch->fragments; frag; frag = frag->next) { patch 4262 builtin/apply.c _("Applied patch %s cleanly."), patch); patch 4269 builtin/apply.c if (!patch->new_name) patch 4277 builtin/apply.c say_patch_name(stderr, sb.buf, patch); patch 4280 builtin/apply.c cnt = strlen(patch->new_name); patch 4284 builtin/apply.c cnt - 1, patch->new_name); patch 4286 builtin/apply.c memcpy(namebuf, patch->new_name, cnt); patch 4299 builtin/apply.c patch->new_name, patch->new_name); patch 4300 builtin/apply.c for (cnt = 1, frag = patch->fragments; patch 4308 builtin/apply.c fprintf(rej, "%.*s", frag->size, frag->patch); patch 4309 builtin/apply.c if (frag->patch[frag->size-1] != '\n') patch 4316 builtin/apply.c static int write_out_results(struct patch *list) patch 4320 builtin/apply.c struct patch *l; patch 4366 builtin/apply.c struct patch *list = NULL, **listp = &list; patch 4373 builtin/apply.c struct patch *patch; patch 4376 builtin/apply.c patch = xcalloc(1, sizeof(*patch)); patch 4377 builtin/apply.c patch->inaccurate_eof = !!(options & INACCURATE_EOF); patch 4378 builtin/apply.c patch->recount = !!(options & RECOUNT); patch 4379 builtin/apply.c nr = parse_chunk(buf.buf + offset, buf.len - offset, patch); patch 4383 builtin/apply.c reverse_patches(patch); patch 4384 builtin/apply.c if (use_patch(patch)) { patch 4385 builtin/apply.c patch_stats(patch); patch 4386 builtin/apply.c *listp = patch; patch 4387 builtin/apply.c listp = &patch->next; patch 4390 builtin/apply.c free_patch(patch); patch 985 builtin/mailinfo.c static int mailinfo(FILE *in, FILE *out, const char *msg, const char *patch) patch 996 builtin/mailinfo.c patchfile = fopen(patch, "w"); patch 998 builtin/mailinfo.c perror(patch); patch 299 commit.h extern int interactive_add(int argc, const char **argv, const char *prefix, int patch);