Skip to content
Browse files

getting rid of some erl warnings

  • Loading branch information...
1 parent f60fd7b commit 33c62606d9d5422922852df8dfc12f045e745638 @schacon committed
Showing with 15 additions and 13 deletions.
  1. +2 −2 src/git.erl
  2. +6 −4 src/git_object.erl
  3. +7 −7 src/packfile.erl
View
4 src/git.erl
@@ -37,11 +37,11 @@ rev_list(Git, [Sha|Shas], Gathered) ->
{ok, Commit} = commit(Git, Sha),
Parents = Commit#commit.parents,
rev_list(Git, Parents ++ Shas, [Sha|Gathered]);
-rev_list(Git, [], Gathered) ->
+rev_list(_Git, [], Gathered) ->
Gathered.
commit(Git, Sha) ->
- {Type, Size, Data} = read_object(Git, Sha),
+ {_Type, _Size, Data} = read_object(Git, Sha),
git_object:parse_commit(Data).
git_dir(Git) ->
View
10 src/git_object.erl
@@ -2,6 +2,8 @@
%% Git Object Parsers
%%
+%% TODO: replace regexp:first_match with re
+
-module(git_object).
-export([parse_commit/1]).
@@ -11,11 +13,11 @@ parse_commit(Data) ->
CommitString = binary_to_list(Data),
{match, Offset, Len} = regexp:first_match(CommitString, "\n\n"),
{Meta, Message} = lists:split(Offset + Len - 1, CommitString),
- Parents = parse_commit_parents(Meta),
- Tree = extract_one(Meta, "tree (.*)"),
- Author = extract_one(Meta, "author (.*)"),
+ Parents = parse_commit_parents(Meta),
+ Tree = extract_one(Meta, "tree (.*)"),
+ Author = extract_one(Meta, "author (.*)"),
Committer = extract_one(Meta, "committer (.*)"),
- Encoding = extract_one(Meta, "encoding (.*)"),
+ Encoding = extract_one(Meta, "encoding (.*)"),
%io:format("Parents:~p~nTree:~p~nAuthor:~p~nMessage:~p~n~n", [Parents, Tree, Author, Message]),
Commit = #commit{tree=Tree, parents=Parents,
author=Author, committer=Committer,
View
14 src/packfile.erl
@@ -52,9 +52,9 @@ read_object_data(_Git, IoDevice, 0, Size, _Shift, _OrigOffset, FileOffset, Norma
read_ref_deltified_object_data(Git, IoDevice, Size, Offset, FileOffset, OrigOffset) ->
{ok, Sha} = file:read(IoDevice, 20),
HexSha = hex:bin_to_hexstr(Sha),
- {TypeTerm, BaseSize, BaseData} = git:read_object(Git, HexSha),
+ {TypeTerm, _BaseSize, BaseData} = git:read_object(Git, HexSha),
%io:fwrite("Base:~p~n", [BaseSize]),
- {TypeTerm, DeltaSize, DeltaData} = read_object_data(Git, IoDevice, 0, Size, Offset, OrigOffset, FileOffset + 20, TypeTerm),
+ {TypeTerm, _DeltaSize, DeltaData} = read_object_data(Git, IoDevice, 0, Size, Offset, OrigOffset, FileOffset + 20, TypeTerm),
%io:fwrite("DeltaData: ~p:~p:~p~n", [TypeTerm, DeltaSize, DeltaData]),
PatchedData = patch_delta(DeltaData, BaseData),
{TypeTerm, length(PatchedData), list_to_binary(PatchedData)}.
@@ -63,7 +63,7 @@ read_ofs_deltified_object_data(Git, IoDevice, Size, Offset, FileOffset, OrigOffs
{ok, BaseOffset, BytesRead} = get_base_offset(IoDevice),
NewOffset = OrigOffset - BaseOffset,
%io:fwrite("BaseOffset: ~p:~p:~p~n", [NewOffset, OrigOffset, BaseOffset]),
- {TypeTerm, BaseSize, BaseData} = read_packfile_object_offset(Git, IoDevice, NewOffset),
+ {TypeTerm, _BaseSize, BaseData} = read_packfile_object_offset(Git, IoDevice, NewOffset),
file:position(IoDevice, FileOffset + BytesRead),
{TypeTerm, _DeltaSize, DeltaData} = read_object_data(Git, IoDevice, 0, Size, Offset, OrigOffset, FileOffset + BytesRead, TypeTerm),
%io:fwrite("DeltaData: ~p:~p:~p~n", [TypeTerm, DeltaSize, DeltaData]),
@@ -73,10 +73,10 @@ read_ofs_deltified_object_data(Git, IoDevice, Size, Offset, FileOffset, OrigOffs
patch_delta(DeltaData, BaseData) ->
DeltaList = binary_to_list(DeltaData),
BaseList = binary_to_list(BaseData),
- {ok, SrcSize, PosA} = patch_delta_header_size(DeltaList, 1),
+ {ok, _SrcSize, PosA} = patch_delta_header_size(DeltaList, 1),
% SrcSize should == BaseData.size
%io:fwrite("Patch:SrcSize : ~p:~p~n", [SrcSize, PosA]),
- {ok, DestSize, PosB} = patch_delta_header_size(DeltaList, PosA),
+ {ok, _DestSize, PosB} = patch_delta_header_size(DeltaList, PosA),
%io:fwrite("Patch:DestSize: ~p:~p~n", [DestSize, PosB]),
PatchedData = patch_delta([], BaseList, DeltaList, PosB, length(DeltaList) + 1),
%io:fwrite("PatchData: ~p~n", [length(PatchedData)]),
@@ -150,11 +150,11 @@ get_base_offset(_IoDevice, 0, Offset, BytesRead) ->
inflate_object_data(Z, IoDevice, SoFar) ->
case file:read(IoDevice, 4096) of
{ok, Bytes} ->
- Inflated = case catch zlib:inflate(Z, Bytes) of
+ _Inflated = case catch zlib:inflate(Z, Bytes) of
{'EXIT', {'data_error', _Backtrace} } ->
%io:format("zlib:inflate data_error,~n"),
SoFar;
- {'EXIT', Reason} ->
+ {'EXIT', _Reason} ->
%io:format("zlib:inflate error -> [~p]~n", [Reason]),
SoFar;
[] ->

0 comments on commit 33c6260

Please sign in to comment.
Something went wrong with that request. Please try again.