Skip to content

Commit a68377b

Browse files
stefanbellergitster
authored andcommitted
sha1_file: allow sha1_file_name to handle arbitrary repositories
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e977fc7 commit a68377b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

object-store.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ void raw_object_store_clear(struct raw_object_store *o);
125125
* Put in `buf` the name of the file in the local object database that
126126
* would be used to store a loose object with the specified sha1.
127127
*/
128-
#define sha1_file_name(r, b, s) sha1_file_name_##r(b, s)
129-
void sha1_file_name_the_repository(struct strbuf *buf, const unsigned char *sha1);
128+
void sha1_file_name(struct repository *r, struct strbuf *buf, const unsigned char *sha1);
130129

131130
#define map_sha1_file(r, s, sz) map_sha1_file_##r(s, sz)
132131
void *map_sha1_file_the_repository(const unsigned char *sha1, unsigned long *size);

sha1_file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ static void fill_sha1_path(struct strbuf *buf, const unsigned char *sha1)
323323
}
324324
}
325325

326-
void sha1_file_name_the_repository(struct strbuf *buf, const unsigned char *sha1)
326+
void sha1_file_name(struct repository *r, struct strbuf *buf, const unsigned char *sha1)
327327
{
328-
strbuf_addstr(buf, get_object_directory());
328+
strbuf_addstr(buf, r->objects->objectdir);
329329
strbuf_addch(buf, '/');
330330
fill_sha1_path(buf, sha1);
331331
}

0 commit comments

Comments
 (0)