Commit graph

504 commits

Author SHA1 Message Date
Adam Spiers
c2da8b416d do_link(): improve variable names 2024-04-01 00:34:19 +01:00
Adam Spiers
48c6b5956b Add emacs config to prevent insertion of hard tabs 2024-04-01 00:07:33 +01:00
Adam Spiers
bffc347a19 Remove hard tabs 2024-04-01 00:06:24 +01:00
Adam Spiers
8c09d41054 add unit tests for adjust_dotfiles() 2024-03-31 23:52:00 +01:00
Adam Spiers
2f762e3908 Merge commit 'pullreqs/70' into dev 2024-03-31 23:41:02 +01:00
Adam Spiers
e8c46cf058 manual: disambiguate meaning of "source" 2024-03-31 23:20:22 +01:00
Adam Spiers
373ef62e70 manual: clarify that installation image is pre-installation 2024-03-31 23:20:22 +01:00
Adam Spiers
245dc83849 Stow.pm: reformat old comment style as pod
As previously noted, the old comment style was difficult to edit.
It's also not idiomatic Perl style, so reformat as pod.  This exposes
more of the inner workings of Stow as documentation, but that
shouldn't be a problem.

As part of this change, remove outdated and sometimes misleading
information about if/when each function throws an exception.
2024-03-31 23:19:08 +01:00
Adam Spiers
f4f3836c5f Stow.pm: rename $ldest to $link_dest for clarity 2024-03-31 15:38:38 +01:00
Adam Spiers
1be40c0532 Stow.pm: reformat comments
Some methods had comments with a prefix which made the paragraph
inconveniently narrow, and made refilling it really awkward.  So
switch to a more natural comment style.
2024-03-31 15:33:14 +01:00
Adam Spiers
11d4ff01d7 manual: avoid double spaces after "i.e." 2024-03-31 15:25:35 +01:00
Adam Spiers
2791d00d06 manual: Expand the definition of symlinks and disambiguate "target"
Target can have two opposing meanings:

1. the target directory where symlinks are managed by Stow, and
2. the destinations of those symlinks

So try to move away from this by using the word "destination" for
symlinks.
2024-03-31 15:25:26 +01:00
Adam Spiers
d12f107f3c NEWS: more updates in preparation for next release 2024-03-31 14:11:36 +01:00
Adam Spiers
8436768144 Eliminate erroneous warning when unstowing (#65)
When unstowing a package, cleanup_invalid_links() is invoked to remove
any invalid links owned by Stow.  It was invoking link_owned_by_package()
to check whether each existing link is owned by Stow.  This in turn
called find_stowed_path() which since 40a0807185 was not allowing for
the possibility that it could be passed a symlink *not* owned by Stow
with an absolute target and consequently emitting an erroneous warning.

So remove this erroneous warning, and refactor find_stowed_path()
to use two new helper functions for detecting stow directories:
link_dest_within_stow_dir() and find_containing_marked_stow_dir().
Also refactor the logic within each to be simpler and more accurate,
and add more test cases to the corresponding parts of the test suite.

Fixes #65.
Closes #103.

https://github.com/aspiers/stow/issues/65
2024-03-31 14:03:47 +01:00
Adam Spiers
877fc0ce7e cleanup_invalid_links: add test for non-cleanup of an unowned link 2024-03-31 12:24:02 +01:00
Adam Spiers
541faf68eb cleanup_invalid_links: improve docs 2024-03-31 12:16:42 +01:00
Adam Spiers
08b06ccb40 t/cleanup_invalid_links: divide into subtests
This makes the code and test output both more legible.
2024-03-31 12:16:42 +01:00
Adam Spiers
a2beb7b371 Separate treatment of .stow and .nonstow marked dirs
Placing a .stow file in a directory tells Stow that this directory
should be considered a Stow directory.  This is already
well-documented.

There was an undocumented and slightly broken feature where placing a
.nonstow file in a directory was treated in exactly the same way.  The
intention was for .nonstow to cause Stow to skip stowing into and
unstowing from that directory and any of its descendants.  However, it
also caused Stow to consider symlinks into any of those directories as
owned by Stow, even though that was clearly not the intention.  So
separate treatment of .stow and .nonstow markers, so that while both
provide protection against Stow stowing and unstowing, only .stow
affects the symlink ownership logic in find_stowed_path() and
marked_stow_dir().

Probably no one uses the undocumented .nonstow feature, so it may make
sense to remove this in future.
2024-03-31 12:15:53 +01:00
Adam Spiers
287d8016f6 join_paths: improve docs to clarify purpose / differences
join_paths() is used in specific ways and has specific behaviour
required which is nuanced and not obvious at first sight.  So make
this explicit for future reference.
2024-03-31 12:04:09 +01:00
Adam Spiers
4d711fc4ac Make join_paths correctly handle absolute paths
Previously join_paths() was incorrectly handling absolute paths, for
example join_paths('a/b', '/c/d') would return 'a/b/c/d' rather than
'/c/d'.  This was a problem when following a symlink in
find_stowed_path(), because if the symlink was not owned by Stow and
pointed to an absolute path, find_stowed_path() might accidentally
deem the link owned by Stow, if c/d was a valid path relative to the
current directory.
2024-03-31 12:02:58 +01:00
Adam Spiers
ff4d87efaf Disable emacs auto-fill-mode
This completely messes up the current function documentation.
2024-03-31 12:02:58 +01:00
Adam Spiers
d1480195b6 Move setting of cperl-indent-level to .dir-locals.el
This removes duplication.
2024-03-31 12:02:58 +01:00
Adam Spiers
66ca2826d6 Highlight an issue with prove overriding TEST_VERBOSE 2024-03-31 12:02:57 +01:00
Adam Spiers
1657c5b772 t/find_stowed_path.t: Add a couple of missing spaces 2024-03-10 17:40:17 +00:00
Adam Spiers
9db0de3005 Add some helpful comments
Explain a few things in preparation for a bugfix.
2024-03-10 17:40:17 +00:00
Adam Spiers
aa03922520 manual: fix duplicated "of" typo 2024-03-09 17:57:04 +00:00
Adam Spiers
9ce37d9575 Remove $stow_path parameter from unstow_{contents,node}{,_orig}()
Unlike with the stow_{contents,node}{,_orig}() counterpart functions,
when unstowing, it's not necessary to pass the $stow_path parameter
because it can never differ from $self->{stow_path}.

The stow_*() functions need this for the corner case of unfolding a
tree which is stowed from a different stow directory to the one being
used for the current stowing operation (see the "Multiple Stow
Directories" section of the manual).
2024-03-09 17:57:04 +00:00
Adam Spiers
4e2776224f Tweak text of error and debug messages 2024-03-09 17:57:04 +00:00
Adam Spiers
b7bf77da52 Add a missing period to the stow_contents() comments. 2024-03-09 17:57:04 +00:00
Adam Spiers
72084f6fec Add a comment explaining that $node_target can be adjusted for dot- prefix 2024-03-09 17:57:04 +00:00
Adam Spiers
a3700e7171 Add a comment explaining path in stow_contents() 2024-03-09 17:57:04 +00:00
Adam Spiers
20bee7428e Add a comment explaining $stow_path parameter of stow_contents()
At first sight this parameter looks redundant since we have
$self->{stow_path}, but in one case the value can differ from that,
so mention that explicitly.
2024-03-09 17:57:04 +00:00
Adam Spiers
f51fc1248c plan_*: rename $path to $pkg_path for clarity
$path is a vague variable name.
2024-03-09 17:57:04 +00:00
Adam Spiers
457fa98527 dotfiles.t: improve comment descriptions 2024-03-09 17:57:04 +00:00
Adam Spiers
6519ee8426 aclocal.m4: update to 1.16.5 2024-03-09 17:56:57 +00:00
Adam Spiers
5d4e68291e testutil: Add sanity check for cwd 2024-03-09 17:56:57 +00:00
Adam Spiers
2c7d3d4762 manual: update the Reporting Bugs / Known Bugs sections 2024-03-09 17:56:48 +00:00
Adam Spiers
c30792270e manual: use @email{} for email addresses 2024-03-09 17:56:41 +00:00
Adam Spiers
cb4b0c6a9a Remove trailing whitespace 2024-03-09 17:56:41 +00:00
Adam Spiers
a426a5979d testutil: clarify reason for default paths in new_Stow() 2024-03-09 17:56:29 +00:00
Adam Spiers
72140071ad manual: improve explanation of target directory definition
Bring this more up to date by mentioning the dotfiles use case.
2024-03-09 17:56:14 +00:00
Adam Spiers
478c7b921d Add watch target to Makefile for easier hacking 2024-03-09 17:56:14 +00:00
Adam Spiers
28a4e82741 CONTRIBUTING: document how to test using prove(1) 2024-03-09 17:56:02 +00:00
Adam Spiers
a829eeb4a0 Upgrade aclocal to 1.16.3 2021-04-15 15:11:30 +01:00
Adam Spiers
ee240c5bf2 cleanup_invalid_links: it's a bug if called with a non-directory 2021-04-15 15:11:30 +01:00
Adam Spiers
6870e96873 CONTRIBUTING: Add a section on how to run the tests 2021-04-15 15:11:30 +01:00
Adam Spiers
64e0dc8793 Beef up README.md and add CONTRIBUTING.md 2021-04-15 15:11:30 +01:00
Adam Spiers
205158a528 manual: request --verbose=5 for bug reports 2021-04-15 15:11:30 +01:00
Adam Spiers
5b0efb3757 AUTHORS: mention THANKS file 2021-04-15 15:11:30 +01:00
Adam Spiers
a3f526edc2 NEWS: update for 2.3.2 2021-04-15 15:11:30 +01:00