sha1_file: allow sha1_file_name to handle arbitrary repositories
authorStefan Beller <sbeller@google.com>
Fri, 23 Mar 2018 17:21:16 +0000 (18:21 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Mar 2018 17:05:55 +0000 (10:05 -0700)
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>
object-store.h
sha1_file.c
index 03671745f46c0713a8641d1bba955d60b5ec685b..d9cc875153c6917ee90cd6654c91e1ce4bfe4c32 100644 (file)
@@ -125,8 +125,7 @@ void raw_object_store_clear(struct raw_object_store *o);
  * Put in `buf` the name of the file in the local object database that
  * would be used to store a loose object with the specified sha1.
  */
  * Put in `buf` the name of the file in the local object database that
  * would be used to store a loose object with the specified sha1.
  */
-#define sha1_file_name(r, b, s) sha1_file_name_##r(b, s)
-void sha1_file_name_the_repository(struct strbuf *buf, const unsigned char *sha1);
+void sha1_file_name(struct repository *r, struct strbuf *buf, const unsigned char *sha1);
 
 #define map_sha1_file(r, s, sz) map_sha1_file_##r(s, sz)
 void *map_sha1_file_the_repository(const unsigned char *sha1, unsigned long *size);
 
 #define map_sha1_file(r, s, sz) map_sha1_file_##r(s, sz)
 void *map_sha1_file_the_repository(const unsigned char *sha1, unsigned long *size);
index 74c68ea776fb4a872d49e646c8b915ccb8890d85..aed9a558c5824b540423c3f39c384cf7fe7e4e7e 100644 (file)
@@ -323,9 +323,9 @@ static void fill_sha1_path(struct strbuf *buf, const unsigned char *sha1)
        }
 }
 
        }
 }
 
-void sha1_file_name_the_repository(struct strbuf *buf, const unsigned char *sha1)
+void sha1_file_name(struct repository *r, struct strbuf *buf, const unsigned char *sha1)
 {
 {
-       strbuf_addstr(buf, get_object_directory());
+       strbuf_addstr(buf, r->objects->objectdir);
        strbuf_addch(buf, '/');
        fill_sha1_path(buf, sha1);
 }
        strbuf_addch(buf, '/');
        fill_sha1_path(buf, sha1);
 }