Skip to content

Commit 2e09106

Browse files
committed
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.
1 parent dd1ca6f commit 2e09106

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/refdb_fs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,14 +1383,15 @@ static int refdb_fs_backend__rename(
13831383

13841384
static int refdb_fs_backend__compress(git_refdb_backend *_backend)
13851385
{
1386+
int error;
13861387
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
13871388

13881389
assert(backend);
13891390

1390-
if (packed_reload(backend) < 0 || /* load the existing packfile */
1391-
packed_loadloose(backend) < 0 || /* add all the loose refs */
1392-
packed_write(backend) < 0) /* write back to disk */
1393-
return -1;
1391+
if ((error = packed_reload(backend)) < 0 || /* load the existing packfile */
1392+
(error = packed_loadloose(backend)) < 0 || /* add all the loose refs */
1393+
(error = packed_write(backend)) < 0) /* write back to disk */
1394+
return error;
13941395

13951396
return 0;
13961397
}

0 commit comments

Comments
 (0)