X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=diff.c;h=bf65892f78f84a31b6bf87b0f82cfc5938485862;hb=443938df7ba6ca8c5ad50b7b061ece8116496985;hp=2327cea5b2c9ebe8d545b5a648910077ee67cd64;hpb=6cd52edbbd9acc7797cffeba1b849538285ed558;p=git.git diff --git a/diff.c b/diff.c index 2327cea5b..bf65892f7 100644 --- a/diff.c +++ b/diff.c @@ -44,10 +44,6 @@ static char diff_colors[][COLOR_MAXLEN] = { GIT_COLOR_NORMAL, /* FUNCINFO */ }; -static void diff_filespec_load_driver(struct diff_filespec *one); -static size_t fill_textconv(struct userdiff_driver *driver, - struct diff_filespec *df, char **outbuf); - static int parse_diff_color_slot(const char *var, int ofs) { if (!strcasecmp(var+ofs, "plain")) @@ -1810,7 +1806,7 @@ void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const options->b_prefix = b; } -static struct userdiff_driver *get_textconv(struct diff_filespec *one) +struct userdiff_driver *get_textconv(struct diff_filespec *one) { if (!DIFF_FILE_VALID(one)) return NULL; @@ -2620,7 +2616,6 @@ static void fill_metainfo(struct strbuf *msg, } /* fallthru */ default: - /* nothing */ *must_show_header = 0; } if (one && two && hashcmp(one->sha1, two->sha1)) { @@ -2632,8 +2627,7 @@ static void fill_metainfo(struct strbuf *msg, (!fill_mmfile(&mf, two) && diff_filespec_is_binary(two))) abbrev = 40; } - strbuf_addf(msg, "%s%sindex %s..", set, - line_prefix, + strbuf_addf(msg, "%s%sindex %s..", line_prefix, set, find_unique_abbrev(one->sha1, abbrev)); strbuf_addstr(msg, find_unique_abbrev(two->sha1, abbrev)); if (one->mode == two->mode) @@ -2710,10 +2704,16 @@ static void diff_fill_sha1_info(struct diff_filespec *one) static void strip_prefix(int prefix_length, const char **namep, const char **otherp) { /* Strip the prefix but do not molest /dev/null and absolute paths */ - if (*namep && **namep != '/') + if (*namep && **namep != '/') { *namep += prefix_length; - if (*otherp && **otherp != '/') + if (**namep == '/') + ++*namep; + } + if (*otherp && **otherp != '/') { *otherp += prefix_length; + if (**otherp == '/') + ++*otherp; + } } static void run_diff(struct diff_filepair *p, struct diff_options *o) @@ -2820,7 +2820,6 @@ static void run_checkdiff(struct diff_filepair *p, struct diff_options *o) void diff_setup(struct diff_options *options) { memset(options, 0, sizeof(*options)); - memset(&diff_queued_diff, 0, sizeof(diff_queued_diff)); options->file = stdout; @@ -3173,7 +3172,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) else if (!strcmp(arg, "--no-textconv")) DIFF_OPT_CLR(options, ALLOW_TEXTCONV); else if (!strcmp(arg, "--ignore-submodules")) - DIFF_OPT_SET(options, IGNORE_SUBMODULES); + handle_ignore_submodules_arg(options, "all"); + else if (!prefixcmp(arg, "--ignore-submodules=")) + handle_ignore_submodules_arg(options, arg + 20); else if (!strcmp(arg, "--submodule")) DIFF_OPT_SET(options, SUBMODULE_LOG); else if (!prefixcmp(arg, "--submodule=")) { @@ -4244,9 +4245,9 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec, return strbuf_detach(&buf, outsize); } -static size_t fill_textconv(struct userdiff_driver *driver, - struct diff_filespec *df, - char **outbuf) +size_t fill_textconv(struct userdiff_driver *driver, + struct diff_filespec *df, + char **outbuf) { size_t size;