Commit a74397772088af583060035215d8e383eeb12ed1

Thomas de Grivel 2024-03-19T07:33:40

fix bug with log

diff --git a/lib/kmxgit/git.ex b/lib/kmxgit/git.ex
index 15cbe8f..11ea6f2 100644
--- a/lib/kmxgit/git.ex
+++ b/lib/kmxgit/git.ex
@@ -156,7 +156,7 @@ defmodule Kmxgit.Git do
     dir = git_dir(repo)
     # [%{author: author, author_email: email, hash: hash, date: date, message: msg}]
     #IO.inspect({:log_nif, dir, tree, path, skip, limit})
-    log_nif(dir, tree, path, skip, limit) || []
+    log_nif(dir, tree, path, skip, limit)
   end
 
   def log_nif(_repo, _tree, _path, _skip, _limit) do
diff --git a/lib/kmxgit_web/controllers/repository_controller.ex b/lib/kmxgit_web/controllers/repository_controller.ex
index 05c251c..f2c8238 100644
--- a/lib/kmxgit_web/controllers/repository_controller.ex
+++ b/lib/kmxgit_web/controllers/repository_controller.ex
@@ -644,9 +644,13 @@ defmodule KmxgitWeb.RepositoryController do
               Logger.error(inspect(reason))
               nil
           end
-    emails = Enum.map(log, & &1.author_email) |> Enum.uniq()
-    %{git | log: log}
-    |> git_add_user_emails(emails)
+    if log do
+      emails = Enum.map(log, & &1.author_email) |> Enum.uniq()
+      %{git | log: log}
+      |> git_add_user_emails(emails)
+    else
+      git
+    end
   end
 
   defp git_put_content(git = %{files: [%{name: name, sha1: sha1, type: :blob}], valid: true}, repo, path) do