]> git.ipfire.org Git - thirdparty/git.git/blobdiff - revision.c
t3905: replace test -s with test_file_not_empty
[thirdparty/git.git] / revision.c
index 1bb590ece787573a1f46026453c5921150b8a1d1..c7a0e8d3d78d630f9564bdf7e5abbd144bdabd33 100644 (file)
@@ -5,6 +5,7 @@
 #include "tree.h"
 #include "commit.h"
 #include "diff.h"
+#include "diff-merges.h"
 #include "refs.h"
 #include "revision.h"
 #include "repository.h"
@@ -1241,12 +1242,14 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
                /*
                 * Have we seen the same patch id?
                 */
-               id = has_commit_patch_id(commit, &ids);
+               id = patch_id_iter_first(commit, &ids);
                if (!id)
                        continue;
 
                commit->object.flags |= cherry_flag;
-               id->commit->object.flags |= cherry_flag;
+               do {
+                       id->commit->object.flags |= cherry_flag;
+               } while ((id = patch_id_iter_next(id, &ids)));
        }
 
        free_patch_ids(&ids);
@@ -1806,7 +1809,6 @@ void repo_init_revisions(struct repository *r,
 
        revs->repo = r;
        revs->abbrev = DEFAULT_ABBREV;
-       revs->ignore_merges = -1;
        revs->simplify_history = 1;
        revs->pruning.repo = r;
        revs->pruning.flags.recursive = 1;
@@ -2341,34 +2343,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->diff = 1;
                revs->diffopt.flags.recursive = 1;
                revs->diffopt.flags.tree_in_recursive = 1;
-       } else if (!strcmp(arg, "-m")) {
-               /*
-                * To "diff-index", "-m" means "match missing", and to the "log"
-                * family of commands, it means "show full diff for merges". Set
-                * both fields appropriately.
-                */
-               revs->ignore_merges = 0;
-               revs->match_missing = 1;
-       } else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
-               if (!strcmp(optarg, "off")) {
-                       revs->ignore_merges = 1;
-               } else {
-                       die(_("unknown value for --diff-merges: %s"), optarg);
-               }
+       } else if ((argcount = diff_merges_parse_opts(revs, argv))) {
                return argcount;
-       } else if (!strcmp(arg, "--no-diff-merges")) {
-               revs->ignore_merges = 1;
-       } else if (!strcmp(arg, "-c")) {
-               revs->diff = 1;
-               revs->dense_combined_merges = 0;
-               revs->combine_merges = 1;
-       } else if (!strcmp(arg, "--combined-all-paths")) {
-               revs->diff = 1;
-               revs->combined_all_paths = 1;
-       } else if (!strcmp(arg, "--cc")) {
-               revs->diff = 1;
-               revs->dense_combined_merges = 1;
-               revs->combine_merges = 1;
        } else if (!strcmp(arg, "-v")) {
                revs->verbose_header = 1;
        } else if (!strcmp(arg, "--pretty")) {
@@ -2865,12 +2841,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
                        copy_pathspec(&revs->diffopt.pathspec,
                                      &revs->prune_data);
        }
-       if (revs->combine_merges && revs->ignore_merges < 0)
-               revs->ignore_merges = 0;
-       if (revs->ignore_merges < 0)
-               revs->ignore_merges = 1;
-       if (revs->combined_all_paths && !revs->combine_merges)
-               die("--combined-all-paths makes no sense without -c or --cc");
+
+       diff_merges_setup_revs(revs);
 
        revs->diffopt.abbrev = revs->abbrev;