Re: [PATCH v3 24/25] prune: strategies for linked checkouts

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:
>
> (Only nitpicks during this round of review).
>
>> +	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);
>> +		link(sb_git.buf, sb.buf); /* it's ok to fail */
>
> If so, perhaps tell that to the code by saying something like
>
> 		(void) link(...);
>
> ?
>
> But why is it OK to fail in the first place?  If we couldn't link,
> don't you want to fall back to the lock codepath?  After all, the
> "are we on the same device?" check is to cope with the case where
> we cannot link and that alternate codepath is supposed to be
> prepared to handle the "ah, we cannot link" case correctly, no?

In other words, couldn't that part more like this?  That is, we
optimisiticly try the link(2) first and if it fails for whatever
reason fall back to whatever magic the lock codepath implements.

+	strbuf_reset(&sb);
+	strbuf_addf(&sb, "%s/link", sb_repo.buf);
+	if (link(sb_git.buf, sb.buf) < 0) {
+		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;
+	}
+
--
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]