{"thread":{"id":"38180","subject":"remote helper example with push/fetch capabilities","startedAt":"2014-12-15T20:17:24Z","lastAt":"2015-01-14T21:57:31Z","messageCount":8,"participants":["Klein W","Jonathan Nieder","Junio C Hamano","Andrew Mackenzie"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"253703","messageId":"CAPCWLt6kxoJJSWAcyH_kW071Md0vc4zeo41hCKBQHd-_pvUMXQ@mail.gmail.com","threadId":"38180","inReplyTo":null,"subject":"remote helper example with push/fetch capabilities","fromName":"Klein W","fromEmail":"wineklein@gmail.com","sentAt":"2014-12-15T20:17:24Z","receivedAt":"2014-12-15T20:17:24Z","isPatch":false,"sender":{"key":"wineklein@gmail.com","avatar":null},"body":"Is there any example of a remote helper [0] with push and fetch capabilities?\n\nThe git-remote-testgit.sh example [1] only has import/export capabilities.\n\nAlso, what are the advantages and disadvantages of a remote helper\nwith push/fetch capabilities vs a remote helper with import/export\ncapabilities?\n\nThanks.\n\n[0] https://www.kernel.org/pub/software/scm/git/docs/git-remote-helpers.html\n[1] https://github.com/git/git/blob/master/git-remote-testgit.sh\n"},{"id":"253705","messageId":"20141215204740.GI29365@google.com","threadId":"38180","inReplyTo":"CAPCWLt6kxoJJSWAcyH_kW071Md0vc4zeo41hCKBQHd-_pvUMXQ@mail.gmail.com","subject":"Re: remote helper example with push/fetch capabilities","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-12-15T20:47:40Z","receivedAt":"2014-12-15T20:47:40Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nKlein W wrote:\n\n> Is there any example of a remote helper [0] with push and fetch capabilities?\n\nSure --- see remote-curl.c.\n\nThere's also the \"connect\" capability.  builtin/remote-ext.c and\nbuiltin/remote-fd.c are examples using that one.\n\n[...]\n> Also, what are the advantages and disadvantages of a remote helper\n> with push/fetch capabilities vs a remote helper with import/export\n> capabilities?\n\nIt mainly has to do with what it is convenient for your helper to\nproduce.  If the helper would find it more convenient to write native\ngit objects (for example because the remote server speaks a\ngit-specific protocol, as in the case of remote-curl.c) then the\n\"fetch\" capability will be more convenient.  If the helper wants to\nmake a batch of new objects then a fast-import stream can be a\nconvenient way to do this and the \"import\" capability takes care of\nrunning fast-import to take care of that.\n\nThanks and hope that helps,\nJonathan\n"},{"id":"253709","messageId":"CAPCWLt4=oYTPFXktCj8CgqNncaO2=sbwZcPOVa+a5wgt7HPCUQ@mail.gmail.com","threadId":"38180","inReplyTo":"20141215204740.GI29365@google.com","subject":"Re: remote helper example with push/fetch capabilities","fromName":"Klein W","fromEmail":"wineklein@gmail.com","sentAt":"2014-12-15T21:42:56Z","receivedAt":"2014-12-15T21:42:56Z","isPatch":false,"sender":{"key":"wineklein@gmail.com","avatar":null},"body":"On Mon, Dec 15, 2014 at 3:47 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Sure --- see remote-curl.c.\n>\n> There's also the \"connect\" capability.  builtin/remote-ext.c and\n> builtin/remote-fd.c are examples using that one.\n\nThanks.\n\n>> Also, what are the advantages and disadvantages of a remote helper\n>> with push/fetch capabilities vs a remote helper with import/export\n>> capabilities?\n>\n> It mainly has to do with what it is convenient for your helper to\n> produce.  If the helper would find it more convenient to write native\n> git objects (for example because the remote server speaks a\n> git-specific protocol, as in the case of remote-curl.c) then the\n> \"fetch\" capability will be more convenient.  If the helper wants to\n> make a batch of new objects then a fast-import stream can be a\n> convenient way to do this and the \"import\" capability takes care of\n> running fast-import to take care of that.\n\nI'm trying to write a remote helper for hosting git remotes on Amazon\nS3.  Do you have any intuition about which capabilities would work\nbest for this case?\n\nThanks.\n"},{"id":"253710","messageId":"20141215214459.GJ29365@google.com","threadId":"38180","inReplyTo":"CAPCWLt4=oYTPFXktCj8CgqNncaO2=sbwZcPOVa+a5wgt7HPCUQ@mail.gmail.com","subject":"Re: remote helper example with push/fetch capabilities","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-12-15T21:44:59Z","receivedAt":"2014-12-15T21:44:59Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Klein W wrote:\n> On Mon, Dec 15, 2014 at 3:47 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>> It mainly has to do with what it is convenient for your helper to\n>> produce.  If the helper would find it more convenient to write native\n>> git objects (for example because the remote server speaks a\n>> git-specific protocol, as in the case of remote-curl.c) then the\n>> \"fetch\" capability will be more convenient.  If the helper wants to\n>> make a batch of new objects then a fast-import stream can be a\n>> convenient way to do this and the \"import\" capability takes care of\n>> running fast-import to take care of that.\n>\n> I'm trying to write a remote helper for hosting git remotes on Amazon\n> S3.  Do you have any intuition about which capabilities would work\n> best for this case?\n\nfetch/push.  I'd suggest looking at the \"dumb\" HTTP code (fetch_dumb,\npush_dav) in remote-curl.c to start.\n\nThanks,\nJonathan\n"},{"id":"253711","messageId":"xmqqegs0d1qv.fsf@gitster.dls.corp.google.com","threadId":"38180","inReplyTo":"CAPCWLt6kxoJJSWAcyH_kW071Md0vc4zeo41hCKBQHd-_pvUMXQ@mail.gmail.com","subject":"Re: remote helper example with push/fetch capabilities","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-15T21:47:20Z","receivedAt":"2014-12-15T21:47:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Klein W <wineklein@gmail.com> writes:\n\n> Is there any example of a remote helper [0] with push and fetch capabilities?\n>\n> The git-remote-testgit.sh example [1] only has import/export capabilities.\n>\n> Also, what are the advantages and disadvantages of a remote helper\n> with push/fetch capabilities vs a remote helper with import/export\n> capabilities?\n\nA helper with push/fetch capabilities is responsible for (and more\nimportantly, \"in control of\") packdata creation, while helpers that\nuse import/export interface rely on fast-import, which is quite dumb\nwhen it comes to storage efficiency of the resulting repository.\nThe former might be more preferrable from the efficiency point of\nview.\n\nBUT.\n\nUnless your foreign SCM is Git itself, however, it is not practical\nto write your own pack data generator correctly and efficiently to\nsupport push/fetch capabilities anyway, so the choice is often made\nnot because of \"advantages vs disadvantages\" but because of what you\ncan write in practice.\n"},{"id":"253716","messageId":"CAPCWLt5pW6kwP4FCsJqG+o5d=p_WgKMSXqaANY7vSe6Bh7tMxQ@mail.gmail.com","threadId":"38180","inReplyTo":"20141215214459.GJ29365@google.com","subject":"Re: remote helper example with push/fetch capabilities","fromName":"Klein W","fromEmail":"wineklein@gmail.com","sentAt":"2014-12-15T22:41:32Z","receivedAt":"2014-12-15T22:41:32Z","isPatch":false,"sender":{"key":"wineklein@gmail.com","avatar":null},"body":"On Mon, Dec 15, 2014 at 4:44 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>> I'm trying to write a remote helper for hosting git remotes on Amazon\n>> S3.  Do you have any intuition about which capabilities would work\n>> best for this case?\n>\n> fetch/push.  I'd suggest looking at the \"dumb\" HTTP code (fetch_dumb,\n> push_dav) in remote-curl.c to start.\n\nThis seems like a good starting point, but are there any simpler\nexamples that are not clouded by WebDAV/Curl stuff?  Perhaps a remote\nhelper that reads/writes to the filesystem directly?\n"},{"id":"253813","messageId":"CAPCWLt7+dfcubjEaB=eacNK39CA7Q9K6Mg2FM=_3qQaGBOR2+A@mail.gmail.com","threadId":"38180","inReplyTo":"CAPCWLt5pW6kwP4FCsJqG+o5d=p_WgKMSXqaANY7vSe6Bh7tMxQ@mail.gmail.com","subject":"Re: remote helper example with push/fetch capabilities","fromName":"Klein W","fromEmail":"wineklein@gmail.com","sentAt":"2014-12-18T21:46:37Z","receivedAt":"2014-12-18T21:46:37Z","isPatch":false,"sender":{"key":"wineklein@gmail.com","avatar":null},"body":"Would someone be willing to extend the git-remote-testgit.sh example\n[1] with push and fetch capabilities?  I am not familiar enough to do\nit myself.\n\nThanks\n\n[1] https://github.com/git/git/blob/master/git-remote-testgit.sh\n"},{"id":"254703","messageId":"loom.20150114T225554-824@post.gmane.org","threadId":"38180","inReplyTo":"xmqqegs0d1qv.fsf@gitster.dls.corp.google.com","subject":"Re: remote helper example with push/fetch capabilities","fromName":"Andrew Mackenzie","fromEmail":"andrew@mackenzie-serres.net","sentAt":"2015-01-14T21:57:31Z","receivedAt":"2015-01-14T21:57:31Z","isPatch":false,"sender":{"key":"andrew@mackenzie-serres.net","avatar":null},"body":"I'm interested in doing something very similar (not to S3, but to a customer \nCMS repository), but have found it very difficult to find any documentation or \ngood example code on git-remote-helpers.\n\nIf you can share any learnings or references I would really appreciate it!\n\nthanks, Andrew\n"}]}