Merge branch 'mh/ref-remove-empty-directory'
Deletion of a branch "foo/bar" could remove .git/refs/heads/foo once there no longer is any other branch whose name begins with "foo/", but we didn't do so so far. Now we do. * mh/ref-remove-empty-directory: (23 commits) files_transaction_commit(): clean up empty directories try_remove_empty_parents(): teach to remove parents of reflogs, too try_remove_empty_parents(): don't trash argument contents try_remove_empty_parents(): rename parameter "name" -> "refname" delete_ref_loose(): inline function delete_ref_loose(): derive loose reference path from lock log_ref_write_1(): inline function log_ref_setup(): manage the name of the reflog file internally log_ref_write_1(): don't depend on logfile argument log_ref_setup(): pass the open file descriptor back to the caller log_ref_setup(): improve robustness against races log_ref_setup(): separate code for create vs non-create log_ref_write(): inline function rename_tmp_log(): improve error reporting rename_tmp_log(): use raceproof_create_file() lock_ref_sha1_basic(): use raceproof_create_file() lock_ref_sha1_basic(): inline constant raceproof_create_file(): new function safe_create_leading_directories(): set errno on SCLD_EXISTS safe_create_leading_directories_const(): preserve errno ...
This commit is contained in:
@ -55,6 +55,12 @@
|
||||
*/
|
||||
#define REF_UPDATE_VIA_HEAD 0x100
|
||||
|
||||
/*
|
||||
* Used as a flag in ref_update::flags when the loose reference has
|
||||
* been deleted.
|
||||
*/
|
||||
#define REF_DELETED_LOOSE 0x200
|
||||
|
||||
/*
|
||||
* Return true iff refname is minimally safe. "Safe" here means that
|
||||
* deleting a loose reference by this name will not do any damage, for
|
||||
@ -62,11 +68,12 @@
|
||||
* This function does not check that the reference name is legal; for
|
||||
* that, use check_refname_format().
|
||||
*
|
||||
* We consider a refname that starts with "refs/" to be safe as long
|
||||
* as any ".." components that it might contain do not escape "refs/".
|
||||
* Names that do not start with "refs/" are considered safe iff they
|
||||
* consist entirely of upper case characters and '_' (like "HEAD" and
|
||||
* "MERGE_HEAD" but not "config" or "FOO/BAR").
|
||||
* A refname that starts with "refs/" is considered safe iff it
|
||||
* doesn't contain any "." or ".." components or consecutive '/'
|
||||
* characters, end with '/', or (on Windows) contain any '\'
|
||||
* characters. Names that do not start with "refs/" are considered
|
||||
* safe iff they consist entirely of upper case characters and '_'
|
||||
* (like "HEAD" and "MERGE_HEAD" but not "config" or "FOO/BAR").
|
||||
*/
|
||||
int refname_is_safe(const char *refname);
|
||||
|
||||
@ -155,8 +162,9 @@ struct ref_update {
|
||||
|
||||
/*
|
||||
* One or more of REF_HAVE_NEW, REF_HAVE_OLD, REF_NODEREF,
|
||||
* REF_DELETING, REF_ISPRUNING, REF_LOG_ONLY, and
|
||||
* REF_UPDATE_VIA_HEAD:
|
||||
* REF_DELETING, REF_ISPRUNING, REF_LOG_ONLY,
|
||||
* REF_UPDATE_VIA_HEAD, REF_NEEDS_COMMIT, and
|
||||
* REF_DELETED_LOOSE:
|
||||
*/
|
||||
unsigned int flags;
|
||||
|
||||
|
Reference in New Issue
Block a user