title: SubGit calling GitLabs post-receive hook doesn't work
body: <p>We are trying a soft migration from svn to git (GitLab) using SubGit as mirror. All works fine, except that commits to the svn repo do not trigger the GitLabs <code>post-recive</code> hook correctly (I suppose).</p>
  
  <p>The commit in the git repo is there, but the activity stream does not get updated afterwards, the CI pipeline does not get triggered and so on.</p>
  
  <p>I can see that the <code>post-receive</code> hook is called from SubGit:</p>
  
  <pre><code>[daemon][20] Executing [/var/opt/gitlab/git-
  data/repositories/repo.git/hooks/post-receive]; environmentVariables=
  {SVN_LAST_FETCHED_REVISION=33957, GIT_DIR=., GL_ID=user-
  1};workingDirectory=/var/opt/gitlab/git-data/repositories/repo.git
  </code></pre>
  
  <p>(I replaced the real group/project name with <code>repo</code>)</p>
  
  <p>The Sidekiq logs tells me there is some problem with a <code>GL Repository</code>:</p>
  
  <pre><code>WARN: ArgumentError: Invalid GL Repository "/var/opt/gitlab/git-
  data/repositories/repo.git"
  </code></pre>
  
  <p>thrown in gitlab-rails/lib/gitlab/gl_repository.rb:10:</p>
  
  <pre class="lang-rb prettyprint-override"><code>def self.parse(gl_repository)
    match_data = /\A(project|wiki)-([1-9][0-9]*)\z/.match(gl_repository)
    unless match_data
      raise ArgumentError, "Invalid GL Repository \"#{gl_repository}\""
    end
  </code></pre>
  
  <p>Grepping through the code it seems that the hook itself uses a <code>GL_REPOSITORY</code> environment variable that is not set by SubGit.</p>
  
  <p>I tried calling the hook manually and setting <code>GL_REPOSITORY</code> to something that fulfill the regexp above ("project-13", 13 is the project id for this repo), <s>but that leads to the a <code>Ambiguous lookup - OID prefix is too short</code> exception.</s> (My fault, that would have worked if I had used correct hook data)</p>
  
  <p>So, what is the <code>GL_REPOSITORY</code> environment variable, and how can I make SubGit set it?</p>
  
  <p>I'm using:</p>
  
  <ul>
  <li>GitLab 9.4.5</li>
  <li>SubGit 3.2.5</li>
  </ul>
  
  <p><strong>Update</strong>:</p>
  
  <p>I found out that <code>GL_REPOSITORY</code> ist just a string <code>project-&lt;GitLabDBProjectId&gt;</code>. 
  For now i placed a text file with the correct string in every repository, and adjusted the <code>post-receive</code> hook itself to read out that file and use it as content instead of the <code>GL_REPOSITORY</code> variable.</p>
  
  <p>There was some heavy reworking in GitLab relating to the project identifiers, and it seems that SubGit didn't catch up with that changes (Bug report exists). </p>