]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/log.c
Merge branch 'js/range-diff-wo-dotdot'
[thirdparty/git.git] / builtin / log.c
index bd6ff4f9f9565adb7a6fca5d93ce23d5c5636ccc..a00da91a1f0c37ed26b658324d23be3d828a89ef 100644 (file)
@@ -12,6 +12,7 @@
 #include "color.h"
 #include "commit.h"
 #include "diff.h"
+#include "diff-merges.h"
 #include "revision.h"
 #include "log-tree.h"
 #include "builtin.h"
@@ -177,7 +178,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
        const struct option builtin_log_options[] = {
                OPT__QUIET(&quiet, N_("suppress diff output")),
                OPT_BOOL(0, "source", &source, N_("show source")),
-               OPT_BOOL(0, "use-mailmap", &mailmap, N_("Use mail map file")),
+               OPT_BOOL(0, "use-mailmap", &mailmap, N_("use mail map file")),
                OPT_ALIAS(0, "mailmap", "use-mailmap"),
                OPT_STRING_LIST(0, "decorate-refs", &decorate_refs_include,
                                N_("pattern"), N_("only decorate refs that match <pattern>")),
@@ -186,7 +187,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
                OPT_CALLBACK_F(0, "decorate", NULL, NULL, N_("decorate options"),
                               PARSE_OPT_OPTARG, decorate_callback),
                OPT_CALLBACK('L', NULL, &line_cb, "range:file",
-                            N_("Trace the evolution of line range <start>,<end> or function :<funcname> in <file>"),
+                            N_("trace the evolution of line range <start>,<end> or function :<funcname> in <file>"),
                             log_line_range_callback),
                OPT_END()
        };
@@ -230,7 +231,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
 
        if (mailmap) {
                rev->mailmap = xcalloc(1, sizeof(struct string_list));
-               read_mailmap(rev->mailmap, NULL);
+               read_mailmap(rev->mailmap);
        }
 
        if (rev->pretty_given && rev->commit_format == CMIT_FMT_RAW) {
@@ -607,15 +608,10 @@ static int show_tree_object(const struct object_id *oid,
 static void show_setup_revisions_tweak(struct rev_info *rev,
                                       struct setup_revision_opt *opt)
 {
-       if (rev->ignore_merges < 0) {
-               /* There was no "-m" variant on the command line */
-               rev->ignore_merges = 0;
-               if (!rev->first_parent_only && !rev->combine_merges) {
-                       /* No "--first-parent", "-c", or "--cc" */
-                       rev->combine_merges = 1;
-                       rev->dense_combined_merges = 1;
-               }
-       }
+       if (rev->first_parent_only)
+               diff_merges_default_to_first_parent(rev);
+       else
+               diff_merges_default_to_dense_combined(rev);
        if (!rev->diffopt.output_format)
                rev->diffopt.output_format = DIFF_FORMAT_PATCH;
 }
@@ -736,12 +732,8 @@ static void log_setup_revisions_tweak(struct rev_info *rev,
            rev->prune_data.nr == 1)
                rev->diffopt.flags.follow_renames = 1;
 
-       /* Turn --cc/-c into -p --cc/-c when -p was not given */
-       if (!rev->diffopt.output_format && rev->combine_merges)
-               rev->diffopt.output_format = DIFF_FORMAT_PATCH;
-
-       if (rev->first_parent_only && rev->ignore_merges < 0)
-               rev->ignore_merges = 0;
+       if (rev->first_parent_only)
+               diff_merges_default_to_first_parent(rev);
 }
 
 int cmd_log(int argc, const char **argv, const char *prefix)
@@ -1680,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);
@@ -1757,13 +1749,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                OPT_INTEGER(0, "filename-max-length", &fmt_patch_name_max,
                            N_("max length of output filename")),
                OPT_CALLBACK_F(0, "rfc", &rev, NULL,
-                           N_("Use [RFC PATCH] instead of [PATCH]"),
+                           N_("use [RFC PATCH] instead of [PATCH]"),
                            PARSE_OPT_NOARG | PARSE_OPT_NONEG, rfc_callback),
                OPT_STRING(0, "cover-from-description", &cover_from_description_arg,
                            N_("cover-from-description-mode"),
                            N_("generate parts of a cover letter based on a branch's description")),
                OPT_CALLBACK_F(0, "subject-prefix", &rev, N_("prefix"),
-                           N_("Use [<prefix>] instead of [PATCH]"),
+                           N_("use [<prefix>] instead of [PATCH]"),
                            PARSE_OPT_NONEG, subject_prefix_callback),
                OPT_CALLBACK_F('o', "output-directory", &output_directory,
                            N_("dir"), N_("store resulting files in <dir>"),