summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_cas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/file_system/git_cas.cpp')
-rw-r--r--src/buildtool/file_system/git_cas.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/buildtool/file_system/git_cas.cpp b/src/buildtool/file_system/git_cas.cpp
index 7bddf6b3..ada77f3f 100644
--- a/src/buildtool/file_system/git_cas.cpp
+++ b/src/buildtool/file_system/git_cas.cpp
@@ -156,9 +156,14 @@ auto GitCAS::OpenODB(std::filesystem::path const& repo_path) noexcept -> bool {
git_odb* odb_ptr{nullptr};
git_repository_odb(&odb_ptr, repo);
odb_.reset(odb_ptr); // retain odb pointer
- // set root
- std::filesystem::path git_path =
- ToNormalPath(git_repository_path(repo));
+ // set root
+ std::filesystem::path git_path{};
+ if (git_repository_is_bare(repo) != 0) {
+ git_path = ToNormalPath((git_repository_path(repo)));
+ }
+ else {
+ git_path = ToNormalPath(git_repository_workdir(repo));
+ }
if (not git_path.is_absolute()) {
try {
git_path = std::filesystem::absolute(git_path);