Debian Codegraph @

t/t-tempfile.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 . "$(dirname "$0")/testlib.sh"
4
5 begin_test "cleans only temp files and directories older than an hour"
6 (
7 set -e
8
9 reponame="$(basename "$0" ".sh")"
10 git init "$reponame"
11 cd "$reponame"
12
13 git lfs track '*.bin'
14 echo foo > abc.bin
15 git add abc.bin
16 git commit -m 'Add abc.bin'
17
18 tmpdir=.git/lfs/tmp
19 mkdir -p "$tmpdir"
20
21 mkdir "$tmpdir/dir-to-preserve"
22 touch "$tmpdir/to-preserve"
23 touch "$tmpdir/dir-to-preserve/file"
24 # git format-patch datestamp; arbitrary timestamp in the past.
25 TZ=UTC touch -t 200109170000.00 "$tmpdir/to-destroy"
26 TZ=UTC touch -t 200109170000.00 "$tmpdir/dir-to-preserve/file"
27
28 git lfs ls-files >/dev/null
29
30 [ -f "$tmpdir/to-preserve" ]
31 [ -f "$tmpdir/dir-to-preserve/file" ]
32 [ ! -f "$tmpdir/to-destroy" ]
33 )
34 end_test