]> git.ipfire.org Git - thirdparty/git.git/blobdiff - revision.c
Documentation: mention more worktree-specific exceptions
[thirdparty/git.git] / revision.c
index d4aaf0ef257943029923f741b4ae383bb00d7f5f..07412297f0248aae886eeb77c3a1cab13c93039c 100644 (file)
@@ -436,7 +436,9 @@ static struct commit *handle_commit(struct rev_info *revs,
                        die("unable to parse commit %s", name);
                if (flags & UNINTERESTING) {
                        mark_parents_uninteresting(commit);
-                       revs->limited = 1;
+
+                       if (!revs->topo_order || !generation_numbers_enabled(the_repository))
+                               revs->limited = 1;
                }
                if (revs->sources) {
                        char **slot = revision_sources_at(revs->sources, commit);
@@ -1552,6 +1554,32 @@ void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags)
        free_worktrees(worktrees);
 }
 
+struct add_alternate_refs_data {
+       struct rev_info *revs;
+       unsigned int flags;
+};
+
+static void add_one_alternate_ref(const struct object_id *oid,
+                                 void *vdata)
+{
+       const char *name = ".alternate";
+       struct add_alternate_refs_data *data = vdata;
+       struct object *obj;
+
+       obj = get_reference(data->revs, name, oid, data->flags);
+       add_rev_cmdline(data->revs, obj, name, REV_CMD_REV, data->flags);
+       add_pending_object(data->revs, obj, name);
+}
+
+static void add_alternate_refs_to_pending(struct rev_info *revs,
+                                         unsigned int flags)
+{
+       struct add_alternate_refs_data data;
+       data.revs = revs;
+       data.flags = flags;
+       for_each_alternate_ref(add_one_alternate_ref, &data);
+}
+
 static int add_parents_only(struct rev_info *revs, const char *arg_, int flags,
                            int exclude_parent)
 {
@@ -1954,6 +1982,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
            !strcmp(arg, "--no-walk") || !strcmp(arg, "--do-walk") ||
            !strcmp(arg, "--bisect") || starts_with(arg, "--glob=") ||
            !strcmp(arg, "--indexed-objects") ||
+           !strcmp(arg, "--alternate-refs") ||
            starts_with(arg, "--exclude=") ||
            starts_with(arg, "--branches=") || starts_with(arg, "--tags=") ||
            starts_with(arg, "--remotes=") || starts_with(arg, "--no-walk="))
@@ -2440,6 +2469,8 @@ static int handle_revision_pseudo_opt(const char *submodule,
                add_reflogs_to_pending(revs, *flags);
        } else if (!strcmp(arg, "--indexed-objects")) {
                add_index_objects_to_pending(revs, *flags);
+       } else if (!strcmp(arg, "--alternate-refs")) {
+               add_alternate_refs_to_pending(revs, *flags);
        } else if (!strcmp(arg, "--not")) {
                *flags ^= UNINTERESTING | BOTTOM;
        } else if (!strcmp(arg, "--no-walk")) {
@@ -3263,6 +3294,9 @@ static void expand_topo_walk(struct rev_info *revs, struct commit *commit)
                struct commit *parent = p->item;
                int *pi;
 
+               if (parent->object.flags & UNINTERESTING)
+                       continue;
+
                if (parse_commit_gently(parent, 1) < 0)
                        continue;