Skip to content

Commit

Permalink
Add GitRekt.Pack.create/2
Browse files Browse the repository at this point in the history
See issue #1 for more details.
  • Loading branch information
redrabbit committed Dec 1, 2017
1 parent 43f6d3d commit b325cd8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/gitrekt/lib/gitrekt/pack.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ defmodule GitRekt.Pack do
@type obj_type :: :commit | :tree | :blob | :tag

@doc """
Returns a list of ODB objects and their type for the given pack file `data`.
Returns a *PACK* file for the given `oid`.
"""
@spec create(Git.repo, Git.oid) :: binary
def create(repo, oid) do
with {:ok, walk} <- Git.revwalk_new(repo),
:ok <- Git.revwalk_push(walk, oid),
{:ok, pack} = Git.revwalk_pack(walk), do: pack
end

@doc """
Returns a list of ODB objects and their type for the given *PACK* file `data`.
"""
@spec extract(2, non_neg_integer, binary) :: {[obj], binary}
def extract(2 = _version, count, data) do
Expand Down

0 comments on commit b325cd8

Please sign in to comment.