Commit 990caca8 authored by Denis Zalevskiy's avatar Denis Zalevskiy

Merge pull request #22 from nemomobile/mer1306-fail-if-hash-object-failed

[vault] fail if blob can't be hashed. Fixes MER#1306
parents 194e92ae ac6aa93c
......@@ -32,6 +32,8 @@ namespace debug = qtaround::debug;
namespace vault {
static const int sha1HashLength = 40;
static const QMap<File, QString> fileNames = {
{File::Message, ".message"}
, {File::VersionTree, ".vault"}
......@@ -661,6 +663,10 @@ struct Unit
{
QString blobStorage = os::path::join(m_vcs->path(), ".git", "blobs");
QByteArray sha = m_vcs->hashObject(file);
if (sha.length() != sha1HashLength)
error::raise({{"msg", "Can't hash object"},
{"file", file}, {"hash", str(sha)}});
QString blobDir = os::path::join(blobStorage, sha.left(2));
QString blobFName = os::path::join(blobDir, sha.mid(2));
QString linkFName = os::path::join(m_vcs->path(), file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment