Re: [PATCH 4/4] create_symref: use existing ref-lock code

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

 



Jeff King <peff@xxxxxxxx> writes:

>  #ifndef NO_SYMLINK_HEAD
> -	if (prefer_symlink_refs) {
> -		unlink(ref_path);
> -		if (!symlink(target, ref_path))
> -			goto done;

I see that the original was sloppy (most certainly my bad) ...

> +	char *ref_path = get_locked_file_path(lock->lk);
> +	unlink(ref_path);

... and you inherited that.  I see a few seemingly related helpers
in wrapper.c, but none looks useful in this context X-<.

    if (unlink_or_warn(ref_path))
    	return -1;

is close enough, but it still lets the caller fallback to textual
symref.

> +	ret = symlink(target, ref_path);
> +	free(ref_path);
> +
> +	if (ret)
>  		fprintf(stderr, "no symlink - falling back to symbolic ref\n");
> -	}
>  #endif
> +	return ret;
> +}
>  
> -	len = snprintf(buf, sizeof(buf), "ref: %s\n", target);
> -...
> -	free(lockpath);
> -
> -#ifndef NO_SYMLINK_HEAD
> -	done:
> -#endif

This huge block is worth removing ;-)  Thanks.
--
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]