Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Commit

Permalink
Final review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gideonthomas committed Oct 25, 2014
1 parent 263b526 commit 0d3d864
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
7 changes: 5 additions & 2 deletions client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,11 @@ function createFS(options) {

// Request that a sync begin.
sync.request = function() {
// We do not expose a prototype that allows
// the path to be specified
// sync.request does not take any parameters
// as the path to sync is determined internally
// requestSync on the other hand optionally takes
// a path to sync which can be specified for
// internal use
requestSync();
};

Expand Down
2 changes: 1 addition & 1 deletion client/src/message-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function handleResponse(syncManager, data) {
session.step = steps.SYNCED;

function stampChecksum(path, callback) {
fs.stat(path, function(err, stats) {
fs.lstat(path, function(err, stats) {
if(err) {
if(err.code !== 'ENOENT') {
return callback(err);
Expand Down
4 changes: 2 additions & 2 deletions lib/rsync/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ module.exports = function diff(fs, path, checksumList, options, callback) {
// Compute the checksum for the file/link and
// append it to the diffNode.
function appendChecksum(diffNode, diffPath, callback) {
rsyncUtils.getChecksum(fs, diffPath, function(err, checksums) {
rsyncUtils.getChecksum(fs, diffPath, function(err, checksum) {
if(err) {
return callback(err);
}

diffNode.checksum = checksums;
diffNode.checksum = checksum;
diffList.push(diffNode);

callback(null, diffList);
Expand Down
6 changes: 5 additions & 1 deletion lib/rsync/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ module.exports = function patch(fs, path, diffList, options, callback) {
}

function maybeGenerateConflicted(nodePath, callback) {
// If the file has not been synced upstream
// and needs to be patched, create a conflicted copy
fsUtils.isPathUnsynced(fs, nodePath, function(err, unsynced) {
if(err) {
return handleError(err, callback);
Expand Down Expand Up @@ -187,7 +189,7 @@ module.exports = function patch(fs, path, diffList, options, callback) {
// If they match, the file is not patched and needs to
// be upstreamed
function compareVersions(data) {
fs.stat(filePath, function(err, stats) {
fs.lstat(filePath, function(err, stats) {
if(err) {
return handleError(err, callback);
}
Expand All @@ -206,6 +208,8 @@ module.exports = function patch(fs, path, diffList, options, callback) {

// If the last synced checksum matches the
// diffNode's checksum, ignore the patch
// because it is a newer version than whats on
// the server
if(checksum === diffNode.checksum) {
paths.needsUpstream.push(filePath);
return callback(null, paths);
Expand Down

0 comments on commit 0d3d864

Please sign in to comment.