diff options
| author | Chris Ball <chris@printf.net> | 2015-05-13 18:11:57 -0400 |
|---|---|---|
| committer | Chris Ball <chris@printf.net> | 2015-05-13 18:11:57 -0400 |
| commit | e78082c5e3b4adc56a54d6b012c079302dfcb534 (patch) | |
| tree | 948343100457e3cead485d9d1595dd593cd82936 /git-remote-gitswarm | |
| parent | 01a7cd79111cf0d8fc67c91454f147d5213634f1 (diff) | |
Fix up standard linter warnings
Diffstat (limited to 'git-remote-gitswarm')
| -rwxr-xr-x | git-remote-gitswarm | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/git-remote-gitswarm b/git-remote-gitswarm index 517de84..5524518 100755 --- a/git-remote-gitswarm +++ b/git-remote-gitswarm @@ -7,7 +7,7 @@ var Swarm = require('bittorrent-swarm') var ut_gitswarm = require('ut_gitswarm') // We use console.warn (stderr) because git ignores our writes to stdout. -url = process.argv[3].replace(/^gitswarm:/i, 'git:') +var url = process.argv[3].replace(/^gitswarm:/i, 'git:') function die (error) { console.error(error) @@ -15,22 +15,23 @@ function die (error) { } exec('git ls-remote ' + url + ' HEAD', function (err, stdout, stderr) { - if (err !== null) + if (err !== null) { die(err) - - lines = stdout.split('\n') - if (lines.length !== 2) + } + var lines = stdout.split('\n') + if (lines.length !== 2) { die("Didn't get back a single HEAD ref: " + lines) - + } var line = lines[0].split('\t') var ref = line[0] var head = line[1] - if (head !== 'HEAD') + if (head !== 'HEAD') { die("Couldn't parse the ref line: " + ref, head) - if (ref.length != 40) - die("Was expecting a 40-byte sha: " + ref) - - console.warn("Okay, we want to get: " + ref) + } + if (ref.length !== 40) { + die('Was expecting a 40-byte sha: ' + ref) + } + console.warn('Okay, we want to get: ' + ref) var dht = new DHT() var magnetUri = 'magnet:?xt=urn:btih:' + ref @@ -44,9 +45,9 @@ exec('git ls-remote ' + url + ' HEAD', function (err, stdout, stderr) { }) var swarm = new Swarm(parsed.infoHash, 'cafebabecafebabecafecafebabecafebabecafe') - swarm.on('wire', function(wire) { + swarm.on('wire', function (wire) { console.error('we got a wire') wire.use('ut_gitswarm') - //wire.ut_gitswarm.askforsha(parsed.infoHash) + // wire.ut_gitswarm.askforsha(parsed.infoHash) }) }) |
