Commit 637edc9c by Vicent Marti

refs: Remove bogus assertion

The assertion in line 360 was there to check that only loose refs were
being written as loose, but there are times when we need to re-write a
packed reference as loose.
parent e0fc39da
......@@ -357,8 +357,6 @@ static int loose_write(git_reference *ref)
int error;
struct stat st;
assert((ref->type & GIT_REF_PACKED) == 0);
git__joinpath(ref_path, ref->owner->path_repository, ref->name);
if ((error = git_filebuf_open(&file, ref_path, GIT_FILEBUF_FORCE)) < GIT_SUCCESS)
......@@ -1348,8 +1346,6 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force)
* us to rollback if writing fails
*/
ref->type &= ~GIT_REF_PACKED;
/* Create the loose ref under its new name */
error = loose_write(ref);
if (error < GIT_SUCCESS) {
......@@ -1357,6 +1353,8 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force)
goto cleanup;
}
ref->type &= ~GIT_REF_PACKED;
/* Remove from the packfile cache in order to avoid packing it back
* Note : we do not rely on git_reference_delete() because this would
* invalidate the reference.
......
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