Update the md5 sum of files in merge.

This commit is contained in:
Klaas Freitag 2012-08-17 16:48:15 +03:00
parent 38cf0f2704
commit 972412e436

View file

@ -113,12 +113,12 @@ void csync_memstat_check(void) {
static int _merge_file_trees_visitor(void *obj, void *data) {
csync_file_stat_t *fs = NULL;
csync_file_stat_t *tfs = NULL;
csync_vio_file_stat_t *vst = NULL;
CSYNC *ctx = NULL;
c_rbtree_t *tree = NULL;
c_rbnode_t *node = NULL;
char *md5 = NULL;
char errbuf[256] = {0};
char *uri = NULL;
@ -179,9 +179,7 @@ static int _merge_file_trees_visitor(void *obj, void *data) {
goto out;
}
}
md5 = fs->md5;
fs = c_rbtree_node_data(node);
fs->md5 = md5;
switch (ctx->current) {
case LOCAL_REPLICA:
@ -221,10 +219,20 @@ static int _merge_file_trees_visitor(void *obj, void *data) {
/* update file stat */
fs->inode = vst->inode;
fs->modtime = vst->mtime;
// if( vst->md5 )
// fs->md5 = c_strdup(vst->md5);
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "file: %s, instruction: UPDATED", uri);
/* update with the id from the remote repo */
node = c_rbtree_find(ctx->remote.tree, &fs->phash);
if (node == NULL) {
rc = -1;
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Unable to find node");
goto out;
}
tfs = c_rbtree_node_data(node);
fs->md5 = c_strdup( tfs->md5 );
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "PRE UPDATED %s: %s <-> %s", uri, fs->md5, tfs->md5);
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "file: %s, instruction: UPDATED (%s)", uri, fs->md5);
fs->instruction = CSYNC_INSTRUCTION_NONE;