Subject: Re: Announcing gitsync-nncp

From: John Goerzen <[email-masked]>
Date: Fri, 20 Aug 2021 07:53:50 -0500

On Fri, Aug 20 2021, Sergey Matveev wrote:

> Greetings!
>
> *** John Goerzen [2021-08-18 11:16]:
>>https://github.com/jgoerzen/gitsync-nncp
>
> Impressive! My appreciation!
>
> Just out of curiosity, possibly I read badly and too quickly, 
> possibly I
> am not taking in account something, or forget how git works, 
> but: each
> remote gitsync-accessible repository is "identified" only by a 
> single
> branch in your scheme. Can remote/branch be used instead of a 
> single
> branch? Instead of "gitsync-nncp/bob" branch, can there be used
> "gitsync-bob" git-remote with possibly several branches in it 
> instead
> (and dummy send/fetch URLs)? Git-remote can be considered as a 
> some kind
> of a namespace/aggregation of branches (plus some URLs/rules 
> where to
> push/fetch it) in my opinion. Or using "git remotes" abstraction 
> brings
> more problems and complications? But you won't be limited to the 
> single branch.

You are quite right.  Actually Joey Hess (author of git-annex) 
pointed out that git has an entire interface for defining custom 
remotes, at https://www.git-scm.com/docs/gitremote-helpers , 
though it doesn't look to be async-friendly initially.

I just didn't implement all of that because of the complexity, and 
I guess because I didn't need it.  The guts of this thing is about 
160 lines of code and I wanted it to be a simple-ish demonstration 
of using NNCP for a really neat purpose, something that's 
difficult to achieve otherwise.  I initially considered writing 
the thing in Rust and using https://crates.io/crates/git2 , which 
definitely has a number of advantages and would be more suitable 
once we start talking about these more complex kinds of 
scenarios... but 160 lines of code beckoned and I am using it 
quite happily for my own use case already.  I may yet redo it in 
Rust for these sorts of things; I do feel that I'm sort of pushing 
the shell to about the limits of how far it should reasonably go 
already.

- John