Commit 2ac21edc8f6b643a9ada582d4abf41adf66d0e7e
Print a detailed error on failure to open a repo
"Could not open repository" wasn't very helpful.
Author: xaizek
Author date (UTC): 2024-01-20 14:22
Committer name: xaizek
Committer date (UTC): 2024-01-20 14:22
Parent(s): 8741bb36efd731033b62e3a8d8c55d915b2208bc
Signing key: 99DC5E4DB05F6BE2
Tree: a098436be4686f3c33101d496f1dacfc44fc9a07
File src/Repository.cpp changed (mode: 100644) (index f497821..d609a0a) |
... |
... |
Repository::Repository(const std::string &path) |
153 |
153 |
BOOST_SCOPE_EXIT_ALL(&repoPath) { git_buf_free(&repoPath); }; |
BOOST_SCOPE_EXIT_ALL(&repoPath) { git_buf_free(&repoPath); }; |
154 |
154 |
|
|
155 |
155 |
if (git_repository_open(&repo, repoPath.ptr) != 0) { |
if (git_repository_open(&repo, repoPath.ptr) != 0) { |
156 |
|
throw std::invalid_argument("Could not open repository"); |
|
|
156 |
|
const git_error *error = git_error_last(); |
|
157 |
|
throw std::invalid_argument("Could not open repository at '" + |
|
158 |
|
std::string(repoPath.ptr) + |
|
159 |
|
"': " + error->message); |
157 |
160 |
} |
} |
158 |
161 |
} |
} |
159 |
162 |
|
|