summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-09-26 14:20:16 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-09-26 16:54:16 +0200
commit5baab75fd2ae62b6f6407991922fe234f9e73c88 (patch)
treebc2cb07d625dc6866b0be9a1e347e51467df1703 /src/buildtool/file_system/git_repo.cpp
parent845744929e40dbdc81ed9c7df0152d58bbb28be6 (diff)
downloadjustbuild-5baab75fd2ae62b6f6407991922fe234f9e73c88.tar.gz
Fix redundant std::optional conversions
...proposed by clang-tidy. Enable bugprone-optional-value-conversion check.
Diffstat (limited to 'src/buildtool/file_system/git_repo.cpp')
-rw-r--r--src/buildtool/file_system/git_repo.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp
index 791d5996..f3769008 100644
--- a/src/buildtool/file_system/git_repo.cpp
+++ b/src/buildtool/file_system/git_repo.cpp
@@ -1686,7 +1686,7 @@ auto GitRepo::GetObjectByPathFromTree(std::string const& tree_id,
GetGitCAS()->ReadObject(entry_id, /*is_hex_id=*/true)) {
return TreeEntryInfo{.id = entry_id,
.type = entry_type,
- .symlink_content = *target};
+ .symlink_content = std::move(target)};
}
Logger::Log(
LogLevel::Trace,
@@ -1948,11 +1948,7 @@ auto GitRepo::CreateTree(tree_entries_t const& entries) const noexcept
GitLastError());
return std::nullopt;
}
- auto raw_id = ToRawString(oid);
- if (not raw_id) {
- return std::nullopt;
- }
- return std::move(*raw_id);
+ return ToRawString(oid);
} catch (std::exception const& ex) {
Logger::Log(
LogLevel::Error, "creating tree failed with:\n{}", ex.what());
@@ -2104,9 +2100,7 @@ auto GitRepo::CreateTreeFromDirectory(std::filesystem::path const& dir,
};
if (ReadDirectory(dir, dir_read_and_store, logger)) {
- if (auto raw_id = CreateTree(entries)) {
- return *raw_id;
- }
+ return CreateTree(entries);
}
return std::nullopt;
#endif // BOOTSTRAP_BUILD_TOOL