diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-12-24 17:49:49 +0000 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2016-11-14 11:35:37 +0100 |
commit | 2e09106e7a8711e3a4a70ef304643d28f2763c11 (patch) | |
tree | 20532b3cef94f849476eba0db7ff9bc783e24eb3 | |
parent | dd1ca6f15a85ba1e812be044bc12cdab9b3134dd (diff) | |
download | libgit2-2e09106e7a8711e3a4a70ef304643d28f2763c11.tar.gz |
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.
-rw-r--r-- | src/refdb_fs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c index 20cc08fc4..6b55960e1 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -1383,14 +1383,15 @@ static int refdb_fs_backend__rename( static int refdb_fs_backend__compress(git_refdb_backend *_backend) { + int error; refdb_fs_backend *backend = (refdb_fs_backend *)_backend; assert(backend); - if (packed_reload(backend) < 0 || /* load the existing packfile */ - packed_loadloose(backend) < 0 || /* add all the loose refs */ - packed_write(backend) < 0) /* write back to disk */ - return -1; + if ((error = packed_reload(backend)) < 0 || /* load the existing packfile */ + (error = packed_loadloose(backend)) < 0 || /* add all the loose refs */ + (error = packed_write(backend)) < 0) /* write back to disk */ + return error; return 0; } |