Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

push emits branch, passes branch test

  • Loading branch information...
commit cda1f89ef967a16b704857fcb7a1f2a8870869d1 1 parent c6efacc
@substack authored
Showing with 7 additions and 4 deletions.
  1. +7 −4 index.js
View
11 index.js
@@ -172,21 +172,24 @@ Git.prototype.handle = function (req, res, next) {
if (self.checkout) {
var opts = { cwd : path.join(repoDir, repo) };
exec('git reset --hard', opts, function () {
- self.emit('push', repo, commit);
+ self.emit('push', repo, commit, branch);
});
}
- else self.emit('push', repo, commit)
+ else self.emit('push', repo, commit, branch)
}
});
- var commit = null;
+ var commit = null, branch = null;
(function () {
var data = '';
req.on('data', function ondata (buf) {
data += buf;
- var m = data.match(/^[0-9a-fA-F]+ ([0-9a-fA-F]+) /);
+ var m = data.match(
+ /^[0-9a-fA-F]+ ([0-9a-fA-F]+) refs\/heads\/([^\s\0]+)/
+ );
if (m) {
commit = m[1];
+ branch = m[2];
req.removeListener('data', ondata);
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.