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

Re: CFT: merge-recursive in C (updated)

From
Alex Riesen <fork0@t-online.de>
Date
Jun 29, 2006, 23:28 UTC
Message-ID
<20060629232836.GB7216@steel.home>
In-Reply-To
<Pine.LNX.4.63.0606291945200.29667@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin, Thu, Jun 29, 2006 20:40:46 +0200:
Show 23 quoted lines
> > > 
> > > When diff-index and diff-files compare a tree entry or an index
> > > entry with a file in the working tree, they do not compute the
> > > blob hash value for the file in the working tree.  0{40} is used
> > > on the RHS in such a case.  When the working tree file matches
> > > the corresponding index entry, then we know RHS matches what is
> > > in the index, so both sides have the blob hash value.
> > 
> > Ok. Am I correct in the assumption, that if the file in working tree has
> > the same SHA1 as LHS, than the next "git-update-index --refresh" will
> > remove the entry from git-diff-index output?
> > This is what actually happens, if I do "git-update-index --refresh", so I
> > suspect that I have an SHA1 update gone missing somewhere.
> 
> I think the problem is more like this (in ce_match_stat_basic()):
> 
>         if (ce->ce_mtime.sec != htonl(st->st_mtime))
>                 changed |= MTIME_CHANGED;
>         if (ce->ce_ctime.sec != htonl(st->st_ctime))
>                 changed |= CTIME_CHANGED;
> 
> If you update with --index-info, the mtime and ctime is not updated 
> from the file in the working directory.
Oh, I see. I was under impression git-diff-index does not use mtime/ctime.
Thought it was just mode+sha between treeish and index.
    $ man git-diff-index
       git-diff-index <tree-ish>
              compares the <tree-ish> and the files on the filesystem.
       git-diff-index --cached <tree-ish>
              compares the <tree-ish> and the index.
So it does compare treeish ad index, but only if explicitly told so.
Pity, there seem to be no way to update the times in --index-info
protocol yet. Maybe it'll be even never needed, after cache functions
gone libraries.
Show 17 quoted lines
> All the more a reason to go forward with direct calls to read_cache() and 
> write_cache(). At the moment, my plan is
> 
> - trivially split the read_cache() code into read_cache()/read_cache_from(),
> - introduce flush_cache(),
> - trivially rewrite add_file_to_cache(), and add_cache_info() from
>   builtin-update-index.c, move that to read-tree.c, too, and
> - throw out the pipe to git-update-index from merge-recursive.c 
>   altogether.
> 
> This should be less intrusive than it sounds: with the introduction of 
> read_cache_from() it should be trivial to handle the problem of different 
> index files.
> 
> We have to put a lock_file on the index file at the start, and write the 
> index file at the end.
> 
Yes, very nice plan, all by itself :)
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 14 of 32 in “CFT: merge-recursive in C (updated)”
  1. Alex RiesenJun 27, 2006
  2. Johannes SchindelinJun 27, 2006
  3. Alex RiesenJun 27, 2006
  4. Alex RiesenJun 28, 2006
  5. Johannes SchindelinJun 28, 2006
  6. Alex RiesenJun 28, 2006
  7. Johannes SchindelinJun 28, 2006
  8. Alex RiesenJun 28, 2006
  9. Johannes SchindelinJun 28, 2006
  10. Alex RiesenJun 29, 2006
  11. Junio C HamanoJun 29, 2006
  12. Alex RiesenJun 29, 2006
  13. Johannes SchindelinJun 29, 2006
  14. Alex RiesenJun 29, 2006
  15. Johannes SchindelinJun 29, 2006
  16. 1/2 refactor merge_bases() as preparation to libify merge-baseJohannes Schindelin, Jun 29, 2006
  17. move get_merge_bases() to core lib; use it in merge-recursiveJohannes Schindelin, Jun 29, 2006
  18. Johannes SchindelinJun 29, 2006
  19. Alex RiesenJun 29, 2006
  20. Johannes SchindelinJun 29, 2006
  21. Alex RiesenJun 29, 2006
  22. Alex RiesenJun 29, 2006
  23. Johannes SchindelinJun 29, 2006
  24. Linus TorvaldsJun 29, 2006
  25. Junio C HamanoJun 29, 2006
  26. Johannes SchindelinJun 29, 2006
  27. Junio C HamanoJun 29, 2006
  28. Alex RiesenJun 30, 2006
  29. Linus TorvaldsJun 27, 2006
  30. Johannes SchindelinJun 27, 2006
  31. Linus TorvaldsJun 27, 2006
  32. Alex RiesenJun 27, 2006

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.