(!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)
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)
void diff_setup(struct diff_options *options)
{
memset(options, 0, sizeof(*options));
- memset(&diff_queued_diff, 0, sizeof(diff_queued_diff));
options->file = stdout;
else if (!strcmp(arg, "--no-textconv"))
DIFF_OPT_CLR(options, ALLOW_TEXTCONV);
else if (!strcmp(arg, "--ignore-submodules"))
- DIFF_OPT_SET(options, IGNORE_SUBMODULES);
- else if (!prefixcmp(arg, "--ignore-submodules=")) {
- if (!strcmp(arg + 20, "all"))
- DIFF_OPT_SET(options, IGNORE_SUBMODULES);
- else if (!strcmp(arg + 20, "untracked"))
- DIFF_OPT_SET(options, IGNORE_UNTRACKED_IN_SUBMODULES);
- else if (!strcmp(arg + 20, "dirty"))
- DIFF_OPT_SET(options, IGNORE_DIRTY_SUBMODULES);
- else
- die("bad --ignore-submodules argument: %s", arg + 20);
- } else if (!strcmp(arg, "--submodule"))
+ 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=")) {
if (!strcmp(arg + 12, "log"))