Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell library to manipulate a git repo

Tags:

I am writing an application in Haskell that will have to perform basic operations on Git repositories (add, log, push, pull, fetch, diff etc.)

What are my options here (are there any apart from invoking shell commands from Haskell)? I could not find any good leads on Hackage.

like image 582
Anupam Jain Avatar asked Jul 07 '11 11:07

Anupam Jain


People also ask

Does git use libgit2?

libgit2 is used to power Git GUI clients like GitKraken and gmaster and on Git hosting providers like GitHub, GitLab and Azure DevOps.

What is git sync command?

git-sync is a simple command that pulls a git repository into a local directory. It is a perfect "sidecar" container in Kubernetes - it can periodically pull files down from a repository so that an application can consume them. git-sync can pull one time, or on a regular interval.

Which command is used for creating repositories?

To create a new repo, you'll use the git init command. git init is a one-time command you use during the initial setup of a new repo. Executing this command will create a new . git subdirectory in your current working directory.

What should I not store in git?

You shouldn't store credentials like usernames, passwords, API keys and API secrets. If someone else steals your credentials, they can do nasty things with it.


2 Answers

There are many good libraries for interacting with Git available on Hackage:

  • git-object - parser and types for git objects
  • darcs-fastconvert - tools for importing from git
  • ght - trivial git interaction
  • libgit - simple git wrapper
  • hlibgit2 - full bindings to libgit2
  • gitit - wiki based on git
  • filestore - high level file-based interface to DVCS (git, darcs, etc).

You should be able to get started with these packages.

like image 124
Don Stewart Avatar answered Sep 27 '22 21:09

Don Stewart


Better than hlibgit2 is gitlib, which is a high-level set of type wrappers around the functionality of hlibgit2, designed for laziness, performance, and to suit a Haskell mindset.

like image 21
John Wiegley Avatar answered Sep 27 '22 21:09

John Wiegley