]> git.ipfire.org Git - thirdparty/git.git/blobdiff - tree-diff.c
Merge branch 'jt/v2-fetch-nego-fix'
[thirdparty/git.git] / tree-diff.c
index f1f641eb6a64abc2dbb6f0ef70f7375101874812..f3d303c6e541acd4ab715c0a5a329abdc24e7819 100644 (file)
@@ -422,8 +422,8 @@ static struct combine_diff_path *ll_diff_tree_paths(
         *   diff_tree_oid(parent, commit) )
         */
        for (i = 0; i < nparent; ++i)
-               tptree[i] = fill_tree_descriptor(&tp[i], parents_oid[i]);
-       ttree = fill_tree_descriptor(&t, oid);
+               tptree[i] = fill_tree_descriptor(opt->repo, &tp[i], parents_oid[i]);
+       ttree = fill_tree_descriptor(opt->repo, &t, oid);
 
        /* Enable recursion indefinitely */
        opt->pathspec.recursive = opt->flags.recursive;
@@ -434,6 +434,9 @@ static struct combine_diff_path *ll_diff_tree_paths(
                if (diff_can_quit_early(opt))
                        break;
 
+               if (opt->max_changes && opt->num_changes > opt->max_changes)
+                       break;
+
                if (opt->pathspec.nr) {
                        skip_uninteresting(&t, base, opt);
                        for (i = 0; i < nparent; i++)
@@ -518,6 +521,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
 
                        /* t↓ */
                        update_tree_entry(&t);
+                       opt->num_changes++;
                }
 
                /* t > p[imin] */
@@ -535,6 +539,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
                skip_emit_tp:
                        /* ∀ pi=p[imin]  pi↓ */
                        update_tp_entries(tp, nparent);
+                       opt->num_changes++;
                }
        }
 
@@ -552,6 +557,7 @@ struct combine_diff_path *diff_tree_paths(
        const struct object_id **parents_oid, int nparent,
        struct strbuf *base, struct diff_options *opt)
 {
+       opt->num_changes = 0;
        p = ll_diff_tree_paths(p, oid, parents_oid, nparent, base, opt);
 
        /*