Unverified Commit 77f1460f by Edward Thomson Committed by GitHub

Merge pull request #4915 from pks-t/pks/refdb-minor-refactorings

refdb_fs: refactor error handling in `refdb_reflog_fs__delete`
parents bc219657 8dde7e11
...@@ -2046,28 +2046,27 @@ cleanup: ...@@ -2046,28 +2046,27 @@ cleanup:
static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name) static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name)
{ {
int error; refdb_fs_backend *backend = (refdb_fs_backend *) _backend;
git_buf path = GIT_BUF_INIT; git_buf path = GIT_BUF_INIT;
int error;
git_repository *repo;
refdb_fs_backend *backend;
assert(_backend && name); assert(_backend && name);
backend = (refdb_fs_backend *) _backend; if ((error = retrieve_reflog_path(&path, backend->repo, name)) < 0)
repo = backend->repo; goto out;
if (!git_path_exists(path.ptr))
goto out;
error = retrieve_reflog_path(&path, repo, name); if ((error = p_unlink(path.ptr)) < 0)
goto out;
if (!error && git_path_exists(path.ptr)) {
error = p_unlink(path.ptr);
refdb_fs_backend__try_delete_empty_ref_hierarchie(backend, name, true); refdb_fs_backend__try_delete_empty_ref_hierarchie(backend, name, true);
}
out:
git_buf_dispose(&path); git_buf_dispose(&path);
return error; return error;
} }
int git_refdb_backend_fs( int git_refdb_backend_fs(
......
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