Commit 5811276a817f8dce7701facf80169e077d5b5008

Thomas de Grivel 2022-01-13T11:21:09

fix repository show

diff --git a/lib/kmxgit_web/templates/repository/show_branch.html.heex b/lib/kmxgit_web/templates/repository/show_branch.html.heex
index f850afa..9b82325 100644
--- a/lib/kmxgit_web/templates/repository/show_branch.html.heex
+++ b/lib/kmxgit_web/templates/repository/show_branch.html.heex
@@ -1,17 +1,19 @@
-<hr/>
-<%= if Enum.find(@git.branches, fn {name, _} -> name == @branch end) do %>
-  <%= gettext("Branch") %>
-  <%= select :repository, :branch, @git.branches, selected: @branch_url, onchange: "javascript:document.location = this.value;" %>
-<% else %>
-  <%= if String.length(@branch) == 40 do %>
-    <h2>
-      <%= gettext("Commit") %>
-      <%= @branch %>
-    </h2>
+<%= if @branch do %>
+  <hr/>
+  <%= if Enum.find(@git.branches, fn {name, _} -> name == @branch end) do %>
+    <%= gettext("Branch") %>
+    <%= select :repository, :branch, @git.branches, selected: @branch_url, onchange: "javascript:document.location = this.value;" %>
   <% else %>
-    <h2>
-      <%= gettext("Tag") %>
-      <%= @branch %>
-    </h2>
+    <%= if String.length(@branch) == 40 do %>
+      <h2>
+        <%= gettext("Commit") %>
+        <%= @branch %>
+      </h2>
+    <% else %>
+      <h2>
+        <%= gettext("Tag") %>
+        <%= @branch %>
+      </h2>
+    <% end %>
   <% end %>
 <% end %>