mirror of https://github.com/vitalif/grive2
Fix subdir/subsubdir/newfile bug
New files put in sub-subdirs of drive root were also trashed locally instead of begin uploaded to the serverpull/59/head
parent
60acb75967
commit
b6c0013052
|
@ -272,14 +272,20 @@ void Resource::FromLocal( Val& state )
|
||||||
if ( state.Has( "srv_time" ) )
|
if ( state.Has( "srv_time" ) )
|
||||||
m_mtime.Assign( state[ "srv_time" ].U64(), 0 ) ;
|
m_mtime.Assign( state[ "srv_time" ].U64(), 0 ) ;
|
||||||
|
|
||||||
// follow parent recursively
|
// Upload file if it is changed and remove if not.
|
||||||
if ( m_parent->m_state == local_new || m_parent->m_state == remote_deleted )
|
// State will be updated to sync/remote_changed in FromRemote()
|
||||||
m_state = m_parent->m_state ;
|
m_state = is_changed ? local_new : remote_deleted;
|
||||||
else
|
if ( m_state == local_new )
|
||||||
{
|
{
|
||||||
// Upload file if it is changed and remove if not.
|
// local_new means this file is changed in local.
|
||||||
// State will be updated to sync/remote_changed in FromRemote()
|
// this means we can't delete any of its parents.
|
||||||
m_state = is_changed ? local_new : remote_deleted;
|
// make sure their state is also set to local_new.
|
||||||
|
Resource *p = m_parent;
|
||||||
|
while ( p && p->m_state == remote_deleted )
|
||||||
|
{
|
||||||
|
p->m_state = local_new;
|
||||||
|
p = p->m_parent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue