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

Libification update

From
Matthias Urlichs <smurf@smurf.noris.de>
Date
Nov 14, 2005, 16:31 UTC
Message-ID
<pan.2005.11.14.16.31.28.304206@smurf.noris.de>
I've merged my current library-ification effort with Junio's current HEAD.
URL: http://netz.smurf.noris.de/git/git.git#libize

There's a Python interface, written using Pyrex. You can now walk object trees natively, with Python:

Show 6 quoted lines
>>> import git
>>> e=git.env()
>>> db=e.objdb
>>> c=db.lookup("HEAD").parent[0] # "HEAD^" will work too
>>> t=c.tree
>>> t.entries[0].name
'.gitignore'
>>> t["debian"].entries[0].name
'changelog'
>>> t[".gitignore"].data[0:5]
'/git\n'
>>> t[".gitignore"].data.readline()
'/git\n'    # this will work tomorrow (I hope)

I have not implemented much beyond that; keeping the code in sync is work, so doing more will have to wait until this gets merged.

I did play with SWIG a bit. It would have simplified interfacing languages other than Python to git. Unfortunately, there were problems:

- refering to objects SWIG did not allocate itself is a nontrivial
  exercise
- so is keeping the Python-visible namespace clean
  (unless you're using C++ ... probably not something we'd want to subject
  the git core to ...)
- SWIG's error reporting is *scary*.
  In comparison, Pyrex mostly does the right thing.

If somebody wants to start working on a SWIG/perl/tcl/... interface for the library, be my guest. ;-)

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Ask the person next to you.
Message 1 of 1 in “Libification update”
  1. Matthias UrlichsNov 14, 2005

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.