aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkballou <kballou@devnulllabs.io>2017-02-08 19:48:24 -0700
committerkballou <kballou@devnulllabs.io>2017-02-08 19:48:24 -0700
commit557ef577085017887cfbc8bcc8445b719a78cf95 (patch)
tree31ec88be55288a7b83e6603b7eca9188832d1914 /lib
parentfefd791ed686d9dd0f5551be4c0c339b14998051 (diff)
downloadexgit-557ef577085017887cfbc8bcc8445b719a78cf95.tar.gz
exgit-557ef577085017887cfbc8bcc8445b719a78cf95.tar.xz
WIP: initial packfile parser
Diffstat (limited to 'lib')
-rw-r--r--lib/exgit/packfile.ex13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/exgit/packfile.ex b/lib/exgit/packfile.ex
index 4fda345..3823259 100644
--- a/lib/exgit/packfile.ex
+++ b/lib/exgit/packfile.ex
@@ -2,4 +2,17 @@ defmodule Exgit.Packfile do
@moduledoc """
Module for parsing Git Packfiles
"""
+
+ @spec parse_header(binary) :: {:pack, 2|3, integer}
+ def parse_header(packfile) do
+ <<"PACK" :: utf8, 2 :: size(32), n :: size(32)>> <> rest = packfile
+ {:pack, 2, n, rest}
+ end
+
+ @spec parse_objects(integer, binary) :: [{:commit|:blob|:tree,
+ binary,
+ binary}]
+ def parse_objects(n, pack) do
+ nil
+ end
end