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

Re: Use case: GIT to manage transactions in a CMS?

From
Junio C Hamano <junkio@cox.net>
Date
Feb 17, 2006, 11:44 UTC
Message-ID
<7v7j7u43c2.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<43F5AF3C.5050507@itaapy.com>
"J. David Ibáñez" <jdavid@itaapy.com> writes:
> Maybe I could hack something, are there some docs explaining the
> internal format of git objects? or, where to look in the source to
> find this info?

The index file is mostly dealt with by read-cache.c (despite its name, it has both read and write routines). The easiest way to understand the tree object format is by reading write-tree.c.

But the format is the easiest part. You have to realize that this is a nontrivial task.

The merge algorithm assumes that it can detect a presense of directory by finding a blob under that. You need to teach 'read-tree -m' that sometimes there is an empty directory recorded in the index file. This is very important to avoid directory-file conflicts during the merge.

Tree object side is probably easier because we _can_ write an empty tree object, and presumably three tree-walker implementations (one used in read-tree and object layer, one in diff-tree and another in merge-tree) should all handle empty trees gracefully, but still its callers need to be verified.

> Another point, the application is written in Python, right now
> I have to open a shell to run the git commands.

I always have a shell open so it does not sound a big deal to me ;-).

Show 6 quoted lines
> It would be nice if the core functionality was implemented in a C
> library, then with a Python wrapper I could use git without going
> through the shell.
>
> Is this something to be expected? There will be a "libgit" sometime
> in the future?
Yes, read the list archive.

But not yet. The core level has been fluctuating quite a bit. The latest round being the object layer bookkeeping changes.

Previous: J. David Ibáñez
Message 4 of 4 in “Use case: GIT to manage transactions in a CMS?”
  1. J. David IbáñezFeb 15, 2006
  2. Andreas EricssonFeb 15, 2006
  3. J. David IbáñezFeb 17, 2006
  4. Junio C HamanoFeb 17, 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.