diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-13 17:03:17 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-23 14:18:52 +0100 |
commit | 020555821575f8717b3aa36aebdb9012a86b9016 (patch) | |
tree | 63ca442aa0c6e8d65601366a9769f3448d5eaa52 /src/buildtool/file_system/git_repo.cpp | |
parent | 8d9fd1818feee729e5adeab982608aff4eddd613 (diff) | |
download | justbuild-020555821575f8717b3aa36aebdb9012a86b9016.tar.gz |
GitRepo: Add proper error message for keep tag operation
Diffstat (limited to 'src/buildtool/file_system/git_repo.cpp')
-rw-r--r-- | src/buildtool/file_system/git_repo.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp index 4c88e4a7..7e7a4d18 100644 --- a/src/buildtool/file_system/git_repo.cpp +++ b/src/buildtool/file_system/git_repo.cpp @@ -598,6 +598,7 @@ auto GitRepo::KeepTag(std::string const& commit, size_t max_attempts = kGitLockNumTries; // number of tries int err = 0; git_strarray tag_names{}; + std::string err_mess{}; while (max_attempts > 0) { --max_attempts; err = git_tag_create(&oid, @@ -610,6 +611,7 @@ auto GitRepo::KeepTag(std::string const& commit, if (err == 0) { return true; // success! } + err_mess = GitLastError(); // store last error message // check if tag hasn't already been added by another process if (git_tag_list_match(&tag_names, name.c_str(), repo_.get()) == 0 and @@ -623,9 +625,11 @@ auto GitRepo::KeepTag(std::string const& commit, std::this_thread::sleep_for( std::chrono::milliseconds(kGitLockWaitTime)); } - (*logger)(fmt::format("tag creation in git repository {} failed", - GetGitCAS()->git_path_.string()), - true /*fatal*/); + (*logger)( + fmt::format("tag creation in git repository {} failed with:\n{}", + GetGitCAS()->git_path_.string(), + err_mess), + true /*fatal*/); return false; } catch (std::exception const& ex) { Logger::Log(LogLevel::Error, "keep tag failed with:\n{}", ex.what()); |