哪种语言具有最好的 Git API 绑定? [英] Which language has the best Git API Bindings?

查看:20
本文介绍了哪种语言具有最好的 Git API 绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑构建一个与 git 关系密切的应用程序..

I am looking at building an application with heavy ties to git..

是否有可用的语言绑定?如果有,哪些是最全面的?

Are there language bindings available and if so which are the most comprehensive?

这是否意味着要去 Bare Metal C?

Would it mean going to Bare Metal C?

还是 perl/python/php/C# 有一套完整的绑定?

Or does perl / python / php / C# have a set of full bindings?

谢谢

丹尼尔

推荐答案

在某些编程语言中使用 Git 有三种不同的方法:

There are three different approaches with respect to using Git from within some programming language:

  • 以不同语言重新实现的 Git.这就是以下项目所做的:

  • Reimplementation of Git in different language. That is what the following projects do:

  • JGit 这是用 Java 重新实现的 Git(用于其他通过 EGitEclipse Git 插件,以及 Gerrit Code Review)、
  • Grit 是一个 Ruby 库,用于从对象的 git 存储库中提取信息面向方式,包括部分原生 Ruby 实现.使用例如来自 GitHub.
  • GitSharp 这是在 C# 中为 .NET 和 Mono 重新实现的 Git,并且正在关注 JGit wrt.功能,
  • Dulwich 这是 Git 文件格式和协议的纯 Python 读写实现.
  • Git::PurePerl 是 Git 存储库的纯 Perl 接口(它主要基于 Grit,最初).
  • Glip 是PHP 中的 git 库"——纯 PHP 实现.由其作者用于 eWiki.
  • NGit Monodevelop 使用的 JGit .NET 端口
  • JGit which is reimplementation of Git in Java (used among others by EGit, the Eclipse Git plugin, and Gerrit Code Review),
  • Grit is Ruby library for extracting information from a git repository in an object oriented manner, which includes a partial native Ruby implementation. Used e.g. by GitHub.
  • GitSharp which is remplemantation of Git in C# for .NET and Mono, and which is following JGit wrt. functionality,
  • Dulwich which is pure-Python read-write implementation of the Git file formats and protocols.
  • Git::PurePerl is pure Perl interface to Git repositories (it was mostly based on Grit, initially).
  • Glip is "git library in PHP" - pure PHP implementation. Used by its author for eWiki.
  • NGit .NET port of JGit used by Monodevelop


重新实现的问题在于它们并不总是实现完整的功能,有时会错误地实现.另一方面,它们是原生的,实现良好的性能;它们的许可可能不同于 Git 的 C(原始)实现,即 GPLv2.


The problem with reimplementations is that they do not always implement the full functionality, and sometimes implement it wrong. On the other hand they are native, implement good performance; they may be licensed differently than C (original) implementation of Git, which is GPLv2.

包装器调用 Git 命令并将其包装成某种适合目标语言的结果.

Wrappers which call Git commands and wrap result it in some kind, suitably for target language.

  • 与 git 一起分发的 Git.pm 模块(并被它的一些命令使用)、Git::WrapperGit::Repository 为 Perl 包装 git 命令.
  • JavaGit 是一个 Java API,通过调用 git 命令提供对 git 存储库的访问.
  • GitPython 是一个 Python 库,用于与 Git 存储库交互,通过调用 Git 可执行文件和解析输出.
  • hs-libgit 是 git 的 Haskell 包装器.
  • The Git.pm module distributed with git (and used by some of its commands), Git::Wrapper and Git::Repository wrap git commands for Perl.
  • JavaGit is a Java API that provides access to git repositories via calling git commands.
  • GitPython is a Python library used to interact with Git repositories, by calling the Git executables and parsing output.
  • hs-libgit is Haskell wrapper for git.


包装器的问题在于它们可能很慢(它们需要派生一个 git 进程),并且它们需要安装 git 才能工作.


The problem with wrappers is that they can be slow (they require forking a git process), and that they require git to be installed to work.

还要注意 git 本身是高度可编写脚本的(例如使用 shell 脚本),这要归功于除了面向最终用户(瓷器)的高级命令之外,它还提供用于编写​​脚本的低级命令(管道).

Note also that git itself is highly scriptable (e.g. using shell scripts), thanks to the fact that beside higher level commands meant for end user (porcelain) it also provides low level commands meant for scripting (plumbing).

最后是绑定到 libgit2,这意味着是具有可靠 API 的可重入可链接库(是 Google Summer of Code 2010 项目).

Finally there are bindings to libgit2, which means to be re-entrant linkable library with a solid API (was Google Summer of Code 2010 project).

  • libgit2 本身是一个可移植的纯 C 实现.
  • Rugged - Ruby 绑定.
  • php-git - PHP 绑定.
  • luagit2 - Lua 绑定.
  • GitForDelphi - Delphi 绑定.
  • libgit2sharp - .NET 绑定.
  • pygit2 - Python 绑定.
  • Geef 是一个简单的 Erlang NIF,它向 Erlang 公开了一些 libgit2 库函数.Monodevelop 为 JGit 使用 .NET 端口
  • libgit2 itself is a portable, pure C implementation.
  • Rugged - Ruby bindings.
  • php-git - PHP bindings.
  • luagit2 - Lua bindings.
  • GitForDelphi - Delphi bindings.
  • libgit2sharp - .NET bindings.
  • pygit2 - Python bindings.
  • Geef is a simple Erlang NIF that exposes some of the libgit2 library functions to Erlang. Monodevelop uses a .NET port for JGit


Libgit2 是一个相当新的项目;这是正在进行的工作,因此并非所有事情都在当时实施.有关详细信息,请参阅 libgit2 主页.

所有这些信息都可以在 Git 的 InterfacesFrontendsAndTools 页面上找到维基

All this information can be found at InterfacesFrontendsAndTools page on Git Wiki

这篇关于哪种语言具有最好的 Git API 绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆