Merge branch 'jc/clean-after-sanity-tests'
[gitweb.git] / revision.c
index 40fd91ff2b16bffc725f8602f45117279e27ba19..0afae4744a12b9b1bfd484c12440db82e19c8c9f 100644 (file)
@@ -29,6 +29,8 @@ volatile show_early_output_fn_t show_early_output;
 static const char *term_bad;
 static const char *term_good;
 
+implement_shared_commit_slab(revision_sources, char *);
+
 void show_object_with_name(FILE *out, struct object *obj, const char *name)
 {
        const char *p;
@@ -265,14 +267,19 @@ static struct commit *handle_commit(struct rev_info *revs,
         */
        if (object->type == OBJ_COMMIT) {
                struct commit *commit = (struct commit *)object;
+
                if (parse_commit(commit) < 0)
                        die("unable to parse commit %s", name);
                if (flags & UNINTERESTING) {
                        mark_parents_uninteresting(commit);
                        revs->limited = 1;
                }
-               if (revs->show_source && !commit->util)
-                       commit->util = xstrdup(name);
+               if (revs->sources) {
+                       char **slot = revision_sources_at(revs->sources, commit);
+
+                       if (!*slot)
+                               *slot = xstrdup(name);
+               }
                return commit;
        }
 
@@ -824,8 +831,12 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit,
                        }
                        return -1;
                }
-               if (revs->show_source && !p->util)
-                       p->util = commit->util;
+               if (revs->sources) {
+                       char **slot = revision_sources_at(revs->sources, p);
+
+                       if (!*slot)
+                               *slot = *revision_sources_at(revs->sources, commit);
+               }
                p->object.flags |= left_flag;
                if (!(p->object.flags & SEEN)) {
                        p->object.flags |= SEEN;