redmine-git-hosting/redmine_git_hosting

New repository in Git Hosting.

parrier82 opened this issue · 10 comments

In Storage Config, I can see like this.

image

Surely, It said to me repository exists in gitolite,

image

But.. I can see like this ( Repository is empty ) . What is the problem??

push funcsion is also working..

pva commented

I don't see any problem here. Could you elaborate your question/problem?

I face very probably the same problem:

  1. Create an empty git repository.
  2. Clone the empty repository.
  3. Add a file, git add, commit, push.
  4. Click on the Repository tab and you see a warning message "Repository is empty"

Simply, the GUI doesn't reflect new commits in the repository, changesets aren't fetched.

I've tried took a bit deeper into the problem and it seems to be related to the following code. If a new Gitolite repo is created, the variable extra_info is set to {}. After a push to the repository, this variable is not updated and therefore the show method skips calling super which fetches changesets.

Gitolitable::Validations

def empty?
    extra_info.nil? || (!extra_info.key?('heads') && !extra_info.key?('branches'))
end
      
RepositoriesControllerPatch 
   
 def show
    if @repository.is_a?(Repository::Xitolite) && @repository.empty?
          # Fake list of repos
          @repositories = @project.gitolite_repos
          render 'git_instructions'
    else
          super
     end
  end

Hi @picman,

I do not have this problem with new repositories. How looks your config test on /settings/plugin/redmine_git_hosting?tab=gitolite_config_test? Are all hooks installed/green? Also check your Gitolite Hooks configuration, if this is configured right for your system configuration? If async jobs is active, Sidekiq could also be the problem.

Just for your information: the "Fetch changesets" is triggered by a gitolite hook, which is not fired in your case (as it looks). Maybe this info helps you to solve the problem.

Maybe just installing the hooks again solves your problem (press link "install hooks" at Hooks settings page)

Install hooks pressed
Run hooks asynchronously is off
Sidekiq is off
I can see in gitolite log, that the update hook of the new repo is called but it's not propagated into Redmine.

Check the hook URL in admin

The problem is that this hook is not called at all. Where is the place from where is the hook called? I've added a log message into /home/git/.gitolite/hooks/common/update and I can see that this hook is called. I've carefully gone through all logs and there is no single message related to the problem. I've switched hook debug mode too in order to see whether there is no problem in my configuration. Everything seems to be Okay:

2021-03-18 10:15:36 +0100 [INFO] User '***' has created a new repository 'redmine/general/tools/developmentplatform/c1/abc'
2021-03-18 10:15:37 +0100 [WARN] add_repository : repository 'redmine/general/tools/developmentplatform/c1/abc' does not exist in Gitolite, create it ...
2021-03-18 10:15:37 +0100 [INFO] add_repository : commiting to Gitolite...
2021-03-18 10:15:37 +0100 [WARN] No matching item found for 'redmine/general/tools/developmentplatform/c1/abc' in Recycle Bin, exiting !
2021-03-18 10:15:37 +0100 [INFO] add_repository : let Gitolite create empty repository 'repositories/redmine/general/tools/developmentplatform/c1/abc.git'
2021-03-18 10:15:40 +0100 [INFO] Execute Gitolite Plugins
2021-03-18 10:25:30 +0100 [INFO] Testing if Redmine user 'www-data' can sudo to Gitolite user 'git'...
2021-03-18 10:25:30 +0100 [INFO] OK!

I am facing the same problem. Any solution to this?? It will be much helpful.