git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] clone: Skip pack-*.keep files when cloning locally

From
Jens Lindstrom <jl@opera.com>
Date
Jun 28, 2013, 14:42 UTC
Message-ID
<1372430538-19216-1-git-send-email-jl@opera.com>

The pack-*.keep files are temporary, and serve no purpose in the clone. They would probably also never be deleted from the clone if copied, since the process that created them only expects to have to delete them from the original repository.

Worse, though, they are created with access bits 0600, so if the user trying to clone the repository is different from the user that caused the pack-*.keep file to be created, the clone will likely fail due to not being allowed to read (and thus copy) the file in the first place.

Signed-off-by: Jens Lindstrom <jl@opera.com>
---
 builtin/clone.c |    5 +++++
 1 file changed, 5 insertions(+)
diff --git a/builtin/clone.c b/builtin/clone.c
index 035ab64..0ec0ec9 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -342,6 +342,11 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
 			continue;
 		}
 
+		/* Skip pack-*.keep files, they are temporary and not
+		   relevant to the clone, and might not be accessible. */
+		if (!strcmp(src->buf + strlen(src->buf) - 5, ".keep"))
+			continue;
+
 		/* Files that cannot be copied bit-for-bit... */
 		if (!strcmp(src->buf + src_baselen, "/info/alternates")) {
 			copy_alternates(src, dest, src_repo);
-- 
1.7.10.4
Next: Junio C Hamano
Message 1 of 8 in “clone: Skip pack-*.keep files when cloning locally”
  1. clone: Skip pack-*.keep files when cloning locallyJens Lindstrom, Jun 28, 2013
  2. Junio C HamanoJun 28, 2013
  3. Junio C HamanoJun 28, 2013
  4. Jens LindströmJul 1, 2013
  5. Junio C HamanoJul 1, 2013
  6. Jens LindströmJul 3, 2013
  7. Junio C HamanoJul 3, 2013
  8. Jens LindströmJul 3, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.