`mv` should preserve hardlinks and allow faster unpack on the same
filesystem. A secondary pass is done with `cp` to copy over attributes
onto any existing directories.
We only run this for nested unpacks as most direct Directory strategy
usage is for repositories where moving files breaks existing code.
This uses `cp -pR` for non-move as some potential user reported issues
could be due to Apple's `cp -l` on specific macOS versions. Can
consider re-adding `cp -l` with better handling for older macOS.
- I put a debugger call in the test that was failing.
- Running the install command at that debug prompt and lo,
the typing bug was staring me in the face:
```
Error: An exception occurred within a child process:
TypeError: Parameter 'ref_type': Expected type T.nilable(String), got type Symbol with value :branch
Caller: /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11471/lib/types/private/methods/call_validation.rb:215
Definition: /opt/homebrew/Library/Homebrew/unpack_strategy.rb:102 (UnpackStrategy.detect)
```
Instead of only looking at the extension when invoked as part of
Homebrew's formulae' download strategies instead prioritise the
extension if it actually exists. When it does not, fall back to the
magic detection logic which is likely to be more reliable.
Fixes https://github.com/Homebrew/brew/issues/5895
Adjust the rules based on the current codebase. Remove various enable,
disables and default values that are unnecessary. Add more comments
explaining why. Make minor changes needed to enable a few more rules.