jderusse / docker-gitsplit

75 stars 10 forks source link

Deprecate git2go "next" branch and use static linking #20

Closed nervo closed 5 years ago

nervo commented 5 years ago

Git2go "next" branch is deprecated, and static linking is recommended for "master" branch. See: https://github.com/libgit2/git2go#master-branch-or-static-linking

Some references:

jderusse commented 5 years ago

Hello @nervo

Thank you for the patch, but tried to build the Dockerfile locally and got errors. Could you please try locally?

nervo commented 5 years ago

Hm, sorry, i did not realize that git2go master is currently broken.. Anyway, branch v27 (2.7) is the right way, as it's the current version of libgit2 in alpine. And yes, i was a little bit fast, and forgot few dependencies :)

Could you give it another try ?

nervo commented 5 years ago

Ach', and now, i realize that libgit2 is absolutely not statically linked...

Error loading shared library libgit2.so.27: No such file or directory (needed by /bin/gitsplit)

Wtf...

jderusse commented 5 years ago

Thank you for the update. I finally make it work with in the second "stage"

- FROM alpine
+ FROM alpine:3.8

 RUN apk add --no-cache \
         git \
         openssh-client \
+        libgit2 \
         ca-certificates

could you please have a try?

nervo commented 5 years ago

I think i've figured it out :) In my last commit:

That said, of course, if you just add libgit2 for running time like your proposal on https://github.com/jderusse/docker-gitsplit/pull/20#issuecomment-437175859, that will work, but you loose all the interests of having libgit2 statically linked to your bin.

And because i'm not so sure of myself, i've also filled a clarification issue on git2go: https://github.com/libgit2/git2go/issues/464

nervo commented 5 years ago

Ah, one last thing. Because i was so tired of git2go/libgit2/go "hacking", i have give a try to https://github.com/src-d/go-git Well, for the moment, that just works... You can tell a word on it to fabpot and its splitsh :)

jderusse commented 5 years ago

thank you @nervo for this great contribution!!

This repository uses libgit2 to share the same dependency with splitsh. And splitsh uses it for performance reason. I doubt that a go implementation would be faster that libgit2, but if you have a benchmark, it would be great to give a try