Michael Michael - 1 month ago 14
Git Question

Create Merge Request Not Working in Gitlab

I just pushed a new branch "TEST" and Gitlab has the button to create a new merge request. When I click it though, it takes me to a page that asks me to select the source, and what it should be merged into.

The problem is the only branch in the source is master. The TEST branch is not there.

I can however see the TEST branch on the branches tab on the repository page.

Any ideas?

Answer Source

I experienced exactly the same problem today, and found the workaround that works perfectly for me: https://github.com/gitlabhq/gitlabhq/issues/4100#issuecomment-18669303

This issue is around caching branch lists in redis, disabling cache in the code fixes it.

diff --git a/app/models/repository.rb b/app/models/repository.rb
index daf1765..ff683e6 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -34,9 +34,9 @@ class Repository
   end

   def branch_names
-    Rails.cache.fetch(cache_key(:branch_names)) do
+#    Rails.cache.fetch(cache_key(:branch_names)) do
       raw_repository.branch_names
-    end
+#    end
   end

   def tag_names