sha1_file: allow map_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> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 23, 2018 at 18:21 UTC
bd27f50c801410433542a31122985b7d808b0a7f
2 files changed
+4
-4
object-store.h
+1
-2
@@ -127,7 +127,6 @@ void raw_object_store_clear(struct raw_object_store *o);
127
*/
128
void sha1_file_name(struct repository *r, struct strbuf *buf, const unsigned char *sha1);
129
130
-#define map_sha1_file(r, s, sz) map_sha1_file_##r(s, sz)
131
-void *map_sha1_file_the_repository(const unsigned char *sha1, unsigned long *size);
130
+void *map_sha1_file(struct repository *r, const unsigned char *sha1, unsigned long *size);
131
132
#endif /* OBJECT_STORE_H */
sha1_file.c
+3
-2
@@ -957,9 +957,10 @@ static void *map_sha1_file_1(struct repository *r, const char *path,
957
return map;
958
}
959
960
-void *map_sha1_file_the_repository(const unsigned char *sha1, unsigned long *size)
960
+void *map_sha1_file(struct repository *r,
961
+ const unsigned char *sha1, unsigned long *size)
962
{
962
- return map_sha1_file_1(the_repository, NULL, sha1, size);
963
+ return map_sha1_file_1(r, NULL, sha1, size);
964
}
965
966
static int unpack_sha1_short_header(git_zstream *stream,