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

Re: [PATCH] teach update-index --refresh about --data-unchanged

From
PWPete Wyckoff <pw@padd.com>
Date
Nov 14, 2010, 16:58 UTC
Message-ID
<20101114165819.GA8714@arf.padd.com>
In-Reply-To
<20101103220243.GA6777@arf.padd.com>
pw@padd.com wrote on Wed, 03 Nov 2010 18:02 -0400:
Show 28 quoted lines
> jrnieder@gmail.com wrote on Wed, 03 Nov 2010 13:36 -0500:
> > On Wed, Nov 03, 2010 at 10:37:40AM -0700, Junio C Hamano wrote:
> > > Pete Wyckoff <pw@padd.com> writes:
> > 
> > >> When a repository has been copied with rsync, or cloned using
> > >> a volume manager, the index can be incorrect even though the
> > >> data is unchanged.  This new flag tells update-index --refresh
> > >> that it is not necessary to reread the data contents.
> > >
> > > I know our traditional attitude towards the plumbing commands have been
> > > "give them long enough rope and let users hang themselves", but this
> > > particular rope feels a bit too long for my taste.
> > 
> > Pete, I think you mentioned the possibility of a special-case tool for
> > contrib/ that just updates the inode, device number, and ctime fields?
> > That sounds a little less worrying to use, as plumbing.
> 
> Yes, I'd been discussing with Jonathan offlist that I too agree
> this is a bit bizarre for general use.  Especially when thinking
> about how to explain the new flag in the manpage, and how
> interactions with other command-line options should work.
> 
> I wrote a short C program to use existing functions from cache.h
> to read and write the index, updating the entries by hand.  Once
> I figure out how to build it nicely, I'll submit for contrib/.  I
> haven't figured out how to include the useful bits of the
> top-level Makefile (like SSL setting, which SHA1, -lpthread,
> etc.).

Turns out this was dead simple with dulwich, a python interface to git internals: http://samba.org/~jelmer/dulwich . I got rid of the C version.

The script uses dulwich to generate a list of index entries, stats each file and updates the entries, then writes it back out. I won't submit it to contrib, since it is so trivial and because it depends on dulwich.

		-- Pete
Previous: Pete WyckoffNext: Jonathan Nieder
Message 11 of 16 in “index rebuild for cloned repo”
  1. Pete WyckoffOct 31, 2010
  2. Jonathan NiederOct 31, 2010
  3. cherry-pick/revert: transparently refresh indexJonathan Nieder, Oct 31, 2010
  4. Andreas SchwabOct 31, 2010
  5. Jonathan NiederOct 31, 2010
  6. Pete WyckoffOct 31, 2010
  7. teach update-index --refresh about --data-unchangedPete Wyckoff, Oct 31, 2010
  8. Junio C HamanoNov 3, 2010
  9. Jonathan NiederNov 3, 2010
  10. Pete WyckoffNov 3, 2010
  11. Pete WyckoffNov 14, 2010
  12. Jonathan NiederNov 14, 2010
  13. Johannes SixtNov 1, 2010
  14. Junio C HamanoNov 3, 2010
  15. Johannes SixtNov 3, 2010
  16. Nguyen Thai Ngoc DuyNov 1, 2010

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.