From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Cc: torvalds@osdl.org
Subject: [PATCH/RFC] rev-list: simplify --object list generation.
Date: Sat, 21 Jan 2006 00:24:34 -0800 [thread overview]
Message-ID: <7vmzhqrnst.fsf@assigned-by-dhcp.cox.net> (raw)
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
reply other threads:[~2006-01-21 8:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vmzhqrnst.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox