Nguyễn Thái Ngọc Duy [off-list ref] 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.