Junio C Hamano <gitster@xxxxxxxxx> writes: > Jeff King <peff@xxxxxxxx> writes: > >> I'm not quite sure what lossage you mean. On the recipient's end? They >> can just "git revert", no? This is beating on a dead horse, but in my previous life, in a project I wasn't deeply involved in, a deployment procedure used was to: - give git-archive tarball of a major release to the target machine that does not have git repository, and extract the tarball; - maintain 'maint' branch, and show the tip of 'maint' on a test server, but give the client vetoing power on individual changes; - hence ending up preparing a format-patch output for selected changes, and running git-apply on the target machine to update it. The -M/-C options would have worked well in this scenario, including the recovery from "oops--that didn't work, please revert asap" (I don't know if they actually used -M/-C when preparing the incremental updates, though). The -D option does not have the same reversibility. I am (have been) only reacting to the earlier statement by Michael that -D is the same as -M/-C and reversibility does not matter. It does in such a situation. Now that the project with that deployment procedure is totally behind me, I probably shouldn't care too much about such a workflow, but I suspect there still are people using that sort of workflow, and this would matter to them. In any case, a minimum patch to give what Mart wanted to see would probably look like this. I'll leave bugfixes, documentation and tests to the readers ;-). diff.c | 12 +++++++++--- diff.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 5422c43..5c66a53 100644 --- a/diff.c +++ b/diff.c @@ -1943,7 +1943,11 @@ static void builtin_diff(const char *name_a, } } - if (!DIFF_OPT_TST(o, TEXT) && + if (o->irreversible_delete && lbl[1][0] == '/') { + fprintf(o->file, "%s", header.buf); + strbuf_reset(&header); + goto free_ab_and_return; + } else if (!DIFF_OPT_TST(o, TEXT) && ( (!textconv_one && diff_filespec_is_binary(one)) || (!textconv_two && diff_filespec_is_binary(two)) )) { if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0) @@ -1963,8 +1967,7 @@ static void builtin_diff(const char *name_a, fprintf(o->file, "%sBinary files %s and %s differ\n", line_prefix, lbl[0], lbl[1]); o->found_changes = 1; - } - else { + } else { /* Crazy xdl interfaces.. */ const char *diffopts = getenv("GIT_DIFF_OPTS"); xpparam_t xpp; @@ -3160,6 +3163,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) return error("invalid argument to -M: %s", arg+2); options->detect_rename = DIFF_DETECT_RENAME; } + else if (!strcmp(arg, "-D") || !strcmp(arg, "--irreversible-delete")) { + options->irreversible_delete = 1; + } else if (!prefixcmp(arg, "-C") || !prefixcmp(arg, "--find-copies=") || !strcmp(arg, "--find-copies")) { if (options->detect_rename == DIFF_DETECT_COPY) diff --git a/diff.h b/diff.h index 310bd6b..11d13cf 100644 --- a/diff.h +++ b/diff.h @@ -104,6 +104,7 @@ struct diff_options { int interhunkcontext; int break_opt; int detect_rename; + int irreversible_delete; int skip_stat_unmatch; int line_termination; int output_format; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html