Subject: Re: [PATCH v4 24/27] prune: strategies for linked checkouts

From: Junio C Hamano <[email-masked]>
Date: Wed, 05 Mar 2014 12:07:44 -0800

Nguyễn Thái Ngọc Duy  <[email-masked]> writes:

> +	if (get_device_or_die(path) != get_device_or_die(get_git_dir())) {
> +		strbuf_reset(&sb);
> +		strbuf_addf(&sb, "%s/locked", sb_repo.buf);
> +		write_file(sb.buf, 1, "located on a different file system\n");
> +		keep_locked = 1;
> +	} else {
> +		strbuf_reset(&sb);
> +		strbuf_addf(&sb, "%s/link", sb_repo.buf);
> +		(void)link(sb_git.buf, sb.buf);
> +	}

Just in case you did not realize, casting the return away with
(void) will not squelch this out of the compiler:

    builtin/checkout.c: In function 'prepare_linked_checkout':
    builtin/checkout.c:947:3: error: ignoring return value of 'link', declared with attribute warn_unused_result [-Werror=unused-result]

It still feels fishy to see "we attempt to link but we do not care
if it works or not" to me, with or without the "unused result"
issue.