On Tue, 18 Feb 2014 09:27:43 -0800 (PST)
mareb <mrebenti...@comparat.de> wrote:

> > Note that the Git developers perceive Git itself as being *a
> > library* 
> > -- not in the sense of it being a .so file with exported API but in
> > an "older" sense of presenting you with a collection of low-levels
> > sharp tools to call.  All executable files comprising Git are split
> > in two layers--"porcelain" and "plumbing"--with the former being
> > for interactive using and the latter--for usage by other programs.
> > So the programs in the plumbing layer have stable output formats
> > (or support special knobs allowing them to be tailored for the
> > needs of the calling program).  Projects like ikiwiki or gitolite
> > do exactly this and do not rely on a third-party library. 
> >
> Hello Konstantin,
> I did not saw, how to use the Git programs in a "low-level way". The
> Perl projects ikiwiki and gitolite does not help me, to understand,
> how to use the git programs with my C source.

That has nothing to do with Git or Perl, actually: you're supposed to
use whatever is made available by your compiler/libraries/runtime to
run a process and communicate with it using its standard input and
output streams (and exit code).  With plain C it's popen() or a
combination of fork(), exec() and pipe() (that's for POSIX; on other
platforms like Windows you're supposed to use their respective APIs).

If you're doing hardcore C (that is, not assisted with general-purpose
libraries like glib or libapr) you're expected to code the interaction
by hand.  Git does exactly this internally--you could start from reading
the start_command() function in run-command.c and, say, submodule.c for
an example of its usage (actually, running `git grep -Fw start_command`
on the Git's source code checkout yields tons of examples).
If you're using a general-purpose system abstraction library then it
usually comes equipped with the stuff necessary to spawn a process and
communicate with it.

I understand that doing this in C is hard, but doing everything in C is

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to