Jeff King <p...@peff.net> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to