mirror of https://github.com/digint/btrbk
btrbk: set c_default for config keys with computed default
Suppress "Option redefined" warning for snapshot_name config option,
which has hardcoded (computed) default already set when checking.
fix regression: 0ebe2ea2e1
pull/204/merge
parent
e75cf0c72c
commit
6f38536052
6
btrbk
6
btrbk
|
@ -76,7 +76,7 @@ my %config_options = (
|
||||||
# NOTE: files "." and "no" map to <undef>
|
# NOTE: files "." and "no" map to <undef>
|
||||||
timestamp_format => { default => "short", accept => [ "short", "long", "long-iso" ], context => [ "root", "volume", "subvolume" ] },
|
timestamp_format => { default => "short", accept => [ "short", "long", "long-iso" ], context => [ "root", "volume", "subvolume" ] },
|
||||||
snapshot_dir => { default => undef, accept_file => { relative => 1 }, context => [ "root", "volume", "subvolume" ] },
|
snapshot_dir => { default => undef, accept_file => { relative => 1 }, context => [ "root", "volume", "subvolume" ] },
|
||||||
snapshot_name => { default => undef, accept_file => { name_only => 1 }, context => [ "subvolume" ], deny_glob_context => 1 }, # NOTE: defaults to the subvolume name (hardcoded)
|
snapshot_name => { c_default => 1, accept_file => { name_only => 1 }, context => [ "subvolume" ], deny_glob_context => 1 }, # NOTE: defaults to the subvolume name (hardcoded)
|
||||||
snapshot_create => { default => "always", accept => [ "no", "always", "ondemand", "onchange" ], context => [ "root", "volume", "subvolume" ] },
|
snapshot_create => { default => "always", accept => [ "no", "always", "ondemand", "onchange" ], context => [ "root", "volume", "subvolume" ] },
|
||||||
incremental => { default => "yes", accept => [ "yes", "no", "strict" ] },
|
incremental => { default => "yes", accept => [ "yes", "no", "strict" ] },
|
||||||
preserve_day_of_week => { default => "sunday", accept => [ (keys %day_of_week_map) ] },
|
preserve_day_of_week => { default => "sunday", accept => [ (keys %day_of_week_map) ] },
|
||||||
|
@ -3247,8 +3247,10 @@ sub append_config_option($$$$;@)
|
||||||
$value = $aref;
|
$value = $aref;
|
||||||
}
|
}
|
||||||
elsif(exists($config->{$key})) {
|
elsif(exists($config->{$key})) {
|
||||||
|
unless($opt->{c_default}) { # note: computed defaults are already present
|
||||||
WARN "Option \"$key\" redefined $error_statement";
|
WARN "Option \"$key\" redefined $error_statement";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TRACE "adding option \"$key=$value\" to $context context";
|
TRACE "adding option \"$key=$value\" to $context context";
|
||||||
$value = undef if($value eq "no"); # we don't want to check for "no" all the time
|
$value = undef if($value eq "no"); # we don't want to check for "no" all the time
|
||||||
|
@ -3302,7 +3304,7 @@ sub parse_config_line($$$$$)
|
||||||
# SUBSECTION => [], # handled by target propagation
|
# SUBSECTION => [], # handled by target propagation
|
||||||
rel_path => $rel_path,
|
rel_path => $rel_path,
|
||||||
url => $cur->{url} . '/' . $rel_path,
|
url => $cur->{url} . '/' . $rel_path,
|
||||||
snapshot_name => $snapshot_name,
|
snapshot_name => $snapshot_name, # computed default to subvolume name (c_default)
|
||||||
};
|
};
|
||||||
$subvolume->{GLOB_CONTEXT} = 1 if($value =~ /\*/);
|
$subvolume->{GLOB_CONTEXT} = 1 if($value =~ /\*/);
|
||||||
push(@{$cur->{SUBSECTION}}, $subvolume);
|
push(@{$cur->{SUBSECTION}}, $subvolume);
|
||||||
|
|
Loading…
Reference in New Issue