mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 16:22:40 +00:00
Fix corner case in reference renaming
Renaming a packed reference should not pack another reference which happens to be in both loose and pack state.
This commit is contained in:
parent
268bee3d4f
commit
8f90ced5ed
@ -695,9 +695,18 @@ static int packed_remove_loose(git_repository *repo, git_vector *packing_list)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
char full_path[GIT_PATH_MAX];
|
char full_path[GIT_PATH_MAX];
|
||||||
int error = GIT_SUCCESS;
|
int error = GIT_SUCCESS;
|
||||||
|
git_reference *reference;
|
||||||
|
|
||||||
for (i = 0; i < packing_list->length; ++i) {
|
for (i = 0; i < packing_list->length; ++i) {
|
||||||
git_reference *ref = git_vector_get(packing_list, i);
|
git_reference *ref = git_vector_get(packing_list, i);
|
||||||
|
|
||||||
|
/* Ensure the packed reference doesn't exist
|
||||||
|
* in a (more up-to-date?) state as a loose reference
|
||||||
|
*/
|
||||||
|
reference = git_hashtable_lookup(ref->owner->references.loose_cache, ref->name);
|
||||||
|
if (reference != NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
git__joinpath(full_path, repo->path_repository, ref->name);
|
git__joinpath(full_path, repo->path_repository, ref->name);
|
||||||
|
|
||||||
if (gitfo_exists(full_path) == GIT_SUCCESS &&
|
if (gitfo_exists(full_path) == GIT_SUCCESS &&
|
||||||
|
Loading…
Reference in New Issue
Block a user