Commit graph

505 commits

Author SHA1 Message Date
Adam Spiers
6d6781dcef t/unstow_orig.t: use like() for regexp matching tests
This is better because it outputs the mismatching value when
the matching check fails.
2024-04-06 11:59:10 +01:00
Adam Spiers
599944bce1 t/unstow_orig.t: use is() for equality tests
This is better because it outputs the mismatching values when
the equality check fails.
2024-04-06 11:51:37 +01:00
Adam Spiers
bca711fac2 tests: use stderr_like() instead of home-grown STDERR capturing
The STDERR capturing in testutil just reinvents Test::Output which
we already use in chkstow.t, so it's pointless to reinvent that wheel.
2024-04-06 11:33:18 +01:00
Adam Spiers
ebfbb6cc13 testutil: rename parameter names to be less confusing
$target was the source of the link, and $source was the
target (destination) of the link.  Obviously this was hopelessly
confusing, so rename to avoid this.
2024-04-05 22:32:12 +01:00
Adam Spiers
238346f134 manual: clarify the pros and cons and history of --compat 2024-04-05 22:28:40 +01:00
Adam Spiers
4cde7eb19f t/stow.t: fix typos, whitespace, and ordering of lines 2024-04-01 23:58:17 +01:00
Adam Spiers
67081cec02 testutil: use croak() instead of die() for more useful errors 2024-04-01 23:58:17 +01:00
Adam Spiers
1282acf6b5 t/stow: use like() instead of ok(... =~ /.../) 2024-04-01 23:58:17 +01:00
Adam Spiers
4cac249ddc rename $path => $target_path in node helpers
is_a_node(), is_a_dir(), is_a_link() all operate on paths within
the target directory, so make this explicit by avoiding the vague
variable name "$path".
2024-04-01 23:58:17 +01:00
Adam Spiers
2c9065995c fold_tree: rename $target parameter to $target_subdir
$target is vague and could refer to the top-level target directory,
so rename to clarify.
2024-04-01 22:39:32 +01:00
Adam Spiers
8f6a320b50 fold_tree: rename $source parameter to $pkg_subpath
$source is vague and confusing as per the manual.
2024-04-01 22:39:32 +01:00
Adam Spiers
bae7890aa5 unstow_node / unstow_existing_node: rename foldable return value
$parent is a bit vague so rename to $parent_in_pkg.
2024-04-01 22:39:32 +01:00
Adam Spiers
b3ed86d616 unstow_valid_link: rename $existing_path
Unqualified references to "path" are horribly vague, so rename to
$existing_pkg_path_from_cwd for clarity.
2024-04-01 22:39:32 +01:00
Adam Spiers
c45a0632a9 stow_node: rename $existing_path
Unqualified references to "path" are horribly vague, so rename to
$existing_pkg_path_from_cwd for clarity.
2024-04-01 22:39:32 +01:00
Adam Spiers
3c904dade2 link_owned_by_package: rename $source => $link_dest
The use of the word "source" to describe a link's destination is
confusing in the context of Stow for reasons explained in the manual.

So rename the $source variable to avoid this.
2024-04-01 22:39:32 +01:00
Adam Spiers
381fd71155 remove or rename XXX
Remove old XXX FIXMEs which tell us nothing useful and may not be
relevant any more.

Also rename another XXX to an industry-standard FIXME.
2024-04-01 22:39:32 +01:00
Adam Spiers
221449d640 unstow_node: remove redundant return 2024-04-01 22:39:32 +01:00
Adam Spiers
a337a2fcd0 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.
2024-04-01 22:39:32 +01:00
Adam Spiers
08e1c902ec unstow_link_node: rename $existing_path
Unqualified references to "path" are horribly vague, so rename to
$existing_pkg_path_from_cwd for clarity.
2024-04-01 22:39:32 +01:00
Adam Spiers
4272e7c4bb unstow_link_node: rename $existing_source => $link_dest
The use of the word "source" to describe a link's destination is
confusing in the context of Stow for reasons explained in the manual.

So rename the $existing_source variable to $link_dest avoid this.
2024-04-01 22:39:32 +01:00
Adam Spiers
4525b9447d unstow_contents: remove reference to "source"
The use of the word "source" is confusing in the context of Stow for
reasons explained in the manual.
2024-04-01 22:39:32 +01:00
Adam Spiers
a8c93487c3 stow_node: remove comments about implementation details from POD
These don't add much value, and the reference to $source was out of
date anyway.
2024-04-01 22:39:32 +01:00
Adam Spiers
b137191d27 stow_node: rename $second_source => $link_dest
The use of the word "source" to describe a link's destination is
confusing in the context of Stow for reasons explained in the manual.

So rename the $second_source variable to avoid this.
2024-04-01 22:39:32 +01:00
Adam Spiers
b5a467fd06 foldable: make more understandable
Improve variable names, POD, and add helpful comments.
2024-04-01 22:39:32 +01:00
Adam Spiers
cc521ec14e foldable: rename $path to $target_node_path
$path is horribly vague, so rename it to be more informative.
2024-04-01 22:39:32 +01:00
Adam Spiers
09a34e7272 foldable: add debug for different cases when not foldable 2024-04-01 22:39:32 +01:00
Adam Spiers
1b597999e2 read_a_link: improve variable names
$path is horribly vague, so rename to $link to be more informative.

Also the use of "$target" to describe a link's destination is very
confusing in the context of Stow for reasons explained in the manual.
So rename to $link_dest.
2024-04-01 22:39:32 +01:00
Adam Spiers
79f90d39b3 parent_link_scheduled_for_removal: tweak debug 2024-04-01 22:39:32 +01:00
Adam Spiers
2c255af187 t/unstow_orig: split into subtests 2024-04-01 22:39:32 +01:00
Adam Spiers
6cf41850b3 foldable: rename $target => $target_subdir
The $target variable was ambiguous, as it could have referred to the
path to the target directory, or the path to a sub-directory in the
target, as well as its intended meaning of a subpath relative to the
target directory.  So rename it to try to find the balance between
clarity and verbosity.
2024-04-01 22:39:32 +01:00
Adam Spiers
2851b36df4 find_stowed_path: rename $path / $dest to $pkg_path_from_cwd
$path is horribly vague, so rename to be more informative.
2024-04-01 22:39:32 +01:00
Adam Spiers
0daf352200 unstow_node: rename $path to $pkg_path_from_cwd
$path is horribly vague, so rename to be more informative.
2024-04-01 22:39:32 +01:00
Adam Spiers
6b9bbc9cbb link_dest_within_stow_dir: rename $path to $pkg_subpath
$path is horribly vague, so rename to be more informative.
2024-04-01 22:39:32 +01:00
Adam Spiers
170d161692 find_containing_marked_stow_dir: rename $path to $pkg_path_from_cwd
$path is horribly vague, so rename to be more informative.
2024-04-01 22:39:32 +01:00
Adam Spiers
75c892abc6 unstow_* helpers: rename $path to $pkg_path_from_cwd
$path is horribly vague, so rename to be more informative.
2024-04-01 22:39:32 +01:00
Adam Spiers
c0060443ee marked_stow_dir: rename $path to $dir
It's always a directory, so make this explicit.
2024-04-01 22:39:32 +01:00
Adam Spiers
caefb641b8 find_stowed_path: reintroduce missing comment lines
These lines were accidentally removed by 84367681.
2024-04-01 22:39:32 +01:00
Adam Spiers
10c86841de stow_contents / unstow_node: rename $target => $target_sub{dir,path}
This is very similar to a previous commit which did the same rename in
stow_node().

The $target variable was ambiguous, as it could have referred to the
path to the target directory, or the path to a sub-directory in the
target, as well as its intended meaning of a subpath relative to the
target directory.  So rename it to try to find the balance between
clarity and verbosity.
2024-04-01 22:39:32 +01:00
Adam Spiers
8a17d8b4f2 manual: use American punctuation of "vs."
GNU and Stow are both originally from the USA, so it makes sense
to stay consistent with American English.
2024-04-01 22:39:32 +01:00
Adam Spiers
0782be7106 Remove unstow_*_orig() functions
Refactor the compat mode code to reuse the existing unstow_contents()
and unstow_node().  This allows us to remove the parallel versions in
unstow_contents_orig() and unstow_node(), which contained a lot of
duplicated code and were a significant maintenance burden.
2024-04-01 22:39:32 +01:00
Adam Spiers
4054d40a2a emacs: tweak more cperl indentation config to match existing style 2024-04-01 22:39:32 +01:00
Adam Spiers
456424c560 unstow_node_orig: replace a bunch of duplicated code with unstow_link_node() 2024-04-01 22:39:32 +01:00
Adam Spiers
517384407b unstow_node: extract new unstow_existing_node() sub 2024-04-01 22:39:32 +01:00
Adam Spiers
42cc1d2e60 unstow_node: extract new unstow_link_node() sub 2024-04-01 22:39:32 +01:00
Adam Spiers
cc592bdc44 unstow_node: extract new unstow_valid_link() sub 2024-04-01 22:39:32 +01:00
Adam Spiers
1f752a3c94 stow_node: rename $target => $target_subpath
The $target variable was ambiguous, as it could have referred to the
path to the target directory, or the path to a sub-directory in the
target, as well as its intended meaning of a subpath relative to the
target directory.  So rename it to try to find the balance between
clarity and verbosity.
2024-04-01 22:39:32 +01:00
Adam Spiers
86f03d115d t/dotfiles.t: switch to subtests 2024-04-01 22:39:32 +01:00
Adam Spiers
a328c2cd4b t/stow: convert to subtests() 2024-04-01 22:39:32 +01:00
Adam Spiers
0871a483cf rename $existing_source => $existing_link_dest
Source can be ambiguous, as mentioned in the manual.
2024-04-01 00:39:18 +01:00
Adam Spiers
e0212d4f49 stow_node(): fix odd whitespace 2024-04-01 00:35:35 +01:00