Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explain how to find the hash #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

explain how to find the hash #28

wants to merge 1 commit into from

Conversation

anarcat
Copy link

@anarcat anarcat commented May 31, 2015

closes #22

@cjb
Copy link
Owner

cjb commented May 31, 2015

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

@anarcat
Copy link
Author

anarcat commented May 31, 2015

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

You then can use that hash in URLs to clone that repo elsewhere:

```
git clone gittorrent://a5491738f6415acb996f98800b33421ea472d2d6/somerepo

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hash is the hash of master

@amirouche
Copy link

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
Copy link

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

@pdaian pdaian mentioned this pull request Jul 3, 2015
@anarcat
Copy link
Author

anarcat commented Oct 13, 2015

ping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how to determine my hash?
3 participants