home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] a git (plumbing?) command to show all objects added by a commit?

  • Subject: Re: [OCLUG-Tech] a git (plumbing?) command to show all objects added by a commit?
  • From: "Robert P. J. Day" <rpjday [ at ] crashcourse [ dot ] ca>
  • Date: Wed, 25 Jan 2012 06:47:53 -0500 (EST)
On Tue, 24 Jan 2012, Aidan Van Dyk wrote:

> On Tue, Jan 24, 2012 at 11:20 AM, Robert P. J. Day
> <rpjday [ at ] crashcourse [ dot ] ca> wrote:
> >
> >  in order to demonstrate what happens in the .git directory for a
> > single commit, i'd like the simplest way to list all of the new
> > objects that were added to the .git directory given changing a single
> > file and committing that change.
> >
> >  for example, let's say i've checked out the kernel source tree and
> > make a trivial change to a file five subdirectories down, then commit
> > that single file change.  if i understand it correctly, the following
> > objects will have to be created and added to the .git object set:
> >
> > * a new blob for the new file
> > * 5 new trees, one for each subdirectory all the way down to the
> >  changed file
> > * a new commit object
> >
> >  does that sound about right?  and is there a single command that
> > would show all of that new content?  thanks.
>
> I think the easiest way would be to pack everything before you start,
> and then after your commit, just look at all the loose objects made.

  i was hoping for something that didn't affect the object store, but
since the repo i'll be using in class will be purely temporary, this
might work.

> Or if you want to work backwards from 1st principles, you can work
> with cat-file to show them from the commits through the trees/files
> how things (objects and their SHA1s) have changed...

  i'd thought of that, too.  all of this is in aid of an intro Git
course i'm writing (more on that later) where i *really* want to
explain how Git works internally in some depth so that subsequent
topics make more sense.  as a trivial starting point, i have an
exercise where students add a single file to an initially empty repo,
then examine the object store to see what changed.

  anyway, thanks for the suggestions so far.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================