Skip to content

Commit f257659

Browse files
mhaggergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c41a802 commit f257659

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

builtin/fetch-pack.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,11 @@ static void filter_refs(struct ref **refs, int nr_match, char **match)
581581
*refs = newlist;
582582
}
583583

584+
static void mark_alternate_complete(const struct ref *ref, void *unused)
585+
{
586+
mark_complete(NULL, ref->old_sha1, 0, NULL);
587+
}
588+
584589
static int everything_local(struct ref **refs, int nr_match, char **match)
585590
{
586591
struct ref *ref;
@@ -609,6 +614,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
609614

610615
if (!args.depth) {
611616
for_each_ref(mark_complete, NULL);
617+
for_each_alternate_ref(mark_alternate_complete, NULL);
612618
if (cutoff)
613619
mark_recent_complete_commits(cutoff);
614620
}

t/t5700-clone-reference.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ test_expect_success 'prepare branched repository' '
167167

168168
rm -f "$U.K"
169169

170-
test_expect_failure 'fetch with incomplete alternates' '
170+
test_expect_success 'fetch with incomplete alternates' '
171171
git init K &&
172172
echo "$base_dir/A/.git/objects" >K/.git/objects/info/alternates &&
173173
(

0 commit comments

Comments
 (0)