[PATCH] fetch.c: cleanups
Clean-ups suggested by Sergey Vlasov and acked by Daniel Barkalow. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 16, 2005 at 14:30 UTC
d0ac30f20ca1dd1d28a1b84bf13687f09cf535ae
1 file changed
+8
-11
fetch.c
+8
-11
@@ -62,7 +62,8 @@ static int process_tree(struct tree *tree)
62
return 0;
63
}
64
65
-struct commit_list *complete = NULL;
65
+#define COMPLETE 1U
66
+static struct commit_list *complete = NULL;
67
68
static int process_commit(struct commit *commit)
69
{
@@ -70,11 +71,11 @@ static int process_commit(struct commit *commit)
71
return -1;
72
73
while (complete && complete->item->date >= commit->date) {
73
- pop_most_recent_commit(&complete, 1);
74
+ pop_most_recent_commit(&complete, COMPLETE);
75
}
76
77
77
- if (commit->object.flags & 1)
78
+ if (commit->object.flags & COMPLETE)
79
return 0;
80
81
memcpy(current_commit_sha1, commit->object.sha1, 20);
@@ -190,14 +191,10 @@ static int interpret_target(char *target, unsigned char *sha1)
191
192
static int mark_complete(const char *path, const unsigned char *sha1)
193
{
193
- struct object *obj = parse_object(sha1);
194
- while (obj->type == tag_type) {
195
- obj = ((struct tag *) obj)->tagged;
196
- parse_object(obj->sha1);
197
- }
198
- if (obj->type == commit_type) {
199
- obj->flags |= 1;
200
- insert_by_date((struct commit *) obj, &complete);
194
+ struct commit *commit = lookup_commit_reference_gently(sha1, 1);
195
+ if (commit) {
196
+ commit->object.flags |= COMPLETE;
197
+ insert_by_date(commit, &complete);
198
}
199
return 0;
200
}