Re: Fix recent 'unpack_trees()'-related changes breaking 'git stash'

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

 




On Fri, 14 Mar 2008, Linus Torvalds wrote:
> 
> The trivial fix is to just copy the index timestamp from the source index 
> into the result index. But we only do this if we *have* a source index, of 
> course, and if we will even bother to use the result.

Actually, that second part of the test is just unnecessarily clever, and 
it's just asking for trouble.

Even if we never use the "result" for anything in the end, it's probably a 
good idea to have its timestamp match the source timestamp just in case 
somebody wants to do the "is_racy_timestamp()" on the result while it's 
being generated (and before it is thrown away).

In particular, it would not be necessarily wrong to use ie_match_stat() on 
the result index in a callback.

So it might be better to make that thing be just

>  	memset(&o->result, 0, sizeof(o->result));
> +	if (o->src_index)
> +		o->result.timestamp = o->src_index->timestamp;
>  	o->merge_size = len;

instead of checking both src_index *and* dst_index. The source index is 
all that matters anyway. Even if 'o->result' isn't used in the end, who 
cares? We can still give it the right timestamp.

And no, this really isn't likely to matter, but let's pick the simpler 
version if it doesn't matter.

		Linus
--
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]

  Powered by Linux