# Git Library?

8 messages from 2008-04-28 to 2008-04-29. Participants: Patrick Altman, Johannes Schindelin, Jakub Narebski, David Symonds, David Aguilar.
Thread: https://gitlist.dev/t/13311

## Patrick Altman, 2008-04-28 18:55

Subject: Git Library?
Message-ID: <5FCF765E-F3FF-438C-B4C1-FFB3262831A0@gmail.com>
URL: https://gitlist.dev/e/5FCF765E-F3FF-438C-B4C1-FFB3262831A0%40gmail.com

```
I want to write a Mac OSX UI for git.

Is there a documented/undocumented API for interacting with git in  
process?  Or would I be better off "shelling out" to the git command  
line?

Thanks,
Patrick Altman


---
Patrick Altman
(615) 300-2930

```

## Johannes Schindelin, 2008-04-28 19:10

Subject: Re: Git Library?
Message-ID: <alpine.DEB.1.00.0804282009310.19187@eeepc-johanness>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0804282009310.19187%40eeepc-johanness
In-Reply-To: <5FCF765E-F3FF-438C-B4C1-FFB3262831A0@gmail.com>

```
Hi,

On Mon, 28 Apr 2008, Patrick Altman wrote:

> I want to write a Mac OSX UI for git.
> 
> Is there a documented/undocumented API for interacting with git in process?
> Or would I be better off "shelling out" to the git command line?

There was a mail thread yesterday on exactly the same subject.  Bottom 
line: the recommended way is to fork()&&exec(), because I am sure you do 
not want to put in the work to make libgit.a reentrant.

Ciao,
Dscho

```

## Jakub Narebski, 2008-04-28 21:08

Subject: Re: Git Library?
Message-ID: <m3y76xofgm.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3y76xofgm.fsf%40localhost.localdomain
In-Reply-To: <5FCF765E-F3FF-438C-B4C1-FFB3262831A0@gmail.com>

```
Patrick Altman <paltman@gmail.com> writes:

> I want to write a Mac OSX UI for git.

Something like GitNub?
 
> Is there a documented/undocumented API for interacting with git in
> process?  Or would I be better off "shelling out" to the git command
> line?

Take a look how other GUIs does it.
-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Patrick Altman, 2008-04-28 21:17

Subject: Re: Git Library?
Message-ID: <F427C4D4-7264-4341-A714-23D9DD39E229@gmail.com>
URL: https://gitlist.dev/e/F427C4D4-7264-4341-A714-23D9DD39E229%40gmail.com
In-Reply-To: <m3y76xofgm.fsf@localhost.localdomain>

```

On Apr 28, 2008, at 4:08 PM, Jakub Narebski wrote:

> Patrick Altman <paltman@gmail.com> writes:
>
>> I want to write a Mac OSX UI for git.
>
> Something like GitNub?

Not really.  GitNub is really an interface for GitHub.  I am thinking  
something more like ZigVersion, http://zigzig.com/, for Git instead of  
Subversion.

>> Is there a documented/undocumented API for interacting with git in
>> process?  Or would I be better off "shelling out" to the git command
>> line?
>
> Take a look how other GUIs does it.

git-gui is written in TCL I believe, which I do not want to use.
GitNub is the only other GUI of sorts that i am aware of but like I  
mentioned above, that really is more of a GitHub interface and less of  
a git interface.

I think that this point I am just going to use NTask and the like in  
Cocoa/Objective-C to wrap the command line utilities.

Thanks,
Patrick

```

## Jakub Narebski, 2008-04-28 22:01

Subject: Re: Git Library?
Message-ID: <200804290001.39226.jnareb@gmail.com>
URL: https://gitlist.dev/e/200804290001.39226.jnareb%40gmail.com
In-Reply-To: <F427C4D4-7264-4341-A714-23D9DD39E229@gmail.com>

```
On Mon, 28 Apr 2008, Patrick Altman wrote:
> On Apr 28, 2008, at 4:08 PM, Jakub Narebski wrote:
>> Patrick Altman <paltman@gmail.com> writes:
>>
>>> I want to write a Mac OSX UI for git.
>>
>> Something like GitNub?
> 
> Not really.  GitNub is really an interface for GitHub.  I am thinking  
> something more like ZigVersion, http://zigzig.com/, for Git instead of  
> Subversion.

Well, I thought that GitNub is something similar to gitk, i.e. it is
history browser, but in Ruby/Cocoa instead of Tcl/Tk.
 
>>> Is there a documented/undocumented API for interacting with git in
>>> process?  Or would I be better off "shelling out" to the git command
>>> line?
>>
>> Take a look how other GUIs does it.
> 
> git-gui is written in Tcl I believe, which I do not want to use.
> GitNub is the only other GUI of sorts that i am aware of but like I  
> mentioned above, that really is more of a GitHub interface and less of  
> a git interface.

Take a look at http://git.or.cz/gitwiki/InterfacesFrontendsAndTools
page: there is a list of GUIs there.  There is gitk and git-gui,
there is QGit and varipus PyQt GUIs, there is Giggle, there is tig.

> I think that this point I am just going to use NTask and the like in  
> Cocoa/Objective-C to wrap the command line utilities.

I think best would be to see how QGit does it...

-- 
Jakub Narebski
Poland

```

## David Symonds, 2008-04-28 22:09

Subject: Re: Git Library?
Message-ID: <ee77f5c20804281509y3de0cc3cx72fe76e2102e3ed@mail.gmail.com>
URL: https://gitlist.dev/e/ee77f5c20804281509y3de0cc3cx72fe76e2102e3ed%40mail.gmail.com
In-Reply-To: <F427C4D4-7264-4341-A714-23D9DD39E229@gmail.com>

```
On Tue, Apr 29, 2008 at 7:17 AM, Patrick Altman <paltman@gmail.com> wrote:

>  I think that this point I am just going to use NTask and the like in
> Cocoa/Objective-C to wrap the command line utilities.

That's the way I approached it when I started doing a half-hearted
attempt at exactly what you're proposing. Clone my (small) rough code
from  http://git.symonds.id.au/macgit.git



Dave.

```

## David Aguilar, 2008-04-29 06:58

Subject: Re: Git Library?
Message-ID: <402731c90804282358i205334b8me56f4390456873b4@mail.gmail.com>
URL: https://gitlist.dev/e/402731c90804282358i205334b8me56f4390456873b4%40mail.gmail.com
In-Reply-To: <5FCF765E-F3FF-438C-B4C1-FFB3262831A0@gmail.com>

```
On Mon, Apr 28, 2008 at 11:55 AM, Patrick Altman <paltman@gmail.com> wrote:
> I want to write a Mac OSX UI for git.
>

git gui works on OSX.
Aside from that, someone's already written one* :-)

    http://repo.or.cz/ugit.git
    http://ugit.sf.net/


>  Is there a documented/undocumented API for interacting with git in process?
> Or would I be better off "shelling out" to the git command line?

Fork/exec.

If you grabbed the ugit modules you could say:

    from ugit import git

    revisions = git.rev_list(all=True).splitlines()

    file = open('msg', 'w')
    file.write("commit message." )
    file.close()

    git.commit(F='msg', s=True)

    etc, etc.

It's pretty much 90%+ of git wrapped in Python.
If a libgit.so did appear one day it would be trivial to swap out the
meta-functions in
git.py and replace them with e.g. swig replacements.  Until then,
forking out works
just fine.

stg also has Python wrapped around git so you could look there too.

-- 
 David


* - okay, I lied. It's PyQt4.  But it does run on OSX and looks just
like any other cocoa app.

```

## David Aguilar, 2008-04-29 07:02

Subject: Re: Git Library?
Message-ID: <402731c90804290002x3435e573i5e4d2fd08a84836c@mail.gmail.com>
URL: https://gitlist.dev/e/402731c90804290002x3435e573i5e4d2fd08a84836c%40mail.gmail.com
In-Reply-To: <402731c90804282358i205334b8me56f4390456873b4@mail.gmail.com>

```
>     http://repo.or.cz/ugit.git

Sorry, wrong url.

http://repo.or.cz/w/ugit.git

-- 
 David

```
