anchor.diff:          "GIT_DIR=~s git archive heads/~s |tar -x -C ~s",
           [Package, Branch, ExportPath]
       ),
  -    case os:cmd(ExportBranch) of
  +    case command(ExportBranch) of
           [] -> ok;
           Error -> {error, Error}
       end.
  
positive.code: 
  get_branches(_State, Package) ->
      GetBranches = format("GIT_DIR=~s git branch", [Package]),
      case os:cmd(GetBranches) of
          "fatal:" ++ Error ->
              {error, Error};
          Result ->
              {ok, [string:strip(Branch, both, $ ) || Branch <- string:tokens(Result, "\n")]}
      end.
  
  
  get_diff(_State, Package, _Branch, Revno, NewRevno) when Revno == none; Revno == error ->
      Revisions = os:cmd(format("GIT_DIR=~s git rev-list --all", [Package])),
      First = lists:last(string:tokens(Revisions, "\n")),
      DiffCmd = format("GIT_DIR=~s git diff ~s ~s", [Package, First, NewRevno]),
      case os:cmd(DiffCmd) of
          "error" ++ _ = Error -> {error, Error};
          Result ->
              Len = length(Result),
              if
                  Len > 10240 -> {ok, list_to_binary(string:sub_string(Result, 1, 10240))};
                  true -> {ok, list_to_binary(Result)}
              end
      end;
  
  
  get_diff(_State, Package, _Branch, OldRevno, NewRevno) ->
      DiffCmd = format("GIT_DIR=~s git diff ~s ~s", [Package, OldRevno, NewRevno]),
      case os:cmd(DiffCmd) of 
          "error" ++ _ = Error -> {error, Error};
          Diff ->
              Len = length(Diff),
              if
                  Len > 10240 -> {ok, list_to_binary(string:sub_string(Diff, 1, 10240))};
                  true -> {ok, list_to_binary(Diff)}
              end
      end.
  
  
  get_changelog(_State, Package, _Branch, Revno, NewRevno) when Revno == none; Revno == error ->
      LogCmd = format("GIT_DIR=~s git log ~s", [Package, NewRevno]),
      case os:cmd(LogCmd) of
          Log when Log > 10240 -> {ok, list_to_binary(string:sub_string(Log, 1, 10240))};
          Log -> {ok, list_to_binary(Log)}
      end;
  
  get_changelog(_State, Package, _Branch, OldRevno, NewRevno) ->
      LogCmd = format("GIT_DIR=~s git log ~s..~s", [Package, OldRevno, NewRevno]),
      case os:cmd(LogCmd) of
          Log when Log > 10240 -> {ok, list_to_binary(string:sub_string(Log, 1, 10240))};
          Log -> {ok, list_to_binary(Log)}
      end.
  
  
  get_tag(_State, Package, _Branch, NewRevno) ->
      TagCmd = format("GIT_DIR=~s git describe --exact-match ~s 2> /dev/null", [Package, NewRevno]),
      case os:cmd(TagCmd) of
          [] -> {ok, none};
          Tag -> {ok, string:strip(Tag, right, $\n)}
      end.
  
negative.code: 
  is_branch(_State, Package, Branch) ->
      IsBranch = format("GIT_DIR=~s git rev-parse heads/~s 1> /dev/null", [Package, Branch]),
      case command(IsBranch) of
          {ok, <<>>} -> true;
          {error, Error} ->
              error_logger:info_msg("not a branch: ~s~n", [Error]),
              false
      end.
  