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

[PATCH] Add function to read an index file from an arbitrary filename.

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Aug 16, 2005, 04:10 UTC
Message-ID
<Pine.LNX.4.63.0508160009200.23242@iabervon.org>
In-Reply-To
<Pine.LNX.4.63.0508160004460.23242@iabervon.org>

Note that the pack file has to be in the usual location if it gets installed later.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 cache.h     |    2 ++
 sha1_file.c |   10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
59e5c6d163edae5da6136560d48a4750cceacdc6
diff --git a/cache.h b/cache.h
--- a/cache.h
+++ b/cache.h
@@ -319,6 +319,8 @@ extern int get_ack(int fd, unsigned char
 extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match);
 
 extern struct packed_git *parse_pack_index(unsigned char *sha1);
+extern struct packed_git *parse_pack_index_file(unsigned char *sha1, 
+						char *idx_path);
 
 extern void prepare_packed_git(void);
 extern void install_packed_git(struct packed_git *pack);
diff --git a/sha1_file.c b/sha1_file.c
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -476,12 +476,18 @@ struct packed_git *add_packed_git(char *
 
 struct packed_git *parse_pack_index(unsigned char *sha1)
 {
+	char *path = sha1_pack_index_name(sha1);
+	return parse_pack_index_file(sha1, path);
+}
+
+struct packed_git *parse_pack_index_file(unsigned char *sha1, char *idx_path)
+{
 	struct packed_git *p;
 	unsigned long idx_size;
 	void *idx_map;
-	char *path = sha1_pack_index_name(sha1);
+	char *path;
 
-	if (check_packed_git_idx(path, &idx_size, &idx_map))
+	if (check_packed_git_idx(idx_path, &idx_size, &idx_map))
 		return NULL;
 
 	path = sha1_pack_name(sha1);
Previous: Daniel BarkalowNext: Daniel Barkalow
Message 2 of 3 in “Fix local-pull on packed repository”
  1. 0/2 Fix local-pull on packed repositoryDaniel Barkalow, Aug 16, 2005
  2. Add function to read an index file from an arbitrary filename.Daniel Barkalow, Aug 16, 2005
  3. Support packs in local-pullDaniel Barkalow, Aug 16, 2005

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.