GitTorrent icon indicating copy to clipboard operation
GitTorrent copied to clipboard

explain how to find the hash

Open anarcat opened this issue 9 years ago • 5 comments

closes #22

anarcat avatar May 31 '15 22:05 anarcat

@anarcat Mind making this something that gets logged to gittorrentd stdout, rather than in README? That way people will definitely see it.

cjb avatar May 31 '15 22:05 cjb

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. :)

anarcat avatar May 31 '15 22:05 anarcat

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);
+        }
+        
     })
   }

amirouche avatar Jun 01 '15 02:06 amirouche

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

amirouche avatar Jun 01 '15 02:06 amirouche

ping?

anarcat avatar Oct 13 '15 11:10 anarcat