Re: [PATCH 07/14] is_refname_available(): remove the "quiet" argument

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

 



On Thu, 2011-10-13 at 09:58 +0200, mhagger@xxxxxxxxxxxx wrote:
> From: Michael Haggerty <mhagger@xxxxxxxxxxxx>
> 
> quiet was always set to 0, so get rid of it.  Add a function docstring
> for good measure.

I would like to know if perhaps it was an unfinished project somewhere
to propagate the "quiet" option down to this level before removing the
function argument. Comments?

> +/*
> + * Return true iff a reference named refname could be created without

Did you really mean "iff" (as in "if and only if") or just plain "if"
here?

> + * conflicting with the name of an existing reference.  If oldrefname
> + * is non-NULL, ignore potential conflicts with oldrefname (e.g.,
> + * because oldrefname is scheduled for deletion in the same
> + * operation).
> + */
>  static int is_refname_available(const char *refname, const char *oldrefname,
> -				struct ref_array *array, int quiet)
> +				struct ref_array *array)
>  {
>  	int i, namlen = strlen(refname); /* e.g. 'foo/bar' */
>  	for (i = 0; i < array->nr; i++ ) {
> @@ -1062,9 +1069,8 @@ static int is_refname_available(const char *refname, const char *oldrefname,
>  			const char *lead = (namlen < len) ? entry->name : refname;
>  			if (!strncmp(refname, entry->name, cmplen) &&
>  			    lead[cmplen] == '/') {
> -				if (!quiet)
> -					error("'%s' exists; cannot create '%s'",
> -					      entry->name, refname);
> +				error("'%s' exists; cannot create '%s'",
> +				      entry->name, refname);
>  				return 0;
>  			}
>  		}
> @@ -1117,7 +1123,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
>  	 * name is a proper prefix of our refname.
>  	 */
>  	if (missing &&
> -	     !is_refname_available(refname, NULL, get_packed_refs(NULL), 0)) {
> +	     !is_refname_available(refname, NULL, get_packed_refs(NULL))) {
>  		last_errno = ENOTDIR;
>  		goto error_return;
>  	}
> @@ -1272,10 +1278,10 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
>  	if (!symref)
>  		return error("refname %s not found", oldrefname);
>  
> -	if (!is_refname_available(newrefname, oldrefname, get_packed_refs(NULL), 0))
> +	if (!is_refname_available(newrefname, oldrefname, get_packed_refs(NULL)))
>  		return 1;
>  
> -	if (!is_refname_available(newrefname, oldrefname, get_loose_refs(NULL), 0))
> +	if (!is_refname_available(newrefname, oldrefname, get_loose_refs(NULL)))
>  		return 1;
>  
>  	lock = lock_ref_sha1_basic(renamed_ref, NULL, 0, NULL);
-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]