Skip to content

Commit

Permalink
Merge pull request #3 from samoht/pack
Browse files Browse the repository at this point in the history
Preparing the release 1.0
  • Loading branch information
samoht committed Feb 10, 2014
2 parents 9a31d75 + 9321863 commit cbf1864
Show file tree
Hide file tree
Showing 70 changed files with 4,419 additions and 3,115 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
_build/
*~
\#*
.#*
setup.log
setup.data
*.native
*.dot
*.dot
lib_test/_tests/
_tests/
12 changes: 8 additions & 4 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
0.10.3:
* `ogit clone` now correctly set-up the index file (whic means
that `git status` and `git diff` will not work as expected
1.0.0:
* Support for reading and writing pack indexes
* Support for reading and writing pack files
* Refactor the API: each Git object has now its own file,
with a consistent signature
* `ogit clone` now correctly set-up the cache file (which means
that `git status` and `git diff` will now work as expected
on a repository created by `ogit`)
* Add `ogit read-tree COMMIT`
* Add `ogit ls-files [--all]`
* Support for reading and writing index files
* Support for reading and writing cache files

0.10.2: (2014-01-20)
* Strip the contents of references file
Expand Down
57 changes: 32 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

Pure OCaml low-level bindings to Git -- Guaranteed no C inside.

Support for on-disk and in-memory Git stores.
Support for on-disk and in-memory Git stores. Can read and write all
the Git objects: the usual blobs, trees, commits and tags but also the
pack files, pack indexes and the index file (where the staging area
lives).

All the objects share a consistent API, and convenience functions are
provided to manipulate the different objects. For instance, it is
possible to make a pack file position independant (as the Zlib
compression might change the relative offsets between the packed
objects), to generate pack indexes from pack files, or to expand
the filesystem of a given commit.

[![Build Status](https://travis-ci.org/samoht/ocaml-git.png?branch=master)](https://travis-ci.org/samoht/ocaml-git)


### Build and Install Instructions

To build the project, simply run:
Expand Down Expand Up @@ -42,31 +51,29 @@ Well, actually, not really. Performance is comparable to the
usual `git` command.

```
$ time git clone https://github.com/mirage/cowabloga xxx1
Cloning into 'xxx1'...
remote: Reusing existing pack: 616, done.
remote: Total 616 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (616/616), 629.00 KiB | 347.00 KiB/s, done.
Resolving deltas: 100% (383/383), done.
Checking connectivity... done
real 0m3.348s
user 0m0.123s
sys 0m0.074s
$ time ogit clone git://github.com/ocaml/opam-repository
Cloning into 'opam-repository' ...
Receiving data ... done.
Resolving deltas: 100% (37294/37294), done.
remote: Counting objects: 37294, done.
Checking out files: 100% (6527/6527), done.
HEAD is now at 267e08725291fc61b8411c0f20553ddd2e246d4f
real 0m22.522s
user 0m4.954s
sys 0m5.078s
```

```
$ time ogit clone https://github.com/mirage/cowabloga xxx2
https://github.com/mirage/cowabloga xxx2
Cloning into 'xxx2' ...
Receiving objects: 100% (616/616), done.
remote: Counting objects: 616, done.
$ time git clone git://github.com/ocaml/opam-repository
Cloning into 'opam-repository'...
remote: Reusing existing pack: 37868, done.
remote: Total 37868 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (37868/37868), 5.41 MiB | 408.00 KiB/s, done.
Resolving deltas: 100% (13973/13973), done.
Checking connectivity... done
real 0m2.850s
user 0m0.554s
sys 0m0.232s
real 0m17.409s
user 0m1.198s
sys 0m0.925s
```

Remark: currently, `ogit clone` will unpack all the loose objects.
This is pretty inefficient. The usual `git clone` simply download
the pack file and unpack it on-demand.
8 changes: 3 additions & 5 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
* GitRemote.pull/fetch
* Handling of the staging area
* Index file
* Read pack file without decompressing it
* More tests
* push
* generation of a compact pack files from a collection of object files
* git server
80 changes: 50 additions & 30 deletions _oasis
Original file line number Diff line number Diff line change
@@ -1,48 +1,68 @@
OASISFormat: 0.3
OASISFormat: 0.4
Name: git
Version: 0.10.3
Version: 1.0.0
Synopsis: A low-level interface to Git in pure OCaml
Authors: Thomas Gazagnaire
License: ISC
Plugins: META (0.3), DevFiles (0.3)
BuildTools: ocamlbuild

Flag unix
Description: build the Unix library
Default: true
Description: build the Unix libraries
Default: true

Library git
Path: lib/
Findlibname: git
Modules: GitMisc, GitTypes, Git, GitRemote, GitGraph, GitMemory
BuildDepends: mstruct, dolog, core_kernel, ocamlgraph, lazy-trie,
re.pcre, zip, cryptokit, uri, lwt,
bin_prot.syntax, comparelib.syntax, sexplib.syntax
Pack: true
Path: lib/
Findlibname: git
Modules: SHA1, Blob, Cache, Commit, Misc,
Output, Pack, Pack_index, Packed_value,
Reference, Remote, Tag, Tree, User, Value,
Object, Object_type, Store, Search
BuildDepends: mstruct, dolog, core_kernel, ocamlgraph, lazy-trie,
re.pcre, zip, cryptokit, uri, lwt,
bin_prot.syntax, comparelib.syntax, sexplib.syntax

Library "git-memory"
Path: lib/
FindlibParent: git
Findlibname: memory
Modules: Git_memory
BuildDepends: git

Library "git-unix"
Path: lib/
FindlibParent: git
Findlibname: unix
Modules: GitLocal, GitUnix
BuildDepends: git, lwt.unix
Build$: flag(unix)
Path: lib/
FindlibParent: git
Findlibname: unix
Modules: Git_unix
BuildDepends: git, lwt.unix

Library "git-fs"
Build$: flag(unix)
Path: lib/
FindlibParent: git
Findlibname: fs
Modules: Git_fs
BuildDepends: git, git.unix

Executable ogit
Path: lib/
MainIs: gitMain.ml
Build$: flag(unix)
CompiledObject: best
Install: true
BuildDepends: cmdliner, git.unix
Build$: flag(unix)
Path: bin/
MainIs: ogit.ml
CompiledObject: best
Install: true
BuildDepends: cmdliner, git, git.unix, git.memory, git.fs

Executable test_git
Path: lib_test
MainIs: test.ml
Build$: flag(tests) && flag(unix)
CompiledObject: best
Install: false
BuildDepends: git.unix, alcotest
Build$: flag(tests) && flag(unix)
Path: lib_test
MainIs: test.ml
CompiledObject: best
Install: false
BuildDepends: alcotest, git, git.memory, git.fs

Test test_git
Run$: flag(tests)
Command: $test_git -q
WorkingDirectory: lib_test/
Run$: flag(tests)
Command: $test_git -q
WorkingDirectory: lib_test/
87 changes: 67 additions & 20 deletions _tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: bfe4d4f26b6640eb36909e0de2a8c716)
# DO NOT EDIT (digest: 1e87135d554e4f8fad901a3af51fbfd5)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
Expand All @@ -15,29 +15,33 @@
"_darcs": not_hygienic
# Library git
"lib/git.cmxs": use_git
"lib/SHA1.cmx": for-pack(Git)
"lib/blob.cmx": for-pack(Git)
"lib/cache.cmx": for-pack(Git)
"lib/commit.cmx": for-pack(Git)
"lib/misc.cmx": for-pack(Git)
"lib/output.cmx": for-pack(Git)
"lib/pack.cmx": for-pack(Git)
"lib/pack_index.cmx": for-pack(Git)
"lib/packed_value.cmx": for-pack(Git)
"lib/reference.cmx": for-pack(Git)
"lib/remote.cmx": for-pack(Git)
"lib/tag.cmx": for-pack(Git)
"lib/tree.cmx": for-pack(Git)
"lib/user.cmx": for-pack(Git)
"lib/value.cmx": for-pack(Git)
"lib/object.cmx": for-pack(Git)
"lib/object_type.cmx": for-pack(Git)
"lib/store.cmx": for-pack(Git)
"lib/search.cmx": for-pack(Git)
# Library git-memory
"lib/git-memory.cmxs": use_git-memory
# Library git-unix
"lib/git-unix.cmxs": use_git-unix
# Executable ogit
<lib/gitMain.{native,byte}>: use_git-unix
<lib/gitMain.{native,byte}>: use_git
<lib/gitMain.{native,byte}>: pkg_cmdliner
<lib/gitMain.{native,byte}>: pkg_lwt.unix
<lib/gitMain.{native,byte}>: pkg_mstruct
<lib/gitMain.{native,byte}>: pkg_dolog
<lib/gitMain.{native,byte}>: pkg_core_kernel
<lib/gitMain.{native,byte}>: pkg_ocamlgraph
<lib/gitMain.{native,byte}>: pkg_lazy-trie
<lib/gitMain.{native,byte}>: pkg_re.pcre
<lib/gitMain.{native,byte}>: pkg_zip
<lib/gitMain.{native,byte}>: pkg_cryptokit
<lib/gitMain.{native,byte}>: pkg_uri
<lib/gitMain.{native,byte}>: pkg_lwt
<lib/gitMain.{native,byte}>: pkg_bin_prot.syntax
<lib/gitMain.{native,byte}>: pkg_comparelib.syntax
<lib/gitMain.{native,byte}>: pkg_sexplib.syntax
# Library git-fs
"lib/git-fs.cmxs": use_git-fs
<lib/*.ml{,i}>: use_git-unix
<lib/*.ml{,i}>: use_git
<lib/*.ml{,i}>: pkg_cmdliner
<lib/*.ml{,i}>: pkg_lwt.unix
<lib/*.ml{,i}>: pkg_mstruct
<lib/*.ml{,i}>: pkg_dolog
Expand All @@ -52,8 +56,49 @@
<lib/*.ml{,i}>: pkg_bin_prot.syntax
<lib/*.ml{,i}>: pkg_comparelib.syntax
<lib/*.ml{,i}>: pkg_sexplib.syntax
# Executable ogit
<bin/ogit.{native,byte}>: use_git-fs
<bin/ogit.{native,byte}>: use_git-unix
<bin/ogit.{native,byte}>: use_git-memory
<bin/ogit.{native,byte}>: use_git
<bin/ogit.{native,byte}>: pkg_cmdliner
<bin/ogit.{native,byte}>: pkg_lwt.unix
<bin/ogit.{native,byte}>: pkg_mstruct
<bin/ogit.{native,byte}>: pkg_dolog
<bin/ogit.{native,byte}>: pkg_core_kernel
<bin/ogit.{native,byte}>: pkg_ocamlgraph
<bin/ogit.{native,byte}>: pkg_lazy-trie
<bin/ogit.{native,byte}>: pkg_re.pcre
<bin/ogit.{native,byte}>: pkg_zip
<bin/ogit.{native,byte}>: pkg_cryptokit
<bin/ogit.{native,byte}>: pkg_uri
<bin/ogit.{native,byte}>: pkg_lwt
<bin/ogit.{native,byte}>: pkg_bin_prot.syntax
<bin/ogit.{native,byte}>: pkg_comparelib.syntax
<bin/ogit.{native,byte}>: pkg_sexplib.syntax
<bin/*.ml{,i}>: use_git-fs
<bin/*.ml{,i}>: use_git-unix
<bin/*.ml{,i}>: use_git-memory
<bin/*.ml{,i}>: use_git
<bin/*.ml{,i}>: pkg_cmdliner
<bin/*.ml{,i}>: pkg_lwt.unix
<bin/*.ml{,i}>: pkg_mstruct
<bin/*.ml{,i}>: pkg_dolog
<bin/*.ml{,i}>: pkg_core_kernel
<bin/*.ml{,i}>: pkg_ocamlgraph
<bin/*.ml{,i}>: pkg_lazy-trie
<bin/*.ml{,i}>: pkg_re.pcre
<bin/*.ml{,i}>: pkg_zip
<bin/*.ml{,i}>: pkg_cryptokit
<bin/*.ml{,i}>: pkg_uri
<bin/*.ml{,i}>: pkg_lwt
<bin/*.ml{,i}>: pkg_bin_prot.syntax
<bin/*.ml{,i}>: pkg_comparelib.syntax
<bin/*.ml{,i}>: pkg_sexplib.syntax
# Executable test_git
<lib_test/test.{native,byte}>: use_git-fs
<lib_test/test.{native,byte}>: use_git-unix
<lib_test/test.{native,byte}>: use_git-memory
<lib_test/test.{native,byte}>: use_git
<lib_test/test.{native,byte}>: pkg_alcotest
<lib_test/test.{native,byte}>: pkg_lwt.unix
Expand All @@ -70,7 +115,9 @@
<lib_test/test.{native,byte}>: pkg_bin_prot.syntax
<lib_test/test.{native,byte}>: pkg_comparelib.syntax
<lib_test/test.{native,byte}>: pkg_sexplib.syntax
<lib_test/*.ml{,i}>: use_git-fs
<lib_test/*.ml{,i}>: use_git-unix
<lib_test/*.ml{,i}>: use_git-memory
<lib_test/*.ml{,i}>: use_git
<lib_test/*.ml{,i}>: pkg_alcotest
<lib_test/*.ml{,i}>: pkg_lwt.unix
Expand Down
Loading

0 comments on commit cbf1864

Please sign in to comment.