{"thread":{"id":"3117","subject":"[PATCH/RFC] rev-list: simplify --object list generation.","startedAt":"2006-01-21T08:24:34Z","lastAt":"2006-01-21T08:24:34Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"14977","messageId":"7vmzhqrnst.fsf@assigned-by-dhcp.cox.net","threadId":"3117","inReplyTo":null,"subject":"[PATCH/RFC] rev-list: simplify --object list generation.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-21T08:24:34Z","receivedAt":"2006-01-21T08:24:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"We have a provision to list only blobs (or tags or trees)\nseparately, but that was never exercised.  Simplify the code by\nusing a single variable to control either listing of all objects\nor nothing but the commit ancestry chain.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n * I think there isn't much controversial about this.  I am\n   sending this out only because the other one applies on top of\n   this.\n\n rev-list.c |   30 ++++++++++++------------------\n 1 files changed, 12 insertions(+), 18 deletions(-)\n\n8ac50f00d0799f8f235d2993c18e8d49e035d0cd\ndiff --git a/rev-list.c b/rev-list.c\nindex d060966..f2534fd 100644\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -37,9 +37,7 @@ static const char rev_list_usage[] =\n static int dense = 1;\n static int unpacked = 0;\n static int bisect_list = 0;\n-static int tag_objects = 0;\n-static int tree_objects = 0;\n-static int blob_objects = 0;\n+static int list_objects = 0;\n static int verbose_header = 0;\n static int show_parents = 0;\n static int hdr_termination = 0;\n@@ -168,7 +166,7 @@ static struct object_list **process_blob\n {\n \tstruct object *obj = &blob->object;\n \n-\tif (!blob_objects)\n+\tif (!list_objects)\n \t\treturn p;\n \tif (obj->flags & (UNINTERESTING | SEEN))\n \t\treturn p;\n@@ -181,7 +179,7 @@ static struct object_list **process_tree\n \tstruct object *obj = &tree->object;\n \tstruct tree_entry_list *entry;\n \n-\tif (!tree_objects)\n+\tif (!list_objects)\n \t\treturn p;\n \tif (obj->flags & (UNINTERESTING | SEEN))\n \t\treturn p;\n@@ -253,7 +251,7 @@ static void show_commit_list(struct comm\n \n static void mark_blob_uninteresting(struct blob *blob)\n {\n-\tif (!blob_objects)\n+\tif (!list_objects)\n \t\treturn;\n \tif (blob->object.flags & UNINTERESTING)\n \t\treturn;\n@@ -265,7 +263,7 @@ static void mark_tree_uninteresting(stru\n \tstruct object *obj = &tree->object;\n \tstruct tree_entry_list *entry;\n \n-\tif (!tree_objects)\n+\tif (!list_objects)\n \t\treturn;\n \tif (obj->flags & UNINTERESTING)\n \t\treturn;\n@@ -612,7 +610,7 @@ static struct commit_list *limit_list(st\n \t\t\tcontinue;\n \t\tp = &commit_list_insert(commit, p)->next;\n \t}\n-\tif (tree_objects)\n+\tif (list_objects)\n \t\tmark_edges_uninteresting(newlist);\n \tif (paths && dense)\n \t\tcompress_list(newlist);\n@@ -640,7 +638,7 @@ static struct commit *get_commit_referen\n \twhile (object->type == tag_type) {\n \t\tstruct tag *tag = (struct tag *) object;\n \t\tobject->flags |= flags;\n-\t\tif (tag_objects && !(object->flags & UNINTERESTING))\n+\t\tif (list_objects && !(object->flags & UNINTERESTING))\n \t\t\tadd_pending_object(object, tag->tag);\n \t\tobject = parse_object(tag->tagged->sha1);\n \t\tif (!object)\n@@ -667,7 +665,7 @@ static struct commit *get_commit_referen\n \t */\n \tif (object->type == tree_type) {\n \t\tstruct tree *tree = (struct tree *)object;\n-\t\tif (!tree_objects)\n+\t\tif (!list_objects)\n \t\t\treturn NULL;\n \t\tif (flags & UNINTERESTING) {\n \t\t\tmark_tree_uninteresting(tree);\n@@ -682,7 +680,7 @@ static struct commit *get_commit_referen\n \t */\n \tif (object->type == blob_type) {\n \t\tstruct blob *blob = (struct blob *)object;\n-\t\tif (!blob_objects)\n+\t\tif (!list_objects)\n \t\t\treturn NULL;\n \t\tif (flags & UNINTERESTING) {\n \t\t\tmark_blob_uninteresting(blob);\n@@ -777,9 +775,7 @@ int main(int argc, const char **argv)\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--objects\")) {\n-\t\t\ttag_objects = 1;\n-\t\t\ttree_objects = 1;\n-\t\t\tblob_objects = 1;\n+\t\t\tlist_objects = 1;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--unpacked\")) {\n@@ -850,8 +846,7 @@ int main(int argc, const char **argv)\n \t\thandle_one_commit(commit, &list);\n \t}\n \n-\tif (!list &&\n-\t    (!(tag_objects||tree_objects||blob_objects) && !pending_objects))\n+\tif (!list && !list_objects && !pending_objects)\n \t\tusage(rev_list_usage);\n \n \tpaths = get_pathspec(prefix, argv + i);\n@@ -865,8 +860,7 @@ int main(int argc, const char **argv)\n \n \tif (!merge_order) {\t\t\n \t\tsort_by_date(&list);\n-\t\tif (list && !limited && max_count == 1 &&\n-\t\t    !tag_objects && !tree_objects && !blob_objects) {\n+\t\tif (list && !limited && max_count == 1 && !list_objects) {\n \t\t\tshow_commit(list->item);\n \t\t\treturn 0;\n \t\t}\n-- \n1.1.4.g5a4c\n"}]}