rev-list: simplify --object list generation.
We have a provision to list only blobs (or tags or trees) separately, but that was never exercised. Simplify the code by using a single variable to control either listing of all objects or nothing but the commit ancestry chain.
Signed-off-by Junio C Hamano <[email protected]>
---
* I think there isn't much controversial about this. I am sending this out only because the other one applies on top of this.
rev-list.c | 30 ++++++++++++------------------ 1 files changed, 12 insertions(+), 18 deletions(-)
8ac50f00d0799f8f235d2993c18e8d49e035d0cd
rev-list.c +12 -18
@@ -37,9 +37,7 @@ static const char rev_list_usage[] =static int dense =1 ;static int unpacked =0 ;static int bisect_list =0 ; -static int tag_objects =0 ; -static int tree_objects =0 ; -static int blob_objects =0 ; +static int list_objects =0 ;static int verbose_header =0 ;static int show_parents =0 ;static int hdr_termination =0 ;
@@ -168,7 +166,7 @@ static struct object_list **process_blob {struct object *obj = &blob->object; -if (!blob_objects) +if (!list_objects)return p;if (obj->flags & (UNINTERESTING |SEEN ))return p;
@@ -181,7 +179,7 @@ static struct object_list **process_treestruct object *obj = &tree->object;struct tree_entry_list *entry; -if (!tree_objects) +if (!list_objects)return p;if (obj->flags & (UNINTERESTING |SEEN ))return p;
@@ -253,7 +251,7 @@ static void show_commit_list(struct commstatic void mark_blob_uninteresting (struct blob *blob) { -if (!blob_objects) +if (!list_objects)return ;if (blob->object.flags &UNINTERESTING )return ;
@@ -265,7 +263,7 @@ static void mark_tree_uninteresting(strustruct object *obj = &tree->object;struct tree_entry_list *entry; -if (!tree_objects) +if (!list_objects)return ;if (obj->flags &UNINTERESTING )return ;
@@ -612,7 +610,7 @@ static struct commit_list *limit_list(stcontinue ; p = &commit_list_insert (commit, p)->next; } -if (tree_objects) +if (list_objects)mark_edges_uninteresting (newlist);if (paths && dense)compress_list (newlist);
@@ -640,7 +638,7 @@ static struct commit *get_commit_referenwhile (object->type == tag_type) {struct tag *tag = (struct tag *) object; object->flags |= flags; -if (tag_objects && !(object->flags &UNINTERESTING )) +if (list_objects && !(object->flags &UNINTERESTING ))add_pending_object (object, tag->tag); object =parse_object (tag->tagged->sha1);if (!object)
@@ -667,7 +665,7 @@ static struct commit *get_commit_referen*/ if (object->type == tree_type) {struct tree *tree = (struct tree *)object; -if (!tree_objects) +if (!list_objects)return NULL ;if (flags &UNINTERESTING ) {mark_tree_uninteresting (tree);
@@ -682,7 +680,7 @@ static struct commit *get_commit_referen*/ if (object->type == blob_type) {struct blob *blob = (struct blob *)object; -if (!blob_objects) +if (!list_objects)return NULL ;if (flags &UNINTERESTING ) {mark_blob_uninteresting (blob);
@@ -777,9 +775,7 @@ int main(int argc, const char **argv)continue ; }if (!strcmp (arg,"--objects" )) { - tag_objects =1 ; - tree_objects =1 ; - blob_objects =1 ; + list_objects =1 ;continue ; }if (!strcmp (arg,"--unpacked" )) {
@@ -850,8 +846,7 @@ int main(int argc, const char **argv)handle_one_commit (commit, &list); } -if (!list && - (!(tag_objects||tree_objects||blob_objects) && !pending_objects)) +if (!list && !list_objects && !pending_objects)usage (rev_list_usage); paths =get_pathspec (prefix, argv + i);
@@ -865,8 +860,7 @@ int main(int argc, const char **argv)if (!merge_order) {sort_by_date (&list); -if (list && !limited && max_count ==1 && - !tag_objects && !tree_objects && !blob_objects) { +if (list && !limited && max_count ==1 && !list_objects) {show_commit (list->item);return 0 ; }
Signature · 1 line
1.1.4.g5a4c