Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Teach read-tree the -n|--dry-run option

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:13

Jens Lehmann [off-list ref] writes:
Using this option tells read-tree to not update the index. That makes it
possible to check if updating the index would be successful without
changing it.
Thanks for verifying the 3-way case as well.
As using --dry-run is expected to have no side effects, this option makes
no sense together with "-u".
I wondered if there be cases where "read-tree -m <1 to 3 trees>" will
succeed but the same command with "-u" can fail. If there were such cases,
we would need more than this patch does.

An obvious case is when you cannot write to your working tree, perhaps due
to ENOSPC or incorrect permission settings in the working tree, but I am
not worried about that. I am only worried about situations related to
version control (i.e. you may lose local changes).

I _think_ the only difference "-u" makes is that check_updates() makes
calls to checkout_entry(), and the only errors checkout_entry() would
catch are filesystem related ones. Even though there is one conditional
that says "if the cached stat does not match, you cannot checkout unless
you set .force to the checkout state", but unpack_trees() does set that
flag, so we should be safe.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help