Git development
 help / color / mirror / Atom feed
* git index: how does it work?
@ 2009-08-05 16:21 Shaun Cutts
  2009-08-05 18:00 ` Junio C Hamano
  2009-08-05 18:21 ` Sverre Rabbelier
  0 siblings, 2 replies; 9+ messages in thread
From: Shaun Cutts @ 2009-08-05 16:21 UTC (permalink / raw)
  To: git

Hello,

I am wondering if someone could explain and/or point me to an explanation of how
the git index works.

For instance, suppose I have a tracked file: "foo.c"

1) [I modify "foo.c"]
2) git add foo.c
3) [modify again]
4) git commit -m "blah blah"

Since I don't include the "-a" switch, the version I added on step 2 is
committed. But how does the index keep track of these changes? Does the index
file actually contain the hunks of "foo.c" that have been modified? Or is there
a "temporary" blob created, which the index points to? 

In either case, is there some interface to access these hunks and/or get a
reference to the blob?

Thanks,

-- Shaun

PS I'm considering writing an extension to git where the "diff" understands the
semantics of certain types of files: hunks wouldn't just be textual blobs but
would try to represent a minimal change from one version to the next based on an
edit distance, so that, e.g. changing the location of a function would be
represented by a "move" edit, rather than two text changes.

I have been building a prototype as a wrapper around git, intervening to store
extra information, etc before passing commands on to git. Blobs, commits, etc
are nice abstractions I can leave as is, but the index seems sort of foggy to
me. Any advice appreciated!

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-08-12 20:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-05 16:21 git index: how does it work? Shaun Cutts
2009-08-05 18:00 ` Junio C Hamano
2009-08-12 11:52   ` Shaun Cutts
2009-08-12 17:47     ` Sverre Rabbelier
2009-08-12 18:45       ` Shaun Cutts
2009-08-12 19:39         ` Björn Steinbrink
2009-08-12 20:31     ` Junio C Hamano
2009-08-05 18:21 ` Sverre Rabbelier
2009-08-05 19:31   ` Shaun Cutts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox