Open anarcat opened 9 years ago
@anarcat Mind making this something that gets logged to gittorrentd stdout, rather than in README? That way people will definitely see it.
actually, i think it does get printed to stdout, as you explained in #22.. the problem is when that doesn't work, and gittorrentd doesn't output anything. i originally thought that was normal, and that led me to report #22. :)
Here did another patch. Here is the output:
> I will publish the repository found @ ./f1n2c1t4t10ns
>> I will announce HEAD (312147ce983c114262e1a0501571a4f13c325e21) for ref refs/heads/master
errors= [ { [Error: query timed out] address: '192.34.86.36:6881' } ]
>> You and your friends can now do:
>>> git clone gittorrent://0178778c22c5a515413be7ab82dc518beaacc53b/f1n2c1t4t10ns
diff --git a/gittorrentd b/gittorrentd
index 2383bfd..38aa23b 100755
--- a/gittorrentd
+++ b/gittorrentd
@@ -79,13 +79,12 @@ dht.on('ready', function () {
var repos = glob.sync('*/.git/git-daemon-export-ok')
var count = repos.length
repos.forEach(function (repo) {
- console.log('in repo ' + repo)
+ console.log('I will publish the repository found @ ./' + repo)
repo = repo.replace(/git-daemon-export-ok$/, '')
- console.log(repo)
var upload = spawn('git-upload-pack', ['--strict', repo])
upload.stdout.on('data', function (line) {
var lines = line.toString().split('\n')
- lines.forEach(function (line) {
+ lines.forEach(function (line) {
var arr = line.toString().split(' ')
if (arr.length === 2) {
var sha = arr[0].toString()
@@ -143,8 +142,14 @@ dht.on('ready', function () {
])}
console.log(json)
dht.put(opts, function (errors, hash) {
- console.error('errors=', errors)
- console.log('hash=', hash.toString('hex'))
+ if(errors.length > 0) {
+ console.error('errors=', errors)
+ }
+ console.log('You and your friends can now do:');
+ for(reponame in userProfile.repositories) {
+ console.log('git clone gittorrent://' + hash.toString('hex') + '/' + reponame);
+ }
+
})
}
For smoother on boarding the README must notify that git-remote-gittorrent must in the path for instance:
amirouche@gittorrent > PATH=`pwd`:$PATH git clone gittorrent://0178778c22c5a515413be7ab82dc518beaacc53b/f1n2c1t4t10ns
ping?
closes #22