Change debug indentation in some helpers

These helpers can be called at more deeply nested levels, so they
should be indented more than they were.
This commit is contained in:
Adam Spiers 2024-04-01 21:32:30 +01:00
parent 08e1c902ec
commit a337a2fcd0

View file

@ -1806,7 +1806,7 @@ sub link_task_action {
my ($path) = @_;
if (! exists $self->{link_task_for}{$path}) {
debug(4, 1, "link_task_action($path): no task");
debug(4, 4, "| link_task_action($path): no task");
return '';
}
@ -1838,7 +1838,7 @@ sub dir_task_action {
my ($path) = @_;
if (! exists $self->{dir_task_for}{$path}) {
debug(4, 1, "dir_task_action($path): no task");
debug(4, 4, "| dir_task_action($path): no task");
return '';
}
@ -1846,7 +1846,7 @@ sub dir_task_action {
internal_error("bad task action: $action")
unless $action eq 'remove' or $action eq 'create';
debug(4, 1, "dir_task_action($path): dir task exists with action $action");
debug(4, 4, "| dir_task_action($path): dir task exists with action $action");
return $action;
}
@ -1872,15 +1872,15 @@ sub parent_link_scheduled_for_removal {
my $prefix = '';
for my $part (split m{/+}, $path) {
$prefix = join_paths($prefix, $part);
debug(5, 2, "parent_link_scheduled_for_removal($path): prefix $prefix");
debug(5, 4, "| parent_link_scheduled_for_removal($path): prefix $prefix");
if (exists $self->{link_task_for}{$prefix} and
$self->{link_task_for}{$prefix}->{action} eq 'remove') {
debug(4, 2, "parent_link_scheduled_for_removal($path): link scheduled for removal");
debug(4, 4, "| parent_link_scheduled_for_removal($path): link scheduled for removal");
return 1;
}
}
debug(4, 2, "parent_link_scheduled_for_removal($path): returning false");
debug(4, 4, "| parent_link_scheduled_for_removal($path): returning false");
return 0;
}
@ -1902,15 +1902,15 @@ a non-existent link is scheduled for creation.
sub is_a_link {
my $self = shift;
my ($path) = @_;
debug(4, 1, "is_a_link($path)");
debug(4, 2, "is_a_link($path)");
if (my $action = $self->link_task_action($path)) {
if ($action eq 'remove') {
debug(4, 1, "is_a_link($path): returning 0 (remove action found)");
debug(4, 2, "is_a_link($path): returning 0 (remove action found)");
return 0;
}
elsif ($action eq 'create') {
debug(4, 1, "is_a_link($path): returning 1 (create action found)");
debug(4, 2, "is_a_link($path): returning 1 (create action found)");
return 1;
}
}
@ -1918,11 +1918,11 @@ sub is_a_link {
if (-l $path) {
# Check if any of its parent are links scheduled for removal
# (need this for edge case during unfolding)
debug(4, 1, "is_a_link($path): is a real link");
debug(4, 2, "is_a_link($path): is a real link");
return $self->parent_link_scheduled_for_removal($path) ? 0 : 1;
}
debug(4, 1, "is_a_link($path): returning 0");
debug(4, 2, "is_a_link($path): returning 0");
return 0;
}
@ -1986,7 +1986,7 @@ sure we are not just following a link.
sub is_a_node {
my $self = shift;
my ($path) = @_;
debug(4, 1, "Checking whether $path is a current/planned node");
debug(4, 4, "| Checking whether $path is a current/planned node");
my $laction = $self->link_task_action($path);
my $daction = $self->dir_task_action($path);
@ -2037,11 +2037,11 @@ sub is_a_node {
return 0 if $self->parent_link_scheduled_for_removal($path);
if (-e $path) {
debug(4, 1, "is_a_node($path): really exists");
debug(4, 3, "| is_a_node($path): really exists");
return 1;
}
debug(4, 1, "is_a_node($path): returning false");
debug(4, 3, "| is_a_node($path): returning false");
return 0;
}
@ -2067,7 +2067,7 @@ sub read_a_link {
my ($link) = @_;
if (my $action = $self->link_task_action($link)) {
debug(4, 1, "read_a_link($link): task exists with action $action");
debug(4, 2, "read_a_link($link): task exists with action $action");
if ($action eq 'create') {
return $self->{link_task_for}{$link}->{source};
@ -2079,7 +2079,7 @@ sub read_a_link {
}
}
elsif (-l $link) {
debug(4, 1, "read_a_link($link): real link");
debug(4, 2, "read_a_link($link): real link");
my $link_dest = readlink $link or error("Could not read link: $link ($!)");
return $link_dest;
}