Start the 2.46 cycle
[git.git] / t / lib-unique-files.sh
bloba14080fe79b45ceac4adba31d3323fee32f79aba
1 # Helper to create files with unique contents
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.
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.
12 test_create_unique_files () {
13 test "$#" -ne 3 && BUG "3 param"
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)
26 local dir="$basedir/dir$i" &&
27 mkdir -p "$dir" &&
28 for j in $(test_seq $files)
30 counter=$((counter + 1)) &&
31 echo "$basedata.$counter">"$dir/file$j.txt"
32 done
33 done