Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/lib-unique-files.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / lib-unique-files.sh` 34 lines ยท 877 bytes Raw Blame History 1 # Helper to create files with unique contents 2 3 # Create multiple files with unique contents within this test run. Takes the 4 # number of directories, the number of files in each directory, and the base 5 # directory. 6 # 7 # test_create_unique_files 2 3 my_dir -- Creates 2 directories with 3 files 8 # each in my_dir, all with contents 9 # different from previous invocations 10 # of this command in this run. 11 12 test_create_unique_files () { 13 test "$#" -ne 3 && BUG "3 param" 14 15 local dirs="$1" && 16 local files="$2" && 17 local basedir="$3" && 18 local counter="0" && 19 local i && 20 local j && 21 test_tick && 22 local basedata="$basedir$test_tick" && 23 rm -rf "$basedir" && 24 for i in $(test_seq $dirs) 25 do 26 local dir="$basedir/dir$i" && 27 mkdir -p "$dir" && 28 for j in $(test_seq $files) 29 do 30 counter=$((counter + 1)) && 31 echo "$basedata.$counter">"$dir/file$j.txt" 32 done 33 done 34 }