git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC v2 2/3] make USE_NSEC work as expected

From
KBKjetil Barvik <barvik@broadpark.no>
Date
Feb 20, 2009, 10:07 UTC
Message-ID
<86mychifqj.fsf@broadpark.no>
In-Reply-To
<7vab8hfqug.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 24 quoted lines
> Kjetil Barvik <barvik@broadpark.no> writes:
>
>> diff --git a/read-cache.c b/read-cache.c
>> index 940ec76..ca4bec2 100644
>> --- a/read-cache.c
>> +++ b/read-cache.c
>> @@ -67,8 +67,15 @@ void rename_index_entry_at(struct index_state *istate, int nr, const char *new_n
>>   */
>>  void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
>>  {
>> -	ce->ce_ctime = st->st_ctime;
>> -	ce->ce_mtime = st->st_mtime;
>> +	ce->ce_ctime.sec = (unsigned int)st->st_ctime;
>> +	ce->ce_mtime.sec = (unsigned int)st->st_mtime;
>> +#ifdef USE_NSEC
>> +	ce->ce_ctime.nsec = (unsigned int)st->st_ctim.tv_nsec;
>> +	ce->ce_mtime.nsec = (unsigned int)st->st_mtim.tv_nsec;
>> +#else
>> +	ce->ce_ctime.nsec = 0;
>> +	ce->ce_mtime.nsec = 0;
>> +#endif
>
> How does this affect a use case where the same index file used with two 
> instances of git (one compiled with and another without USE_NSEC)?
  OK, I admit that I was thinking safe here, so the one using the git
  compiled with USE_NSEC will see a slow down.
  If we for the use case can assume that both is using an git program
  compiled from the same source, and the index file is placed on a
  filesystem which supports nanoseconds timestamp, I guess that the use
  case for the one using USE_NSEC could be better.
  I will make a new patch to this one (since it is already placed in
  next), and then you can see if you like the updated one.
Show 18 quoted lines
>> diff --git a/unpack-trees.c b/unpack-trees.c
>> index e547282..44714cc 100644
>> --- a/unpack-trees.c
>> +++ b/unpack-trees.c
>> @@ -380,8 +380,12 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
>>  
>>  	memset(&o->result, 0, sizeof(o->result));
>>  	o->result.initialized = 1;
>> -	if (o->src_index)
>> -		o->result.timestamp = o->src_index->timestamp;
>> +	if (o->src_index) {
>> +		o->result.timestamp.sec = o->src_index->timestamp.sec;
>> +#ifdef USE_NSEC
>> +		o->result.timestamp.nsec = o->src_index->timestamp.nsec;
>> +#endif
>> +	}
>
> Do we need this hunk?
  Since timestamp is now a 'struct cache_time' member, I converted the
  usage of this if-test to be in line with the USE_NSEC usage.
  -- kjetil
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 10 in “git checkout optimisation - part 3”
  1. 0/3 git checkout optimisation - part 3Kjetil Barvik, Feb 19, 2009
  2. 1/3 fix compile error when USE_NSEC is definedKjetil Barvik, Feb 19, 2009
  3. 2/3 make USE_NSEC work as expectedKjetil Barvik, Feb 19, 2009
  4. Junio C HamanoFeb 20, 2009
  5. Kjetil BarvikFeb 20, 2009
  6. Junio C HamanoFeb 21, 2009
  7. 3/3 verify_uptodate(): add ce_uptodate(ce) testKjetil Barvik, Feb 19, 2009
  8. Junio C HamanoFeb 20, 2009
  9. Kjetil BarvikFeb 20, 2009
  10. Sverre RabbelierFeb 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.