mirror of https://github.com/octoleo/lsyncd.git
cosmetics
This commit is contained in:
parent
178f315907
commit
85e95ef150
|
@ -299,9 +299,7 @@ rsync.prepare = function(
|
||||||
skipTarget -- used by rsyncssh, do not check for target
|
skipTarget -- used by rsyncssh, do not check for target
|
||||||
)
|
)
|
||||||
|
|
||||||
--
|
|
||||||
-- First let default.prepare test the checkgauge
|
-- First let default.prepare test the checkgauge
|
||||||
--
|
|
||||||
default.prepare( config, level + 6 )
|
default.prepare( config, level + 6 )
|
||||||
|
|
||||||
if not skipTarget and not config.target then
|
if not skipTarget and not config.target then
|
||||||
|
@ -364,14 +362,10 @@ rsync.prepare = function(
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
|
||||||
-- computes the rsync arguments into one list
|
-- computes the rsync arguments into one list
|
||||||
--
|
|
||||||
local crsync = config.rsync;
|
local crsync = config.rsync;
|
||||||
|
|
||||||
--
|
|
||||||
-- everything implied by archive = true
|
-- everything implied by archive = true
|
||||||
--
|
|
||||||
local archiveFlags = {
|
local archiveFlags = {
|
||||||
recursive = true,
|
recursive = true,
|
||||||
links = true,
|
links = true,
|
||||||
|
@ -386,9 +380,7 @@ rsync.prepare = function(
|
||||||
xattrs = false,
|
xattrs = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--
|
-- if archive is given the implications are filled in
|
||||||
-- if archive given the implications are filled in
|
|
||||||
--
|
|
||||||
if crsync.archive then
|
if crsync.archive then
|
||||||
for k, v in pairs( archiveFlags ) do
|
for k, v in pairs( archiveFlags ) do
|
||||||
if crsync[ k ] == nil then
|
if crsync[ k ] == nil then
|
||||||
|
|
8
lsyncd.c
8
lsyncd.c
|
@ -2085,8 +2085,11 @@ masterloop(lua_State *L)
|
||||||
// queries the runner about the soonest alarm
|
// queries the runner about the soonest alarm
|
||||||
//
|
//
|
||||||
load_runner_func( L, "getAlarm" );
|
load_runner_func( L, "getAlarm" );
|
||||||
|
|
||||||
if( lua_pcall( L, 0, 1, -2 ) )
|
if( lua_pcall( L, 0, 1, -2 ) )
|
||||||
{ exit( -1 ); }
|
{
|
||||||
|
exit( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
if( lua_type( L, -1 ) == LUA_TBOOLEAN)
|
if( lua_type( L, -1 ) == LUA_TBOOLEAN)
|
||||||
{
|
{
|
||||||
|
@ -2098,6 +2101,7 @@ masterloop(lua_State *L)
|
||||||
have_alarm = true;
|
have_alarm = true;
|
||||||
alarm_time = *( ( clock_t * ) luaL_checkudata( L, -1, "Lsyncd.jiffies" ) );
|
alarm_time = *( ( clock_t * ) luaL_checkudata( L, -1, "Lsyncd.jiffies" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_pop( L, 2 );
|
lua_pop( L, 2 );
|
||||||
|
|
||||||
if(
|
if(
|
||||||
|
@ -2200,6 +2204,7 @@ masterloop(lua_State *L)
|
||||||
{
|
{
|
||||||
// walks through the observances calling ready/writey
|
// walks through the observances calling ready/writey
|
||||||
observance_action = true;
|
observance_action = true;
|
||||||
|
|
||||||
for( pi = 0; pi < observances_len; pi++ )
|
for( pi = 0; pi < observances_len; pi++ )
|
||||||
{
|
{
|
||||||
struct observance *obs = observances + pi;
|
struct observance *obs = observances + pi;
|
||||||
|
@ -2339,6 +2344,7 @@ masterloop(lua_State *L)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| The effective main for one run.
|
| The effective main for one run.
|
||||||
|
|
|
||||||
| HUP signals may cause several runs of the one main.
|
| HUP signals may cause several runs of the one main.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
|
24
lsyncd.lua
24
lsyncd.lua
|
@ -1454,7 +1454,7 @@ local Excludes = ( function( )
|
||||||
end )( )
|
end )( )
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Holds information about one observed directory inclusively subdirs.
|
-- Holds information about one observed directory including subdirs.
|
||||||
--
|
--
|
||||||
local Sync = ( function( )
|
local Sync = ( function( )
|
||||||
|
|
||||||
|
@ -1486,6 +1486,7 @@ local Sync = ( function( )
|
||||||
-- Removes a delay.
|
-- Removes a delay.
|
||||||
--
|
--
|
||||||
local function removeDelay( self, delay )
|
local function removeDelay( self, delay )
|
||||||
|
|
||||||
if self.delays[ delay.dpos ] ~= delay then
|
if self.delays[ delay.dpos ] ~= delay then
|
||||||
error( 'Queue is broken, delay not a dpos' )
|
error( 'Queue is broken, delay not a dpos' )
|
||||||
end
|
end
|
||||||
|
@ -1494,9 +1495,13 @@ local Sync = ( function( )
|
||||||
|
|
||||||
-- free all delays blocked by this one.
|
-- free all delays blocked by this one.
|
||||||
if delay.blocks then
|
if delay.blocks then
|
||||||
|
|
||||||
for i, vd in pairs( delay.blocks ) do
|
for i, vd in pairs( delay.blocks ) do
|
||||||
|
|
||||||
vd.status = 'wait'
|
vd.status = 'wait'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1507,18 +1512,25 @@ local Sync = ( function( )
|
||||||
|
|
||||||
-- not concerned if watch rootdir doesnt match
|
-- not concerned if watch rootdir doesnt match
|
||||||
if not path:starts( self.source ) then
|
if not path:starts( self.source ) then
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- a sub dir and not concerned about subdirs
|
-- a sub dir and not concerned about subdirs
|
||||||
if self.config.subdirs == false and
|
if self.config.subdirs == false and
|
||||||
|
|
||||||
path:sub( #self.source, -1 ):match( '[^/]+/?' )
|
path:sub( #self.source, -1 ):match( '[^/]+/?' )
|
||||||
|
|
||||||
then
|
then
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- concerned if not excluded
|
-- concerned if not excluded
|
||||||
return not self.excludes:test( path:sub( #self.source ) )
|
return not self.excludes:test( path:sub( #self.source ) )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -1640,6 +1652,7 @@ local Sync = ( function( )
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert( oldDelay.blocks, newDelay )
|
table.insert( oldDelay.blocks, newDelay )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -1661,6 +1674,7 @@ local Sync = ( function( )
|
||||||
local function recurse( )
|
local function recurse( )
|
||||||
|
|
||||||
if etype == 'Create' and path:byte( -1 ) == 47 then
|
if etype == 'Create' and path:byte( -1 ) == 47 then
|
||||||
|
|
||||||
local entries = lsyncd.readdir( self.source .. path )
|
local entries = lsyncd.readdir( self.source .. path )
|
||||||
|
|
||||||
if entries then
|
if entries then
|
||||||
|
@ -2062,6 +2076,7 @@ local Sync = ( function( )
|
||||||
-- Creates a new Sync
|
-- Creates a new Sync
|
||||||
--
|
--
|
||||||
local function new( config )
|
local function new( config )
|
||||||
|
|
||||||
local s = {
|
local s = {
|
||||||
-- fields
|
-- fields
|
||||||
|
|
||||||
|
@ -2111,6 +2126,7 @@ local Sync = ( function( )
|
||||||
else
|
else
|
||||||
error( 'type for exclude must be table or string', 2 )
|
error( 'type for exclude must be table or string', 2 )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if
|
if
|
||||||
|
@ -2124,7 +2140,9 @@ local Sync = ( function( )
|
||||||
end
|
end
|
||||||
|
|
||||||
if config.excludeFrom then
|
if config.excludeFrom then
|
||||||
|
|
||||||
s.excludes:loadFile( config.excludeFrom )
|
s.excludes:loadFile( config.excludeFrom )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
@ -2133,7 +2151,9 @@ local Sync = ( function( )
|
||||||
--
|
--
|
||||||
-- Public interface
|
-- Public interface
|
||||||
--
|
--
|
||||||
return { new = new }
|
return {
|
||||||
|
new = new
|
||||||
|
}
|
||||||
|
|
||||||
end )( )
|
end )( )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue