threads / discuss / 55180

FUSE fs for git.

Subject: FUSE fs for git.

## tl;dr

5 messages between Feb 21, 2021 and Mar 1, 2021.

replies: 4people: 4as markdown or json

Stef Bon· Feb 21, 2021, 10:12 UTC · lore
Hi,

I'm working on a network fs mount service for Linux (I call it Open Secure Network Services, short OSNS) which mounts sftp access on hosts found in the network (using Avahi) and provides a browseable map to the user like:

sbon@ws-001 OSNS]$ ls -al /run/network/sbon/fs/Open\ Secure\ Network/bononline.nl/alarm/public total 3 drwxrwx--- 5 nobody users 4096 Feb 21 05:05 . drwxr-xr-x 5 root root 4096 Feb 21 05:04 .. -rw-r--r-- 1 sbon users 0 Aug 15 2018 1234 drwxr-xr-x 2 nobody users 4096 Jan 24 04:52 backup -rw-r--r-- 1 nobody users 21 Feb 21 2017 .bash_logout -rw-r--r-- 1 nobody users 57 Feb 21 2017 .bash_profile -rw-r--r-- 1 nobody users 141 Feb 21 2017 .bashrc drwxr-xr-x 2 nobody users 4096 May 27 2017 Projects -rw-r--r-- 1 nobody users 4 Jul 1 2017 test -rw-r--r-- 1 sbon users 24 Aug 6 2017 test1 -rw-r--r-- 1 sbon users 4 Aug 10 2017 test2 -rw------- 1 sbon users 0 Aug 15 2018 'Text File' -rw------- 1 sbon users 0 Aug 15 2018 'Text File (1)' -rw------- 1 sbon users 0 Aug 15 2018 'Text File (2)'

See: https://github.com/stefbon/OSNS
It supports SFTP (over SSH) versions 3 (used by Openssh) to 6 (latest draft).
Other things I want to add is:
- own sftp client (osns_sftp_subsystem)
- backup on server of user defined directories and files (osns_backup_subsystem)
- next to SFTP also support SMB using libsmb2 by R. Sahlberg for
integration in Windows Networks
- fsnotify support in SFTP and in userland using a specific user agent
like osns_client_user (maybe also in SMB) (support in SFTP means an
extension)
- textchat and/or videochat (osns_chat_subsystem)
- forward connection to server over SSH using a simple api to talk to
osns_client for databases, and something like nx (emulation of
desktop)
- an own server osns_server
- support for use in large environments and roaming users (-> CA, ldap etc)

Now I'm looking it's possible and usefull to add a git fuse fs. The thing I ask is:

- is there an api I can use (lowlevel and/or highlevel or whatever is
available)?
- is it usefull, in other words is there a serious benefit of a git
filesystem: does it add something?
Any other suggestion is appreciated,

Stef Bon the Netherlands

Ori Bernstein· Feb 25, 2021, 04:40 UTC · re: Stef Bon · lore

Re: FUSE fs for git.

On Sun, 21 Feb 2021 11:12:19 +0100, Stef Bon <stefbon@gmail.com> wrote: <snip>

Show 5 quoted lines
> Now I'm looking it's possible and usefull to add a git fuse fs. The
> thing I ask is:
> 
> - is there an api I can use (lowlevel and/or highlevel or whatever is
> available)?

Not provided as part of git, as far as I'm aware, but there are other options.

You can probably look at what cgit does to abuse git internals as an API:

	https://git.zx2c4.com/cgit/tree/cgit.h

It may also make sense to lift code from game of trees:

	http://gameoftrees.org/
There's also libgit2:
	https://libgit2.org/
> - is it usefull, in other words is there a serious benefit of a git
> filesystem: does it add something?

That seems like a question you'd have to ask yourself. What would you do with it?

For me: I've got a 9p based git file system as part of my implementation of git[1]. It's convenient for scripts on top of git, avoiding scratch files or pipeline wrangling. But on Unix, git already has much of that implemented.

I also tend to open files from old commits or other branches to peek at how some code evolved.

[1] http://shithub.us/ori/git9/HEAD/info.html
-- 
    Ori Bernstein
Stef Bon· Mar 1, 2021, 07:45 UTC · re: Ori Bernstein · lore

Re: FUSE fs for git.

Thanks a lot Ori.

Especially the link to libgit2 and your own 9p based git filesystem I appreciate. What is 9p? Is it a name or something?

Stef Bon the Netherlands

Ævar Arnfjörð Bjarmason· Mar 1, 2021, 14:08 UTC · re: Stef Bon · lore

Re: FUSE fs for git.

On Mon, Mar 01 2021, Stef Bon wrote:
Show 5 quoted lines
> Thanks a lot Ori.
>
> Especially the link to libgit2 and your own 9p based git filesystem I
> appreciate.
> What is 9p? Is it a name or something?
https://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs
Eric Wong· Feb 25, 2021, 05:32 UTC · re: Stef Bon · lore

Re: FUSE fs for git.

Stef Bon <stefbon@gmail.com> wrote:
> - is there an api I can use (lowlevel and/or highlevel or whatever is
> available)?

I've used "git cat-file --batch" in many places via pipes. Git.pm provides a convenient interface for it. It handles requests like "$REFNAME:$PATHNAME" so it'd be pretty easy to map FS-like paths to it.

"git fast-import" is also nice if you need write access and nowadays has "cat-blob" functionality similar to the aforementioned --batch.

← back to recent threads