revision: mark non-user-given objects instead
[gitweb.git] / list-objects.c
index 243192af5352752472908ab9a61e80fb2b138829..7a1a0929db99bdcab29deb8539467c174e6d1c07 100644 (file)
@@ -53,7 +53,7 @@ static void process_blob(struct traversal_context *ctx,
 
        pathlen = path->len;
        strbuf_addstr(path, name);
-       if (!(obj->flags & USER_GIVEN) && ctx->filter_fn)
+       if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
                r = ctx->filter_fn(LOFS_BLOB, obj,
                                   path->buf, &path->buf[pathlen],
                                   ctx->filter_data);
@@ -120,17 +120,19 @@ static void process_tree_contents(struct traversal_context *ctx,
                                continue;
                }
 
-               if (S_ISDIR(entry.mode))
-                       process_tree(ctx,
-                                    lookup_tree(the_repository, entry.oid),
-                                    base, entry.path);
+               if (S_ISDIR(entry.mode)) {
+                       struct tree *t = lookup_tree(the_repository, entry.oid);
+                       t->object.flags |= NOT_USER_GIVEN;
+                       process_tree(ctx, t, base, entry.path);
+               }
                else if (S_ISGITLINK(entry.mode))
                        process_gitlink(ctx, entry.oid->hash,
                                        base, entry.path);
-               else
-                       process_blob(ctx,
-                                    lookup_blob(the_repository, entry.oid),
-                                    base, entry.path);
+               else {
+                       struct blob *b = lookup_blob(the_repository, entry.oid);
+                       b->object.flags |= NOT_USER_GIVEN;
+                       process_blob(ctx, b, base, entry.path);
+               }
        }
 }
 
@@ -171,7 +173,7 @@ static void process_tree(struct traversal_context *ctx,
        }
 
        strbuf_addstr(base, name);
-       if (!(obj->flags & USER_GIVEN) && ctx->filter_fn)
+       if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
                r = ctx->filter_fn(LOFS_BEGIN_TREE, obj,
                                   base->buf, &base->buf[baselen],
                                   ctx->filter_data);
@@ -185,7 +187,7 @@ static void process_tree(struct traversal_context *ctx,
        if (!failed_parse)
                process_tree_contents(ctx, tree, base);
 
-       if (!(obj->flags & USER_GIVEN) && ctx->filter_fn) {
+       if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn) {
                r = ctx->filter_fn(LOFS_END_TREE, obj,
                                   base->buf, &base->buf[baselen],
                                   ctx->filter_data);
@@ -301,8 +303,11 @@ static void do_traverse(struct traversal_context *ctx)
                 * an uninteresting boundary commit may not have its tree
                 * parsed yet, but we are not going to show them anyway
                 */
-               if (get_commit_tree(commit))
-                       add_pending_tree(ctx->revs, get_commit_tree(commit));
+               if (get_commit_tree(commit)) {
+                       struct tree *tree = get_commit_tree(commit);
+                       tree->object.flags |= NOT_USER_GIVEN;
+                       add_pending_tree(ctx->revs, tree);
+               }
                ctx->show_commit(commit, ctx->show_data);
 
                if (ctx->revs->tree_blobs_in_commit_order)