diff mbox series

[04/14] clone: drop dest parameter from copy_alternates()

Message ID 20190509212922.GD15837@sigill.intra.peff.net (mailing list archive)
State New, archived
Headers show
Series [01/14] cmd_{read,write}_tree: rename "unused" variable that is used | expand

Commit Message

Jeff King May 9, 2019, 9:29 p.m. UTC
Ever since the inception of this function in e6baf4a1ae (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 e6baf4a1ae should let us
know.

In the meantime, let's drop this unused and confusing parameter from
copy_alternates().

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/clone.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/builtin/clone.c b/builtin/clone.c
index 31a47d190a..9ddf4f99e5 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -357,8 +357,7 @@  static void setup_reference(void)
 			     add_one_reference, &required);
 }
 
-static void copy_alternates(struct strbuf *src, struct strbuf *dst,
-			    const char *src_repo)
+static void copy_alternates(struct strbuf *src, const char *src_repo)
 {
 	/*
 	 * Read from the source objects/info/alternates file
@@ -439,7 +438,7 @@  static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
 
 		/* Files that cannot be copied bit-for-bit... */
 		if (!strcmp(src->buf + src_baselen, "/info/alternates")) {
-			copy_alternates(src, dest, src_repo);
+			copy_alternates(src, src_repo);
 			continue;
 		}