(url, with_ref)
| 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. |
| 7 | function 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 | |
| 27 | function pad4 (num) { |
| 28 | num = num.toString(16) |
nothing calls this directly
no outgoing calls
no test coverage detected