echo bogus.local >> $local_list
common=$(diff -u $remote_list $local_list | grep '^ ' | tail -n 1)
-ssh $remote $zfs send -R -I${common/*@/@} $latest |
- $zfs receive -vF -d ${local_pool}/${remote_fs%/*}
+if [ -n "$common" ]; then
+ # We found a common snapshot
+ ssh $remote $zfs send -R -I${common/*@/@} $latest |
+ $zfs receive -vF -d ${local_pool}/${remote_fs%/*}
+else
+ # We did not find a common snapshot, so send the entire filesystem
+ ssh $remote $zfs send -R $latest |
+ $zfs receive -vF -d ${local_pool}/${remote_fs%/*}
+endif
rm -f $local_list $remote_list