From 65385ef7d457d740eddae2c4179064b8e13ac777 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sat, 11 Feb 2012 07:20:57 +0100 Subject: fetch-pack.c: rename some parameters from "path" to "refname" The parameters denote reference names, which are no longer 1:1 with filesystem paths. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- builtin/fetch-pack.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'builtin/fetch-pack.c') diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 6207ecd298..9bd2096229 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -58,9 +58,9 @@ static void rev_list_push(struct commit *commit, int mark) } } -static int rev_list_insert_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data) +static int rev_list_insert_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data) { - struct object *o = deref_tag(parse_object(sha1), path, 0); + struct object *o = deref_tag(parse_object(sha1), refname, 0); if (o && o->type == OBJ_COMMIT) rev_list_push((struct commit *)o, SEEN); @@ -68,9 +68,9 @@ static int rev_list_insert_ref(const char *path, const unsigned char *sha1, int return 0; } -static int clear_marks(const char *path, const unsigned char *sha1, int flag, void *cb_data) +static int clear_marks(const char *refname, const unsigned char *sha1, int flag, void *cb_data) { - struct object *o = deref_tag(parse_object(sha1), path, 0); + struct object *o = deref_tag(parse_object(sha1), refname, 0); if (o && o->type == OBJ_COMMIT) clear_commit_marks((struct commit *)o, @@ -493,7 +493,7 @@ done: static struct commit_list *complete; -static int mark_complete(const char *path, const unsigned char *sha1, int flag, void *cb_data) +static int mark_complete(const char *refname, const unsigned char *sha1, int flag, void *cb_data) { struct object *o = parse_object(sha1); -- cgit v1.2.3 From c41a802fe9593db67f458bde9f15f51fdf3f4f1a Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sat, 11 Feb 2012 07:20:58 +0100 Subject: fetch-pack.c: inline insert_alternate_refs() The logic of the (single) caller is clearer without encapsulating this one line in a function. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- builtin/fetch-pack.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'builtin/fetch-pack.c') diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 9bd2096229..dbe9acbc39 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -256,11 +256,6 @@ static void insert_one_alternate_ref(const struct ref *ref, void *unused) rev_list_insert_ref(NULL, ref->old_sha1, 0, NULL); } -static void insert_alternate_refs(void) -{ - for_each_alternate_ref(insert_one_alternate_ref, NULL); -} - #define INITIAL_FLUSH 16 #define PIPESAFE_FLUSH 32 #define LARGE_FLUSH 1024 @@ -295,7 +290,7 @@ static int find_common(int fd[2], unsigned char *result_sha1, marked = 1; for_each_ref(rev_list_insert_ref, NULL); - insert_alternate_refs(); + for_each_alternate_ref(insert_one_alternate_ref, NULL); fetching = 0; for ( ; refs ; refs = refs->next) { -- cgit v1.2.3 From f2576591320f6296d341fa14bd50ba6918ced864 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sat, 11 Feb 2012 07:20:59 +0100 Subject: everything_local(): mark alternate refs as complete Objects in an alternate object database are already available to the local repository and therefore don't need to be fetched. So mark them as complete in everything_local(). This fixes a test in t5700. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- builtin/fetch-pack.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'builtin/fetch-pack.c') diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index dbe9acbc39..0e8560f60f 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -581,6 +581,11 @@ static void filter_refs(struct ref **refs, int nr_match, char **match) *refs = newlist; } +static void mark_alternate_complete(const struct ref *ref, void *unused) +{ + mark_complete(NULL, ref->old_sha1, 0, NULL); +} + static int everything_local(struct ref **refs, int nr_match, char **match) { struct ref *ref; @@ -609,6 +614,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match) if (!args.depth) { for_each_ref(mark_complete, NULL); + for_each_alternate_ref(mark_alternate_complete, NULL); if (cutoff) mark_recent_complete_commits(cutoff); } -- cgit v1.2.3