#!/bin/sh global test_description := '"Test git-clean performance'" source ./perf-lib.sh test_perf_default_repo test_checkout_worktree test_expect_success 'setup untracked directory with many sub dirs' ' rm -rf 500_sub_dirs 100000_sub_dirs clean_test_dir && mkdir 500_sub_dirs 100000_sub_dirs clean_test_dir && for i in $(test_seq 1 500) do mkdir 500_sub_dirs/dir$i || return $? done && for i in $(test_seq 1 200) do cp -r 500_sub_dirs 100000_sub_dirs/dir$i || return $? done ' test_perf 'clean many untracked sub dirs, check for nested git' ' git clean -n -q -f -d 100000_sub_dirs/ ' test_perf 'clean many untracked sub dirs, ignore nested git' ' git clean -n -q -f -f -d 100000_sub_dirs/ ' test_perf 'ls-files -o' ' git ls-files -o ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(DQ ("Test git-clean performance"))} spids: [4] ) ] spids: [4] ) (C {(.)} {(./perf-lib.sh)}) (C {(test_perf_default_repo)}) (C {(test_checkout_worktree)}) (C {(test_expect_success)} {(SQ <"setup untracked directory with many sub dirs">)} { (SQ <"\n"> <"\trm -rf 500_sub_dirs 100000_sub_dirs clean_test_dir &&\n"> <"\tmkdir 500_sub_dirs 100000_sub_dirs clean_test_dir &&\n"> <"\tfor i in $(test_seq 1 500)\n"> <"\tdo\n"> <"\t\tmkdir 500_sub_dirs/dir$i || return $?\n"> <"\tdone &&\n"> <"\tfor i in $(test_seq 1 200)\n"> <"\tdo\n"> <"\t\tcp -r 500_sub_dirs 100000_sub_dirs/dir$i || return $?\n"> <"\tdone\n"> ) } ) (C {(test_perf)} {(SQ <"clean many untracked sub dirs, check for nested git">)} {(SQ <"\n"> <"\tgit clean -n -q -f -d 100000_sub_dirs/\n">)} ) (C {(test_perf)} {(SQ <"clean many untracked sub dirs, ignore nested git">)} {(SQ <"\n"> <"\tgit clean -n -q -f -f -d 100000_sub_dirs/\n">)} ) (C {(test_perf)} {(SQ <"ls-files -o">)} {(SQ <"\n"> <"\tgit ls-files -o\n">)}) (C {(test_done)}) ] )