Skip to content

Commit

Permalink
fixed bug in setting remote head
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjjwright committed May 5, 2010
1 parent cc51b93 commit 2adf750
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
8 changes: 5 additions & 3 deletions nosqlite.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,11 @@ class NoSQLite
sys.debug("Pull complete")
return callback(null, "success")

defer self.db.execute "begin exclusive transaction;"
process_commits()

if commits.length > 0
defer self.db.execute "begin exclusive transaction;"
process_commits()
else
sys.debug "Pull complete"


# Web API
Expand Down
28 changes: 24 additions & 4 deletions nosqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@
return body += data;
});
return response.addListener("end", function() {
var _f, commits, last_commit, process_commits, save_remote;
var _f, _h, commits, last_commit, process_commits, save_remote;
try {
commits = JSON.parse(body);
} catch (err) {
Expand Down Expand Up @@ -837,9 +837,29 @@
});
});
};
self.db.execute("begin exclusive transaction;", function(_f) {
_f;
return process_commits();
(function(_g) {
//new body:
_f = commits.length > 0;
//old IfNode:
if (_f) {
return (function() {
//START wrap/terminate
self.db.execute("begin exclusive transaction;", function(_i) {
_i;
return _g(process_commits());;
return _g(undefined);;
//END wrap/terminate
});
})();
} else {
return (function() {
//START wrap/terminate
return _g(sys.debug("Pull complete"));;
//END wrap/terminate
})();
}
})(function(_h) {
_h;
return undefined;
});
});
Expand Down

0 comments on commit 2adf750

Please sign in to comment.