summaryrefslogtreecommitdiff
path: root/src/other_tools/git_operations/git_operations.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2022-12-23 17:18:42 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2022-12-23 18:29:08 +0100
commit0374b80dd407d7b35654a01e3c7526b749d3464e (patch)
treed0e62aece120c764ad557501e60398317c7dc77a /src/other_tools/git_operations/git_operations.cpp
parent1de5a178bc804209eeeb512023de1ce4d77eef42 (diff)
downloadjustbuild-0374b80dd407d7b35654a01e3c7526b749d3464e.tar.gz
Just-MR: Remove wrong pass-by-reference when wrapping loggers
Passing the logger by reference would require the caller to be kept alive. Also, being a shared_ptr, the logger can be passed by value at almost no cost.
Diffstat (limited to 'src/other_tools/git_operations/git_operations.cpp')
-rw-r--r--src/other_tools/git_operations/git_operations.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/other_tools/git_operations/git_operations.cpp b/src/other_tools/git_operations/git_operations.cpp
index 2b519691..bf6b29b3 100644
--- a/src/other_tools/git_operations/git_operations.cpp
+++ b/src/other_tools/git_operations/git_operations.cpp
@@ -34,7 +34,7 @@ auto CriticalGitOps::GitInitialCommit(GitOpParams const& crit_op_params,
}
// setup wrapped logger
auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>(
- [&logger](auto const& msg, bool fatal) {
+ [logger](auto const& msg, bool fatal) {
(*logger)(
fmt::format("While doing initial commit Git op:\n{}", msg),
fatal);
@@ -95,7 +95,7 @@ auto CriticalGitOps::GitKeepTag(GitOpParams const& crit_op_params,
}
// setup wrapped logger
auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>(
- [&logger](auto const& msg, bool fatal) {
+ [logger](auto const& msg, bool fatal) {
(*logger)(fmt::format("While doing keep tag Git op:\n{}", msg),
fatal);
});
@@ -129,7 +129,7 @@ auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params,
}
// setup wrapped logger
auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>(
- [&logger](auto const& msg, bool fatal) {
+ [logger](auto const& msg, bool fatal) {
(*logger)(fmt::format("While doing get HEAD id Git op:\n{}", msg),
fatal);
});
@@ -162,7 +162,7 @@ auto CriticalGitOps::GitGetBranchRefname(
}
// setup wrapped logger
auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>(
- [&logger](auto const& msg, bool fatal) {
+ [logger](auto const& msg, bool fatal) {
(*logger)(
fmt::format("While doing get branch refname Git op:\n{}", msg),
fatal);