summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-03-23 17:21:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-26 17:05:55 (GMT)
commit2ba0bfd67f3a5b6b5e26436d899e7fd02b578bb6 (patch)
treea8c2f0d8c416f9904a87c386f243d5176b26f91b /sha1_file.c
parentfbe33e2798fdbd7feac2d19c68e1a9c447e337c0 (diff)
downloadgit-2ba0bfd67f3a5b6b5e26436d899e7fd02b578bb6.zip
git-2ba0bfd67f3a5b6b5e26436d899e7fd02b578bb6.tar.gz
git-2ba0bfd67f3a5b6b5e26436d899e7fd02b578bb6.tar.bz2
sha1_file: add repository argument to open_sha1_file
Add a repository argument to allow the open_sha1_file caller to be more specific about which repository to act on. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. 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>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 80bac89..a2ab2b8 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -896,7 +896,9 @@ static int stat_sha1_file_the_repository(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.
*/
-static int open_sha1_file(const unsigned char *sha1, const char **path)
+#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)
{
int fd;
struct alternate_object_database *alt;
@@ -939,7 +941,7 @@ static void *map_sha1_file_1(const char *path,
if (path)
fd = git_open(path);
else
- fd = open_sha1_file(sha1, &path);
+ fd = open_sha1_file(the_repository, sha1, &path);
map = NULL;
if (fd >= 0) {
struct stat st;