diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-09-22 22:36:28 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-22 22:36:28 +0300 |
commit | 634e0084fac75cf85449a813da14968c9663a094 (patch) | |
tree | 4954184348dd7032043726df7a2e622e97b52d46 /builtin | |
parent | bcb68bff80eab46f9d5f367555da803e61d3d7c8 (diff) | |
parent | 07a7f8debfa43bd28537f475925776a92c30a678 (diff) |
Merge branch 'es/format-patch-interdiff-cleanup'
"format-patch --range-diff=<prev> <origin>..HEAD" has been taught
not to ignore <origin> when <prev> is a single version.
* es/format-patch-interdiff-cleanup:
format-patch: use 'origin' as start of current-series-range when known
diff-lib: tighten show_interdiff()'s interface
diff: move show_interdiff() from its own file to diff-lib
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/log.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/builtin/log.c b/builtin/log.c index 4ec7f57cf4a..b8824d898f4 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -33,7 +33,6 @@ #include "commit-slab.h" #include "repository.h" #include "commit-reach.h" -#include "interdiff.h" #include "range-diff.h" #define MAIL_DEFAULT_WRAP 72 @@ -1207,7 +1206,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, if (rev->idiff_oid1) { fprintf_ln(rev->diffopt.file, "%s", rev->idiff_title); - show_interdiff(rev, 0); + show_interdiff(rev->idiff_oid1, rev->idiff_oid2, 0, + &rev->diffopt); } if (rev->rdiff1) { @@ -1595,16 +1595,20 @@ static void infer_range_diff_ranges(struct strbuf *r1, struct commit *head) { const char *head_oid = oid_to_hex(&head->object.oid); + int prev_is_range = !!strstr(prev, ".."); - if (!strstr(prev, "..")) { + if (prev_is_range) + strbuf_addstr(r1, prev); + else strbuf_addf(r1, "%s..%s", head_oid, prev); + + if (origin) + strbuf_addf(r2, "%s..%s", oid_to_hex(&origin->object.oid), head_oid); + else if (prev_is_range) + die(_("failed to infer range-diff origin of current series")); + else { + warning(_("using '%s' as range-diff origin of current series"), prev); strbuf_addf(r2, "%s..%s", prev, head_oid); - } else if (!origin) { - die(_("failed to infer range-diff ranges")); - } else { - strbuf_addstr(r1, prev); - strbuf_addf(r2, "%s..%s", - oid_to_hex(&origin->object.oid), head_oid); } } |