git ssb

0+

cel / pull-git-remote-helper



Commit f791da7ccc8e720c47c297e2a39c746bfba7b8c3

Make example work for push

Charles Lehner committed on 2/8/2016, 4:37:24 AM
Parent: b057fe40960502a3d16c60aef0f67bf2078455fe

Files changed

README.mdchanged
README.mdView
@@ -5,19 +5,33 @@
55
66 ## Example
77
88 ```js
9+#!/usr/bin/env node
10+
911 var toPull = require('stream-to-pull-stream')
1012 var pull = require('pull-stream')
11-var gitRemoteHelper = require('pull-git-remote-helper')
13+var gitRemoteHelper = require('.')
1214
1315 var options = {
14- refSource: pull.values([]),
15- updateSink: pull.drain(console.error),
16- wantSink: pull.drain(console.error),
17- hasObject: function (hash, cb) { cb(false) },
18- getObjects: /* ... /,
19- objectSink: /* ... */
16+ updateSink: pull.drain(function (update) {
17+ console.error('Updating ' + update.name + ' to ' + update.new)
18+ }),
19+ objectSink: function (read) {
20+ read(null, function next(end, object) {
21+ if (end === true) return
22+ if (end) throw end
23+ pull(
24+ object.read,
25+ pull.collect(function (err, bufs) {
26+ if (err) throw err
27+ var buf = Buffer.concat(bufs, object.length)
28+ console.error('Got object', object, buf)
29+ read(null, next)
30+ })
31+ )
32+ })
33+ }
2034 }
2135
2236 pull(
2337 toPull(process.stdin),

Built with git-ssb-web