Git development
 help / color / mirror / Atom feed
* [PATCH/RFC] rev-list: simplify --object list generation.
@ 2006-01-21  8:24 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2006-01-21  8:24 UTC (permalink / raw)
  To: git; +Cc: torvalds

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 <junkio@cox.net>

---

 * 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
diff --git a/rev-list.c b/rev-list.c
index d060966..f2534fd 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -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_tree
 	struct 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 comm
 
 static 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(stru
 	struct 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(st
 			continue;
 		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_referen
 	while (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;
 		}
-- 
1.1.4.g5a4c

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-21  8:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-21  8:24 [PATCH/RFC] rev-list: simplify --object list generation Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox