summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-06-30 20:53:59 +0200
committerVicent Marti <tanoku@gmail.com>2011-06-30 22:28:19 +0200
commit637edc9c42803420decebae91d82c3dcf3626c96 (patch)
tree8db1cd7024c93910d5aa19918fd9a92a051a3e2d
parente0fc39da9a4425c0e188d30502ba321ff28e8319 (diff)
downloadlibgit2-637edc9c42803420decebae91d82c3dcf3626c96.tar.gz
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.
-rw-r--r--src/refs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/refs.c b/src/refs.c
index 612a77977..1bb385c32 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -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.