r-lib / usethis

Set up commonly used 📦 components

Home Page:https://usethis.r-lib.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rename_files breaks with . in old or new

jonthegeek opened this issue · comments

I'm not sure how to create a complete reprex for this. I definitely recommend making sure everything is committed in whatever directory you're using if you're in a real project.

I was trying to organize a directory better, and had the idea of using "." within some filenames. It wouldn't have actually sorted how I want, but I would have seen that when I tried.

Except it truncated at the ., so

rename_files("generate_security", "generate_pkg.security")

was treated as

rename_files("generate_security", "generate_pkg")

Once I ran it it made sense, but I wasn't expecting it, and it made a mess of some things. I think I've recovered everything, but it would definitely be possible to lose work.

I'd recommend either requiring a confirmation if anything other than .R would be truncated, and/or maybe requiring that all work be checked in before running (rather than just checking for using git).

I can probably PR if you'd like to implement this. Let me know if you have a preference for what to implement.

@jonthegeek I'm going to put the tidyverse dev day label on here. It looks like you'll be there? Maybe you can address this or supervise someone else who picks it up. Sounds like this is still in a "needs more investigation" state.

@jennybc Sounds good! I was a bit meander-y in that description, but I think the main thing will be figuring out how you want it to work. I'm at "Eek that was scary and unexpected," but I'm not certain which protection(s) make sense.