Skip to content

Commit 171116e

Browse files
committed
refdb: repurpose filesystem prune function
1 parent 8fd855f commit 171116e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/refdb_fs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,10 +1353,10 @@ static int refdb_fs_backend__write_tail(
13531353
return error;
13541354
}
13551355

1356-
static void refdb_fs_backend__try_delete_empty_ref_hierarchie(
1356+
static void refdb_fs_backend__prune_refs(
13571357
refdb_fs_backend *backend,
13581358
const char *ref_name,
1359-
bool reflog)
1359+
const char *prefix)
13601360
{
13611361
git_buf relative_path = GIT_BUF_INIT;
13621362
git_buf base_path = GIT_BUF_INIT;
@@ -1374,8 +1374,8 @@ static void refdb_fs_backend__try_delete_empty_ref_hierarchie(
13741374

13751375
git_buf_truncate(&relative_path, commonlen);
13761376

1377-
if (reflog) {
1378-
if (git_buf_join3(&base_path, '/', backend->commonpath, GIT_REFLOG_DIR, git_buf_cstr(&relative_path)) < 0)
1377+
if (prefix) {
1378+
if (git_buf_join3(&base_path, '/', backend->commonpath, prefix, git_buf_cstr(&relative_path)) < 0)
13791379
goto cleanup;
13801380
} else {
13811381
if (git_buf_joinpath(&base_path, backend->commonpath, git_buf_cstr(&relative_path)) < 0)
@@ -1471,7 +1471,7 @@ static int refdb_fs_backend__delete_tail(
14711471
cleanup:
14721472
git_filebuf_cleanup(file);
14731473
if (loose_deleted)
1474-
refdb_fs_backend__try_delete_empty_ref_hierarchie(backend, ref_name, false);
1474+
refdb_fs_backend__prune_refs(backend, ref_name, "");
14751475
return error;
14761476
}
14771477

@@ -2101,7 +2101,7 @@ static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name
21012101
if ((error = p_unlink(path.ptr)) < 0)
21022102
goto out;
21032103

2104-
refdb_fs_backend__try_delete_empty_ref_hierarchie(backend, name, true);
2104+
refdb_fs_backend__prune_refs(backend, name, GIT_REFLOG_DIR);
21052105

21062106
out:
21072107
git_buf_dispose(&path);

0 commit comments

Comments
 (0)