defmodule Mix.Tasks.Gitgud.BackfillRoots do
@moduledoc """
Index every repository's root commits into `repository_roots`.
New repos get indexed on creation (forks/clones) or first push, so
this is only needed once, for repos that predate the table.
mix gitgud.backfill_roots
"""
@shortdoc "Index root commits for every repository"
use Mix.Task
@impl true
def run(_args) do
Mix.Task.run("app.start")
GitGud.Repositories.Repository
|> GitGud.Repo.all()
|> Enum.each(fn repo ->
shas = GitGud.Repositories.refresh_root_commits(repo)
Mix.shell().info("#{repo.disk_path}: #{length(shas)} root(s)")
end)
end
end
neiam /gitgud
Git Gud
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Packages
⭐
Log in to mark this repository.
668 B · text
History
8753207