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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Feb 11, 2012 at 07:20 UTC
f2576591320f6296d341fa14bd50ba6918ced864
2 files changed
+7
-1
builtin/fetch-pack.c
+6
@@ -581,6 +581,11 @@ static void filter_refs(struct ref **refs, int nr_match, char **match)
581
*refs = newlist;
582
}
583
584
+static void mark_alternate_complete(const struct ref *ref, void *unused)
585
+{
586
+ mark_complete(NULL, ref->old_sha1, 0, NULL);
587
+}
588
+
589
static int everything_local(struct ref **refs, int nr_match, char **match)
590
{
591
struct ref *ref;
@@ -609,6 +614,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
614
615
if (!args.depth) {
616
for_each_ref(mark_complete, NULL);
617
+ for_each_alternate_ref(mark_alternate_complete, NULL);
618
if (cutoff)
619
mark_recent_complete_commits(cutoff);
620
}
t/t5700-clone-reference.sh
+1
-1
@@ -167,7 +167,7 @@ test_expect_success 'prepare branched repository' '
167
168
rm -f "$U.K"
169
170
-test_expect_failure 'fetch with incomplete alternates' '
170
+test_expect_success 'fetch with incomplete alternates' '
171
git init K &&
172
echo "$base_dir/A/.git/objects" >K/.git/objects/info/alternates &&
173
(