As you all know that git-svn on windows is a CPU hog, due to extensive
fork/exec. I want to then write a binding for the git functions, such
that we can use them without fork/exec. I did some experiments last
night, but there are still some problems I can't solve.

Rationale:
Most of git commands (builtins) are implemented in functions cmd_*.
Calling the binding of these cmd_* functions would be equivalent to
invocation of the corresponding git commands, which makes the
transition from current implementation of git-svn and Git.pm easy.

Problem:
Some cmd_* output the information to STDOUT, so the only way to get
the results is redirecting the STDOUT to anther file. I googled online
and found a couple of ways to redirect STDOUT in perl, but none of
them works for cmd_*, they do work for pure perl functions though.

Resolution:
a). Find a way to redirect STDOUT in cmd_* to a file or ideally to a
variable or to an in-memory file.
b). modify git source to add a hook for redirection of STDOUT.

What I did is:
1) rename die() to git_die() because this one conflicts with the perl
builtin function.
2) use swig [0] to create the perl binding to all builtin cmds.
3) test the perl binding.

Any comments?

[0] http://www.swig.org/

Reply via email to