From: Mikhail Subject: got: rm * removes current directory To: gameoftrees@openbsd.org Date: Sat, 27 May 2023 10:58:41 +0300 core:~/work/got$ cd got core:~/work/got/got$ ls Makefile git-repository.5 got-worktree.5 got.1 got.c got.conf.5 core:~/work/got/got$ got rm * D got/Makefile D got/git-repository.5 D got/got-worktree.5 D got/got.1 D got/got.c D got/got.conf.5 core:~/work/got/got$ ls colorls: .: No such file or directory core:~/work/got/got$ cd .. core:~/work/got$ ls got colorls: got: No such file or directory git rm * removes only files, not current directory in case this is a bug here is a test case: diff /home/misha/work/got commit - 77fc0a255189c6c18e1ea0d6ea82ae1d0ddb4ea7 path + /home/misha/work/got blob - 6d656a615120185ccc425dcf94d85399757b7de5 file + regress/cmdline/rm.sh --- regress/cmdline/rm.sh +++ regress/cmdline/rm.sh @@ -689,7 +689,27 @@ test_rm_nonexistent_directory() { test_done "$testroot" "$ret" } +test_rm_asterisk() { + local testroot=`test_init rm_asterisk` + got checkout $testroot/repo $testroot/wt > /dev/null + ret=$? + if [ $ret -ne 0 ]; then + test_done "$testroot" "$ret" + return 1 + fi + + (cd $testroot/wt/epsilon && got rm * > /dev/null) + + if [ ! -e $testroot/tw/epsilon ]; then + echo "epsilon directory doesn't exist" >&2 + test_done "$testroot" "1" + return 1 + fi + + test_done "$testroot" "0" +} + test_parseargs "$@" run_test test_rm_basic run_test test_rm_with_local_mods @@ -701,3 +721,4 @@ run_test test_rm_nonexistent_directory run_test test_rm_symlink run_test test_rm_status_code run_test test_rm_nonexistent_directory +run_test test_rm_asterisk