Cannot perform push with hg-git mercurial plugin

Issue #230 resolved
Dmitriy Ivanov
created an issue

I receiving the next error: abort: git remote error: unexpected first line ['# service=git-receive-pack'] from smart server

Also i sniffed traffic and found one difference with working bitbucket repo:

tmp.jpg

kallithea does not puts \n after service=git-receive-pack this behavior deny hg-git dulwich to work with repo.

Comments (15)

  1. Mads Kiilerich

    I'm quite sure that it works in general and elsewhere.

    Do you get the same if you take nginx out of the equation?

    Do you only see it with hg-git and not with plain git? In that case, while there might be something misbehaving in Kallithea, it also sounds like a dulwich bug?

  2. Dmitriy Ivanov reporter

    I found the workaround. nginx content substitude will fix the problem.

     sub_filter_types application/x-git-receive-pack-advertisement;
      sub_filter '001e# service=git-receive-pack' '001f# service=git-receive-pack\n';
      sub_filter once on;
    
  3. Andrej Shadura

    I'd say it's a bug in the Git protocol itself. Apparently it is (was?) written in a way that allows multiple interpretations, and Git client itself supports either of them, which Dulwich follows the spec precisely.

    The best thing would be to change this bit of code according to the spec, and to ask Jelmer to change Dulwich too.

  4. Mads Kiilerich

    I wouldn't call it a bug in the Git protocol / implementation that it follows Postel's law.

    Agreed, it seems like a bug in Dulwich that it isn't as liberal as Git is.

    But there must also be a bug somewhere in the Kallithea stack that violates the "be conservative" part.

  5. mirrorbot

    git: include an LF at the end of the service advertisement (Fixes #230)

    This fixes hg-git/Dulwich and possibly other conservative Git clients, which do not ignore the absence of the LF.

    The original comment was a guess based on reverse engineering the protocol not specified in the documentation yet at that moment. Now that the documentation exists and states this explicitly, just do as it says.

    → <<cset 1e373254388c>>

  6. mirrorbot

    git: include an LF at the end of the service advertisement (Fixes #230)

    This fixes hg-git/Dulwich and possibly other conservative Git clients, which do not ignore the absence of the LF.

    The original comment was a guess based on reverse engineering the protocol not specified in the documentation yet at that moment. Now that the documentation exists and states this explicitly, just do as it says.

    → <<cset d28545413343>>

  7. Log in to comment