Commit 92b998f4aebfc80731b5ec1f799fc3defbfcf07f

Thomas de Grivel 2022-01-22T09:35:01

fix git manager files

diff --git a/lib/kmxgit/git_manager.ex b/lib/kmxgit/git_manager.ex
index 54518f0..fab0344 100644
--- a/lib/kmxgit/git_manager.ex
+++ b/lib/kmxgit/git_manager.ex
@@ -58,11 +58,14 @@ defmodule Kmxgit.GitManager do
         |> String.split("\n")
         |> Enum.reject(&(&1 == ""))
         |> Enum.map(fn line ->
-          [stat, name] = String.split(line, "\t")
-          [mode, type, sha1] = String.split(stat, " ")
-          url = "#{parent}/#{name}"
-          %{mode: mode, name: name, sha1: sha1, type: type, url: url}
+          case String.split(line, "\t") do
+            [stat, name] ->
+              [mode, type, sha1] = String.split(stat, " ")
+              url = "#{parent}/#{name}"
+              %{mode: mode, name: name, sha1: sha1, type: type, url: url}
+            _ -> nil
         end)
+        |> Enum.reject(&(&1 == nil))
         case list do
           [%{name: ^path1, sha1: sha1, type: "tree"}] ->
             files(repo, sha1, "", "#{parent}/#{path1}")