diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-02-18 04:21:41 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-18 04:21:41 +0300 |
commit | 77348b0e6e350ec81b3880f99c6077d165df2276 (patch) | |
tree | 19833dbe1ebf5b5300a0a1cc4bc9c8f136b8b617 /builtin | |
parent | 69571dfe219f48614e0e0ae7e28efae0be297764 (diff) | |
parent | 2cc543deab38c188906c41e537dc5c7de98b93d7 (diff) |
Merge branch 'js/range-diff-wo-dotdot'
There are other ways than ".." for a single token to denote a
"commit range", namely "<rev>^!" and "<rev>^-<n>", but "git
range-diff" did not understand them.
* js/range-diff-wo-dotdot:
range-diff(docs): explain how to specify commit ranges
range-diff/format-patch: handle commit ranges other than A..B
range-diff/format-patch: refactor check for commit range
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/log.c | 2 | ||||
-rw-r--r-- | builtin/range-diff.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/builtin/log.c b/builtin/log.c index d0cbaaf68a..a00da91a1f 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1672,7 +1672,7 @@ 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, ".."); + int prev_is_range = is_range_diff_range(prev); if (prev_is_range) strbuf_addstr(r1, prev); diff --git a/builtin/range-diff.c b/builtin/range-diff.c index 24c4162f74..5b1f632632 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -3,6 +3,7 @@ #include "parse-options.h" #include "range-diff.h" #include "config.h" +#include "revision.h" static const char * const builtin_range_diff_usage[] = { N_("git range-diff [<options>] <old-base>..<old-tip> <new-base>..<new-tip>"), @@ -46,12 +47,12 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix) diffopt.use_color = 1; if (argc == 2) { - if (!strstr(argv[0], "..")) - die(_("no .. in range: '%s'"), argv[0]); + if (!is_range_diff_range(argv[0])) + die(_("not a commit range: '%s'"), argv[0]); strbuf_addstr(&range1, argv[0]); - if (!strstr(argv[1], "..")) - die(_("no .. in range: '%s'"), argv[1]); + if (!is_range_diff_range(argv[1])) + die(_("not a commit range: '%s'"), argv[1]); strbuf_addstr(&range2, argv[1]); } else if (argc == 3) { strbuf_addf(&range1, "%s..%s", argv[0], argv[1]); |