summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2017-08-30 00:16:06 -0700
committerJunio C Hamano <gitster@pobox.com>2017-09-07 08:49:46 +0900
commit9d994c3d64efb939bee1ca5491c8e1022d6c6cc1 (patch)
treeb5aaa2cd15330fa143f5b4163507c0b33be5b207
parentfe071ee1647f7a0ef1602a4bee230f720d05c51b (diff)
downloadgit-9d994c3d64efb939bee1ca5491c8e1022d6c6cc1.tar.gz
pack: allow open_sha1_file to handle arbitrary repositories
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--sha1_file.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 282ed7bd1b..930705f59b 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -846,22 +846,21 @@ static int stat_sha1_file(struct repository *r, const unsigned char *sha1,
* Like stat_sha1_file(), but actually open the object and return the
* descriptor. See the caveats on the "path" parameter above.
*/
-#define open_sha1_file(r, s, p) open_sha1_file_##r(s, p)
-static int open_sha1_file_the_repository(const unsigned char *sha1,
- const char **path)
+static int open_sha1_file(struct repository *r,
+ const unsigned char *sha1, const char **path)
{
int fd;
struct alternate_object_database *alt;
int most_interesting_errno;
- *path = sha1_file_name(the_repository, sha1);
+ *path = sha1_file_name(r, sha1);
fd = git_open(*path);
if (fd >= 0)
return fd;
most_interesting_errno = errno;
- prepare_alt_odb(the_repository);
- for (alt = the_repository->objects.alt_odb_list; alt; alt = alt->next) {
+ prepare_alt_odb(r);
+ for (alt = r->objects.alt_odb_list; alt; alt = alt->next) {
*path = alt_sha1_path(alt, sha1);
fd = git_open(*path);
if (fd >= 0)