On Wed, Oct 18, 2017 at 12:42 PM, 小川恭史 <aiueogawa...@gmail.com> wrote:
> I wanna learn how daily git command works when I run specific git command.

1. Obtain the sources and compile Git yourself
    (git clone https://kernel.googlesource.com/pub/scm/git/git
     cd git && make && make install).
   Documentation/* and the Makefile are pretty verbose if you want
   to compile for some non-mainstream hardware or OS.
2. "gdb git" and debug away.
  Note, that some Git commands call other git commands,
  So running the command with "GIT_TRACE=1 git <cmd>"
  first may be helpful for diagnosis as well.
  (See the general git man page that has a couple of env vars
   that aid in debugging)

> I wanna know which function is actually called then, how variables
> changes its value, and how some object is stored into database.

For understanding Gits model, it may be easier to read a book, such
as "git from the bottom up" as that conveys the concepts better.

The source code is riddled with handling corner cases, error handling
and other implementation details that are usually not interesting but
rather tedious.

> How can I debug git source code interactively with debugger like gdb?

Also checkout ddd, a graphical frontend of gdb.

Cheers,
Stefan

Reply via email to