ztombol / bats-file

Common filesystem assertions for Bats
Creative Commons Zero v1.0 Universal
51 stars 50 forks source link

temp_del fails if the temporary folder has a git repository #5

Open mlopes opened 7 years ago

mlopes commented 7 years ago

I'm using bats-file to test a git plugin I'm writing in bash, so I use temp_make to create a folder run the test and then temp_del to remove the folder. Because of the permissions git sets on the .git folder, when temp_del invokes rm, it asks for user confirmation and blocks the tests.

I've worked around it by pipping yes to the command. replacing result="$(rm -r -- "$path" 2>&1)" with result="$(yes | rm -r -- "$path" 2>&1)"

An alternative would be to use -fr instead of just -r, but I thought that would be a bit too risky. If you think this might be worth a fix, I can push it upstream and make a PR.