mirror of
https://git.proxmox.com/git/libgit2
synced 2025-07-09 14:09:17 +00:00
refs: deploy git_reference_has_log()
This commit is contained in:
parent
75261421ec
commit
33c3370700
@ -53,6 +53,8 @@ GIT_EXTERN(int) git_reflog_write(git_reference *ref, const git_oid *oid_old, con
|
|||||||
/**
|
/**
|
||||||
* Rename the reflog for the given reference
|
* Rename the reflog for the given reference
|
||||||
*
|
*
|
||||||
|
* The reflog to be renamed is expected to already exist
|
||||||
|
*
|
||||||
* @param ref the reference
|
* @param ref the reference
|
||||||
* @param new_name the new name of the reference
|
* @param new_name the new name of the reference
|
||||||
* @return 0 or an error code
|
* @return 0 or an error code
|
||||||
|
10
src/refs.c
10
src/refs.c
@ -1404,18 +1404,12 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rename the reflog file.
|
* Rename the reflog file, if it exists.
|
||||||
*/
|
*/
|
||||||
git_buf_clear(&aux_path);
|
if ((git_reference_has_log(ref)) && (git_reflog_rename(ref, new_name) < 0))
|
||||||
if (git_buf_join_n(&aux_path, '/', 3, ref->owner->path_repository, GIT_REFLOG_DIR, ref->name) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (git_path_exists(aux_path.ptr) == true) {
|
|
||||||
if (git_reflog_rename(ref, new_name) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
} else {
|
|
||||||
giterr_clear();
|
giterr_clear();
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change the name of the reference given by the user.
|
* Change the name of the reference given by the user.
|
||||||
|
Loading…
Reference in New Issue
Block a user