Skip to content

Push #2

@cryptix

Description

@cryptix

Now that clone/fetch is working, push is the next step.

For now, I just plan to add commits to a remote, and print the new root hash of that repo. Updating IPNS entries will come later.

I'm also not sure if I can update the local path of the remote that was used after a push. Might need a 'git remote rm ipfs $oldHash && git remote add ipfs $newHash' dance until ipns is added... (dislike..)

For the mechanics: When running git push with an ipfs origin, git asks the helper for a list of remote refs (just like with fetch, but with the for-push argument, not sure what that is about)

>list for-push
<3f7ba9486ffcaa277b28598c7bfc061bffcfb10e HEAD
<3f7ba9486ffcaa277b28598c7bfc061bffcfb10e refs/heads/master 

Next, git will send one ore more push <src>:<dst> commands.

>push refs/heads/master:refs/heads/master

At that point I already know the hash of that remote ref (I just received it myself). I think the idea is, to walk down the history of the local repo (GIT_DIR) and find that remote ref. Everything up from that point, are the commits we need to push.

Open questions:

  • Can I just add those commit objects (and the trees and blobs that it depends on, of course) into the remote .git/object/ab/cdefs.. or do I need to update some index? Refs at least, I guess.
  • Should I pack them?
  • Look into refspec as they define how to update which reference (branches)
  • updating remote paths?
  • Have a special case like ipfs://new to publish new repos?
  • deleting remote branches
  • force updating

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions