Skip to content

Commit 3c1dce8

Browse files
peffgitster
authored andcommitted
clone: drop dest parameter from copy_alternates()
Ever since the inception of this function in e6baf4a (clone: clone from a repository with relative alternates, 2011-08-22), the "dest" parameter has been unused. Instead, we use add_to_alternates_file(), which relies on git_pathdup() to find the right file. That in turn works because we will have initialized and entered the destination repo by this point. It's a bit subtle, but this is how it has always worked. And if our assumptions change, the test in t5601 from e6baf4a should let us know. In the meantime, let's drop this unused and confusing parameter from copy_alternates(). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cf7a901 commit 3c1dce8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

builtin/clone.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ static void setup_reference(void)
357357
add_one_reference, &required);
358358
}
359359

360-
static void copy_alternates(struct strbuf *src, struct strbuf *dst,
361-
const char *src_repo)
360+
static void copy_alternates(struct strbuf *src, const char *src_repo)
362361
{
363362
/*
364363
* Read from the source objects/info/alternates file
@@ -439,7 +438,7 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
439438

440439
/* Files that cannot be copied bit-for-bit... */
441440
if (!strcmp(src->buf + src_baselen, "/info/alternates")) {
442-
copy_alternates(src, dest, src_repo);
441+
copy_alternates(src, src_repo);
443442
continue;
444443
}
445444

0 commit comments

Comments
 (0)