# `GitModule`
[🔗](https://github.com/gtri/lowendinsight/blob/main/lib/git_module.ex#L5)

Collections of functions for interacting with the `git` command to perform queries.

# `clone_repo`

```elixir
@spec clone_repo(String.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
```

clone_repo/2: clones the repo

# `delete_repo`

```elixir
@spec delete_repo(
  atom()
  | %{
      :path =&gt;
        binary()
        | maybe_improper_list(
            binary() | maybe_improper_list(any(), binary() | []) | char(),
            binary() | []
          ),
      optional(any()) =&gt; any()
    }
) :: [binary()]
```

# `get_clean_contributions_map`

```elixir
@spec get_clean_contributions_map(Git.Repository.t()) :: {:ok, list()}
```

# `get_commit_dates`

```elixir
@spec get_commit_dates(Git.Repository.t()) :: {:ok, [non_neg_integer()]}
```

get_commit_dates/1: returns a list of unix timestamps representing commit times

# `get_contributions_map`

```elixir
@spec get_contributions_map(Git.Repository.t()) ::
  {:ok, [%{contributions: non_neg_integer(), name: String.t()}]}
```

get_contributions_map/1: returns a map of contributions per git user
note: this map is unfiltered, dupes aren't identified

# `get_contributor_count`

```elixir
@spec get_contributor_count(Git.Repository.t()) :: {:ok, non_neg_integer()}
```

get_contributors_count/1: returns the number of contributors for
a given Git repo

# `get_contributor_distribution`

```elixir
@spec get_contributor_distribution(Git.Repository.t()) ::
  {:ok, map(), non_neg_integer()}
```

# `get_contributors`

```elixir
@spec get_contributors(Git.Repository.t()) :: {:ok, [Contributor.t()]}
```

# `get_default_branch`

```elixir
@spec get_default_branch(Git.Repository.t()) :: {:ok, String.t()}
```

get_default_branch/1: returns the default branch of the remote repo

# `get_diff_2_commits`

```elixir
@spec get_diff_2_commits(Git.Repository.t(), [any()]) :: {:ok, [String.t()]} | []
```

get_last_n_commits/2: returns a list of lines generated from the diff of two commits

# `get_functional_contributors`

```elixir
@spec get_functional_contributors(Git.Repository.t()) ::
  {:ok, non_neg_integer(), [any()]}
```

# `get_hash`

```elixir
@spec get_hash(Git.Repository.t()) :: {:ok, String.t()}
```

get_current_hash/1: returns the hash of the repo's HEAD

# `get_last_2_delta`

```elixir
@spec get_last_2_delta(Git.Repository.t()) ::
  {:ok, non_neg_integer(), non_neg_integer(), non_neg_integer()}
```

get_last_2_delta/1: returns the lines changed, files changed, additions and deletions in the last commit

# `get_last_commit_date`

```elixir
@spec get_last_commit_date(Git.Repository.t()) :: {:ok, String.t()}
```

get_last_commit_date/1: returns the date of the last commit

# `get_last_contribution_date_by_contributor`

get_last_contribution_date_by_contributor/1: returns the date of the last author or commit whichever
is more recent.

# `get_last_n_commits`

```elixir
@spec get_last_n_commits(Git.Repository.t(), non_neg_integer()) :: {:ok, [any()]}
```

get_last_n_commits/1: returns a list of the short hashes of the last n commits

# `get_recent_changes`

```elixir
@spec get_recent_changes(Git.Repository.t()) :: {:ok, number(), number()}
```

get_recent_changes/1: returns the percentage of changed lines in the last commit by the total lines in the repo

# `get_repo`

```elixir
@spec get_repo(String.t()) :: {:ok, Git.Repository.t()} | {:error, String.t()}
```

get_repo/1: gets a repo by path, returns Repository struct

# `get_repo_size`

```elixir
@spec get_repo_size(Git.Repository.t()) :: {:ok, String.t()}
```

# `get_tag_and_commit_dates`

```elixir
@spec get_tag_and_commit_dates(Git.Repository.t()) :: {:ok, [[...]]}
```

get_tag_and_commit_dates/1: returns a list of lists of unix timestamps
representing commit times with each lsit belonging to a different tag

# `get_top10_contributors_map`

```elixir
@spec get_top10_contributors_map(Git.Repository.t()) :: {:ok, [any()]}
```

    get_top10_contributors_map/1: Gets the top 10 contributors and returns it
    as a list of contributors with the commits list stripped from the map.

# `get_total_commit_count`

get_total_commit_count/2: returns the count of commits for a provided branch

# `get_total_lines`

```elixir
@spec get_total_lines(Git.Repository.t()) ::
  {:ok, non_neg_integer(), non_neg_integer()}
```

get_total_lines/1: returns the total lines and files contained in a repo as of the latest commit

---

*Consult [api-reference.md](api-reference.md) for complete listing*
