Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introducing gitfs

Vlad Temian
October 18, 2014

Introducing gitfs

Git has been a developer’s go-to tool ever since it started to gain popularity a few years back. Still, not everyone who gets to play a bit with code will want to go through the whole process of learning its quirks. This is where gitfs, the open-source tool we’re launching right now, comes into play.

Vlad Temian

October 18, 2014
Tweet

More Decks by Vlad Temian

Other Decks in Programming

Transcript

  1. | open source from pygit2 import clone_repository, Keypair credentials =

    Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "") gitfs
  2. | open source from pygit2 import clone_repository, Keypair credentials =

    Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "") repository = clone_repository("git@github. com:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials) gitfs
  3. | open source from pygit2 import clone_repository, Keypair credentials =

    Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "") repository = clone_repository("git@github. com:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials) remote = [remote for remote in repo.remotes if remote.name == "origin"] remote[0].credentials = credentials gitfs
  4. | open source from pygit2 import clone_repository, Keypair credentials =

    Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "") repository = clone_repository("git@github. com:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials) remote = [remote for remote in repo.remotes if remote.name == "origin"] remote[0].credentials = credentials remote[0].push("refs/heads/master") gitfs
  5. | open source class Memory(Operations): def open(self, path, flags): self.fd

    += 1 return self.fd def read(self, path, size, offset, fh): return self.data[path][offset:offset + size] gitfs
  6. | open source class Memory(Operations): def open(self, path, flags): self.fd

    += 1 return self.fd def read(self, path, size, offset, fh): return self.data[path][offset:offset + size] def rename(self, old, new): self.files[new] = self.files.pop(old) gitfs
  7. | open source class Memory(Operations): def open(self, path, flags): self.fd

    += 1 return self.fd def read(self, path, size, offset, fh): return self.data[path][offset:offset + size] def rename(self, old, new): self.files[new] = self.files.pop(old) def rmdir(self, path): self.files.pop(path) self.files['/']['st_nlink'] -= 1 gitfs
  8. | open source class Memory(Operations): def open(self, path, flags): self.fd

    += 1 return self.fd def read(self, path, size, offset, fh): return self.data[path][offset:offset + size] def rename(self, old, new): self.files[new] = self.files.pop(old) def rmdir(self, path): self.files.pop(path) self.files['/']['st_nlink'] -= 1 def write(self, path, data, offset, fh): self.data[path] = self.data[path][:offset] + data self.files[path]['st_size'] = len(self.data[path]) return len(data) gitfs
  9. | open source very dirty def rename(self, old, new): if

    "history" in old or new: # raise EROFS elif old == "/" or new == "/": # raise EROFS else: # do the actual rename gitfs
  10. | open source solve conflicts 1 2 3 7 8

    4 5 6 remote local gitfs
  11. | open source 1 2 3 4 5 6 merging_remote

    1 2 3 7 8 merging_local gitfs solve conflicts
  12. | open source 1 2 3 4 5 7' 6

    8' merging_remote 1 2 3 7 8 merging_local gitfs solve conflicts
  13. | open source 1 2 3 4 5 7' 6

    8' local gitfs solve conflicts
  14. | open source Fuse threads Commit queue Sync worker commits

    want to sync don't open for write gitfs
  15. | open source Fuse threads Commit queue Sync worker commits

    commit want to sync don't open for write gitfs
  16. | open source Fuse threads Commit queue Sync worker commits

    commit want to sync sync done don't open for write gitfs
  17. | open source Fuse threads Commit queue Sync worker Fetch

    worker commits commit want to sync sync done don't open for write FETCH FETCH FETCH gitfs
  18. | open source Fuse threads Commit queue Sync worker Fetch

    worker commits commit want to sync sync done don't open for write Nothing happens FETCH FETCH FETCH gitfs
  19. | open source Fuse threads Commit queue Sync worker Fetch

    worker commits commit want to sync sync done don't open for write Nothing happens Nothing happens but somebody is still writing FETCH FETCH FETCH gitfs
  20. | open source Fuse threads Commit queue Sync worker Fetch

    worker commits commit want to sync sync done don't open for write Nothing happens Nothing happens but somebody is still writing Nothing happens but somebody is still writing so we can merge and push FETCH FETCH FETCH gitfs
  21. | open source 720 commits 4215 lines of code 187

    tests 4 contributers 3½ months