MCPcopy Index your code
hub / github.com/cjb/GitTorrent / ls

Function ls

git.js:7–25  ·  view source on GitHub ↗
(url, with_ref)

Source from the content-addressed store, hash-verified

5// Returns a process running `git ls-remote <url>` that calls `with_ref` on
6// each parsed reference. The url may point to a local repository.
7function ls (url, with_ref) {
8 var ls = spawn('git', ['ls-remote', url])
9 ls.stdout.on('data', function (lines) {
10 lines.toString().split('\n').forEach(function (line) {
11 if (!line || line === '') {
12 return
13 }
14 line = line.split('\t')
15 var sha = line[0]
16 var branch = line[1]
17 if (sha.length !== 40) {
18 console.warn('[git ls-remote] expected a 40-byte sha: ' + sha + '\n')
19 console.warn('[git ls-remote] on line: ' + line.join('\t'))
20 }
21 with_ref(sha, branch)
22 })
23 })
24 return ls
25}
26
27function pad4 (num) {
28 num = num.toString(16)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected