Let's talk about Git protocol! I think this one of your most used commands:
Under this simple command, several things appear. You can see a "technical description" of the protocol here:
github.com/git/git/blob/m…
The Git/"Smart" protocol is simple, it's an exchange between the client and the server with a certain format: the PKT-line:
Such format is easy to extend (and TLS follows the same pattern for example). However, Git is able to communicate over several protocols...
Each of them have some details... For example, with the TCP/IP protocol (no security), you must tell what you want.
You are able to launch a simple Git server with:
And this simple tool will launch git-receive-pack or git-upload-pack internally on the requested Git repository. You can simulate the server-side for a push on your repository with:
Over SSH, the trick is bit more complex. Indeed, SSH will directly try to execute git-upload-pack/git-receive-pack. Then, it's just a pipe story between each processes:
Let's try to clone a repository with SSH, pipe and our favorite shell:
All of these examples show to us an important point, Git is not a monolithic tool which use a internal library such as libgit2. Git is **always** a composition of several tools with specific arguments.
We show that it's possible to clone with FIFO. This is what Git mostly does, it executes several executables and pipes them to process what you want.
At the end, it's a big difference between what Git does and what we try to provide with github.com/mirage/ocaml-g… or libgit2. Indeed, we can not execute on our goal some sub-processes to be able to push/pull/write
Composition between protocol (Smart protocol + SSH) is even harder for us when we should be able to compose them at the code level - and not at the shell level...
This is especially true for MirageOS when ... hmmm ... we don't have a shell!
Finally, such choice on Git allows several things and sets aside several questions!
For a long time, ocaml-git had a problem about memory consumption. It's mostly because, even if we have a GC, we can not believe on the fact that a sub-process will do what we want and it will be delete (with its resources) by the OS then...
We must fit into the OCaml GC (and its politic). This is why, a long time ago, we proposed:

github.com/ocaml/ocaml/pu…
Just to say that inherently, it's hard to redevelop (with another language) Git in this perspective (a library) but we did it and we go further!
Just before I talked about the HTTP way to clone a Git repository. Behind such ability exists a choice where Git depends on Curl. We could say: ok, it's fine. Curl is used everywhere.
However, again for a library, we can not impose an HTTP stack to the user. The current implementation of ocaml-git, even if it uses the widely used CoHTTP library, can use an other implementation of HTTP.

github.com/mirage/ocaml-c…
Better than that, we are able to use something completely different than HTTP, SSH or TCP/IP! We are completely abstract over the transmission protocol.
And finally, for the MirageOS purpose, we currently use awa-ssh for our default implementation of SSH:

github.com/mirage/awa-ssh
And we fallback, at the code level, on the power of abstraction between processes/protocols/etc. without any requirements of a... shell! KISS with libraries!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Calascibetta Romain

Calascibetta Romain Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Dinoosaure

20 Oct 20
Let's talk about one of the most old program I ever see! The file command.
A small research about this command brings us to 1986-1987 - I was not born - so it's a really old project. But it still is updated (last release is 5.38 - 2020-06-27).
But the official mirror repository seems not really accurate (where the Changelog started from 2003). The first "commit" is dated 1987 (according to the website).

darwinsys.com/file/
Read 24 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!