stow icon indicating copy to clipboard operation
stow copied to clipboard

Implement the `--orig` command (#4)

Open H3mul opened this issue 4 years ago • 3 comments

Implemented the simple version of the proposal for feature #4.

This should resolve simple file conflicts while stowing by moving them to an .orig copy in the file location and then symlinking the target to the stow.

Added bonus: when using --orig with an unstow, it restores those .orig files back, so stow + unstow should leave the host filesystem untouched. This has no effect on unstow file conflicts.

I didn't need the flexibility of supplying the extension as another arg, or copying the backups to a different dir (as described in a further comment), but I'll be happy to implement if that feature has more demand!

H3mul avatar Jun 01 '21 00:06 H3mul

Coverage Status

Coverage increased (+0.2%) to 86.465% when pulling 613599377bc56f2627ab6b1a3040471453082471 on H3mul:feature-4-orig-command into 4ef5eca4a9d107b24e712bb4c2c91f47e7e0fb85 on aspiers:master.

coveralls avatar Jun 01 '21 00:06 coveralls

Thanks for this! It would be really useful to have this ability to ignore conflicts, especially for people like me who manage their dotfiles with stow :-)

however, I would have 2 remarks:

  • Would it be possible to name this option --backup, instead of --orig? There are at least 2 good old unix tools (see cp and mv) that use this syntax and as the goal is the same it would probably be better to use the same naming.
  • In the same idea of following the way cp and mv work, we could use the ~ suffix instead of .orig for renaming files

orel1 avatar Sep 14 '21 12:09 orel1