Commit 2e09106e by Carlos Martín Nieto

refdb: bubble up the error code when compressing the db

This allows the caller to know the errors was e.g. due to the
packed-refs file being already locked and they can try again later.
parent dd1ca6f1
...@@ -1383,14 +1383,15 @@ static int refdb_fs_backend__rename( ...@@ -1383,14 +1383,15 @@ static int refdb_fs_backend__rename(
static int refdb_fs_backend__compress(git_refdb_backend *_backend) static int refdb_fs_backend__compress(git_refdb_backend *_backend)
{ {
int error;
refdb_fs_backend *backend = (refdb_fs_backend *)_backend; refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
assert(backend); assert(backend);
if (packed_reload(backend) < 0 || /* load the existing packfile */ if ((error = packed_reload(backend)) < 0 || /* load the existing packfile */
packed_loadloose(backend) < 0 || /* add all the loose refs */ (error = packed_loadloose(backend)) < 0 || /* add all the loose refs */
packed_write(backend) < 0) /* write back to disk */ (error = packed_write(backend)) < 0) /* write back to disk */
return -1; return error;
return 0; return 0;
} }
......
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