update on rev2 on git log - fixes change branch for git projects

This commit is contained in:
oleg 2015-12-14 21:33:54 +03:00
parent a0c562e402
commit 26daa4ce38
2 changed files with 22 additions and 1 deletions

View File

@ -39,6 +39,8 @@ content~~
* projects list scroll
* ~~Error during send: TypeError: Cannot read property 'changes' of undefined~~
* Builds loss
* ~~error on git after change branch: fatal: ambiguous argument '18a8ea4..branch':
unknown revision or path not in the working tree.~~
## Feature requests

View File

@ -133,12 +133,26 @@ Scm.prototype.getChanges = function(rev1, rev2, callback) {
var self = this;
Steppy(
function() {
// get current rev to update on it after git log
self.getCurrent(this.slot());
},
function(err, currentRev) {
this.pass(currentRev);
// update to rev2 to prevent git error when switch to branch that
// doesn't exist locally: "unknown revision or path not in the
// working tree"
self.update(rev2, this.slot());
},
function(err, currentRev) {
this.pass(currentRev);
self.run({cmd: 'git', args: [
'log', rev1 ? rev1 + '..' + rev2 : rev2,
'--pretty=' + self._revTemplate
]}, this.slot());
},
function(err, stdout) {
function(err, currentRev, stdout) {
// always skip last line - it's empty
var rows = stdout.split('\n').slice(0, -1);
@ -146,7 +160,12 @@ Scm.prototype.getChanges = function(rev1, rev2, callback) {
return self._parseRev(str);
});
this.pass(currentRev, changes);
},
function(err, currentRev, changes) {
this.pass(changes);
self.update(currentRev.id, this.slot());
},
callback
);