Re: [PATCH] tag: add tag.createReflog option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> +enum log_refs_config {
> +	LOG_REFS_UNSET = -1,
> +	LOG_REFS_NONE = 0,
> +	LOG_REFS_NORMAL, /* see should_create_reflog for rules */
> +	LOG_REFS_ALWAYS
> +};
> +extern enum log_refs_config log_all_ref_updates;
> +...
> +int should_create_reflog(const char *refname)
> +{
> +	switch (log_all_ref_updates) {
> +	case LOG_REFS_ALWAYS:
> +		return 1;
> +	case LOG_REFS_NORMAL:
> +		return !prefixcmp(refname, "refs/heads/") ||
> +		       !prefixcmp(refname, "refs/remotes/") ||
> +		       !prefixcmp(refname, "refs/notes/") ||
> +		       !strcmp(refname, "HEAD");
> +	default:
> +		return 0;
> +	}
> +}

Yup, this is how I expected for the feature to be done.

Just a hint for Cornelius; prefixcmp() is an old name for what is
called starts_with() these days.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]