hit: Git operations

[ bsd3, development, program ] [ Propose Tags ]

Provides low level git operations


[Skip to Readme]
Versions [faq] 0.1.0, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.7.0
Dependencies attoparsec (<0.10), base (>=4 && <4.8), bytedump, bytestring, containers, cryptohash, directory, filepath, hashable, hashtables, HUnit, mtl, parsec (>=3), patience, QuickCheck (>=2), random, test-framework (>=0.3), test-framework-quickcheck2 (>=0.2), unix, vector, zlib, zlib-bindings (>=0.0.1 && <0.1) [details]
License BSD-3-Clause
Copyright Vincent Hanquez <vincent@snarc.org>
Author Vincent Hanquez <vincent@snarc.org>
Maintainer Vincent Hanquez <vincent@snarc.org>
Revised Revision 1 made by HerbertValerioRiedel at 2019-01-03T19:33:50Z
Category Development
Home page http://github.com/vincenthz/hit
Source repo head: git clone git://github.com/vincenthz/hit
Uploaded by VincentHanquez at 2011-12-15T09:09:41Z
Distributions Debian:0.6.3, NixOS:0.7.0
Executables Tests, Hit
Downloads 16163 total (46 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2016-12-26 [all 7 reports]

Modules

  • Data
    • Git
      • Data.Git.Delta
      • Data.Git.Index
      • Data.Git.Loose
      • Data.Git.Named
      • Data.Git.Object
      • Data.Git.Pack
      • Data.Git.Ref
      • Data.Git.Repository
      • Data.Git.Revision

Flags

NameDescriptionDefaultType
test

Build unit test

DisabledAutomatic
executable

Build the executable

DisabledAutomatic
debug

Add some debugging options

DisabledAutomatic

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for hit-0.2.0

[back to package description]
    Hit
    ===

Hit is a reimplementation of some git operations in pure haskell.

what it does do:

  • read loose objects, and packed objects.
  • write new loose objects
  • git like operations available: commit, cat-file, verify-pack, rev-list, ls-tree.

what is doesn't do:

  • reimplement the whole of git.
  • checkout's index reading/writing, fetching, merging, diffing.

The main functions for users are available from the Data.Git.Repository module.

The essential functions are:

  • withRepo: create a new git context and execute a function with the context. functional equivalent of withFile but for git repository.
  • resolveRevision: turns a git revision (e.g. HEAD, 0a24^^^~3) into a SHA1 reference.
  • resolvePath: from a commit ref and a path, it will gives the tree or blob reference of the object at the specific path (see example).
  • findObject: from a SHA1 reference, gives a high level object (Commit, Blob, Tree, Tag, Delta) from the git repository. if called with resolveDelta set, it will resolves deltas to be simple objects with the deltas applied.
  • findObjectRaw: similar to findObject but gives a raw representation (lazy bytestring) of the object.

API Example

resolving path of the README file and returning the reference to the blob :

{-# LANGUAGE OverloadedStrings #-}
import Data.Git.Repository

showPathRef commitRef = withRepo ".git" $ \git -> do
ref <- maybe (error "inexistent object at this path") id `fmap` resolvePath git commitRef ["README"]
    putStrLn ("README has the reference: " ++ show ref)

catting an object from a ref:

import Data.Git.Repository

catFile ref = withRepo ".git" $ \git -> do
obj <- maybe (error "not a valid object") id `fmap` findObjectRaw git ref True
    L.putStrLn (oiData obj)

more examples on how to use api can be found in Hit.hs.