mirror of
https://codeberg.org/h3xx/simplify_static_dir
synced 2024-08-14 23:57:24 +00:00
Fix issue where mixed readonly/read-write dirs didn't hard link
This commit is contained in:
parent
76da187807
commit
8fdf3069ba
2 changed files with 14 additions and 3 deletions
|
@ -14,6 +14,11 @@ All notable changes to this project will be documented in this file.
|
||||||
- Omit output of progress bar unless -v flag is present
|
- Omit output of progress bar unless -v flag is present
|
||||||
- Add thousands separator commas to output
|
- Add thousands separator commas to output
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed issue where removable files wouldn't be linked with non-removable
|
||||||
|
files.
|
||||||
|
|
||||||
## [3.0.0]
|
## [3.0.0]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -145,17 +145,23 @@ sub instructions {
|
||||||
my ($oldest_entry) = _oldest_mtime(@{$bucket});
|
my ($oldest_entry) = _oldest_mtime(@{$bucket});
|
||||||
|
|
||||||
# Limit link/unlink operations to files in non-readonly directories
|
# Limit link/unlink operations to files in non-readonly directories
|
||||||
my @non_readonly;
|
my (@non_readonly, @readonly);
|
||||||
foreach my $entry (@{$bucket}) {
|
foreach my $entry (@{$bucket}) {
|
||||||
unless (-w $entry->{dirname}) {
|
unless (-w $entry->{dirname}) {
|
||||||
carp "Warning: $entry->{name} not able to be unlinked!";
|
carp "Warning: $entry->{name} not able to be unlinked!";
|
||||||
|
push @readonly, $entry;
|
||||||
|
} else {
|
||||||
|
push @non_readonly, $entry;
|
||||||
}
|
}
|
||||||
push @non_readonly, $entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Of the linkable files, find the file most embedded in the file system
|
# Of the linkable files, find the file most embedded in the file system
|
||||||
my @to_link = _more_linked(@non_readonly);
|
my @to_link = _more_linked(@non_readonly);
|
||||||
my $most_linked_entry = shift @to_link;
|
@readonly = _more_linked(@readonly);
|
||||||
|
|
||||||
|
# Select a basis for linkage, either the most-linked readonly entry (if
|
||||||
|
# any) or the most linked of the read-write entries.
|
||||||
|
my $most_linked_entry = shift @readonly // shift @to_link;
|
||||||
foreach my $entry (@to_link) {
|
foreach my $entry (@to_link) {
|
||||||
# XXX there shouldn't be a need to update entries' link counts,
|
# XXX there shouldn't be a need to update entries' link counts,
|
||||||
# since this generates all the instructions at once
|
# since this generates all the instructions at once
|
||||||
|
|
Loading…
Reference in a new issue