Safe-git : Git on maidsafe


#1

Following a topic from 2 weeks ago, I started implementing a git-remote-helper for the safe network.

Today I successfully pushed and then cloned a project to and from the safe network.

Even though this project is far from complete, I think some of you might be interested in having a look :

There are builds for linux available on the safe network (test 10) :

safe://bluemagma.git-safe-build/git-maidsafe(linux)
safe://bluemagma.git-safe-build/git-remote-safe(linux)

I’ll make builds for windows soon.

UPDATE 2017-02-16

safe-git is now supporting packfiles, which make it significantly faster and is now usable on a day to day basis

It it important to note that git-remote-safe will run ‘git gc’ to repack your git objects database, I can’t see any reasons why you wouldn’t want it to happen, but if you do not, you should avoid using git-remote-safe.

Two builds are available on the safe network (launcher version 0.10.0) to be able to test it. One for linux, one for windows, I don’t have any way to build it for osx, if you do, tell me I’ll be glad to add the file.

safe://bluemagma.git/git-safe/builds/safe-git_1.0_2017-02-16.linux.tar.gz
safe://bluemagma.git/git-safe/builds/safe-git_1.0_2017-02-16.win-x64.rar

What’s next :

  • Right now you can only push/fetch on your own drive, it need to support fetching from a service url (pushing will stay the way it is)
  • To allow multiple people to collaborate on a project, it need to provide a way to fork a project and make merge request on the original project.

GPL licensed software leaving github
#2

Really cool!

This project is only a proof of concept so far, pushing/fetching a project take a really long time because the tool create/read each object of the git repository through the maidsafe launcher which take anormous amount of time

I suppose a way to get around this would be to use 7z as a way to package the files onto the network and inspect them locally to modify and update. This way the network will handle it as a single object. Mean a lot of logic in the client side but im sure it would be possible? Some sort of cached inspection and a index file or the likes? Im not too sure, just spewing out a few thoughts heh.


#3

Really cool work man! Looking forward to see how it develops!


#4

I thought about that, the problem that arise with this is that, you loose everything that make git useful.
You could simply package your whole .git/objects folder and put it on the safe network, no need for a git tool.
But then you can’t work with different branches for examples, when pushing, you always push all your history, instead of the last 4-5 commits.
Also, it would make it impossible to implement concurrent access, working with other people on a project become impossible.

Git already implement a smart way to package object called packfiles : https://git-scm.com/book/en/v2/Git-Internals-Packfiles

I don’t support it yet, but I hope I will be able to.


#5

Very nice! Good work!


#6

HOW AWESOME IS THAT?!?!?!?!?!

this is really really amazing!!! :heart_eyes: :sunglasses:
very cool idea and terrific that it becomes alive!!!


#7

I’m personally really waiting for something like this for my code, it’s very good someone is working on it!!


#8

hmmm - as long as it runs through that is not a problem for me :smiley: … i can go and get a coffee while my pc/safenet is doing the work :smiley:


#9

This will hopefully all get a lot quicker when we have a decent sized network.
Looking forward to playing with this –
Problem is - there is so much to play with - MUST CONCENTRATE ON TASK IN HAND


#10

Topic has been updated with latest info following the first released version that support packfiles


#11

It funny that this never came up on the most wanted apps thread. Maybe it did? Never saw it. Seems strange it would be not one of the first suggestions. Maybe I just don’t understand.


#12

It did, but it was called SafeHub.I think SafeGit is a better name (because Git is the protocol name, and GitHub is only one implementation, so it is better to retain Git part than Hub part).


#13

Out of the two executable provided in git-safe, one of them is slowly starting to become a maidsafe command line interface.

git-maidsafe basically provide a set of command to interact with your safe-drive. It provide commands to create/delete folder and file to register longname and service, and one command to initialised an empty git repos.

The thing is, apart from that last command I feel like this is not really related to git and should be split into another project. We would have:

  • git-maidsafe on one hand that would only contain the git init command (in a more git fashioned way)

$ git maidsafe init /git/myProject

  • maidsafe-cli (or some other name) that would provide an actual command line session with your safe-drive, and maybe I could look into making it more shell-friendly (auto-completion, command history…etc)

Do you think I should keep it the way it is right now with only one project ? Or do you think it make more sense to split it ?

The idea was to further develop git-maidsafe to provide commands to fork, send merge request and globally interact with git repository, I had to include all those additional commands because init would not work on a folder that doesn’t exist (and it didn’t make sense to create the folder during the init).


#14

I would say that separate commands make it easier to remember which does what.
Having a single command with a pile of options is harder to learn and remember, I think. It would feel strange to call git-maidsafe for non git related operations, too.


#15

Well right now, git-maidsafe is creating some kind of session (that was to avoid having to allow it on the launcher for every command), usage currently look like that:

user@myPC : ~/myGitProject $ git maidsafe
 > create-folder /git public
       /git  created :  OK
 > create-folder /demo/myProj public
       /demo/myProj  created :  OK
 > init-git /demo/myProj
       /demo/myProj/objects created 
       /demo/myProj/refs created
       /demo/myProj/refs/heads created
       /demo/myProj/refs/tags created
       /demo/myProj/HEAD created
       /demo/myProj/HELPER created
 => Initialised empty Git repository in "/demo/myProj"
 > exit
user@myPC : ~/myGitProject $ 

#16

A cli for drive would be very useful. There was one early on but it wasn’t updated when the API last changed. It had ls style directly listing too.

One useful feature was that it had an option to show the http post/response on the console, which was handy for debugging.

I agree with @nice that this would be useful as a separate command, or… you could simulate a simple shell so that the shell provides git, ls, etc commands which operate on your SAFE account. Much like the ftp cli.

That might be quite neat, although something that doesn’t require entering into the shell would still be useful.

So maybe:

safe git ...
safe ls ...
etc

Then just safe to start a shell where you can do the same thing but without typing safe in front of everything. So:

safe
> git ...
> ls ...
etc

Some of this might be done using shell aliases though to save effort.


#17

Once you can mount drives, most standard tools will just work. This is why it is a critical feature, IMO. Some may not yield performance, but special tools can be created where necessary.


#18

Agreed, but until we have that tools like these will be very useful.


#19

This is what I was thinking too.


#20

Nice job. I started a “safegit” too a while ago (same name, lol) but I stopped because of the API changes. I was waiting for the new Mutable type and the new auth mechanism to continue.

I intend to release an alternative safegit version, so we can test different approaches.

As git is an essential thing for any developer these days, I think it’s a good idea to MaidSafe itself to have an official version or maybe to develop some standard of it.