1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
#!/usr/bin/env bash
. "$(dirname "$0")/testlib.sh"
begin_test "track files using wildcard pattern with leading slash"
(
set -e
reponame="track-wildcard-leading-slash"
mkdir -p "$reponame/dir"
cd $reponame
git init
# Adding files before being tracked by LFS
printf "contents" > a.dat
printf "contents" > dir/b.dat
git add a.dat dir/b.dat
git commit -m "initial commit"
# Track only in the root
git lfs track "/*.dat"
grep "/*.dat" .gitattributes
git add .gitattributes a.dat dir/b.dat
sleep 1
git commit -m "convert to LFS"
git lfs ls-files | tee files.log
grep "a.dat" files.log
grep "dir/b.dat" files.log && exit 1 # Subdirectories ignored
# Add files after being tracked by LFS
printf "contents" > c.dat
printf "contents" > dir/d.dat
git add c.dat dir/d.dat
sleep 1
git commit -m "more lfs files"
git lfs ls-files | tee new_files.log
grep "a.dat" new_files.log
grep "dir/b.dat" new_files.log && exit 1
grep "c.dat" new_files.log
grep "dir/d.dat" new_files.log && exit 1
true
)
end_test
begin_test "track files using filename pattern with leading slash"
(
set -e
reponame="track-absolute-leading-slash"
mkdir -p "$reponame/dir"
cd $reponame
git init
# Adding files before being tracked by LFS
printf "contents" > a.dat
printf "contents" > dir/b.dat
git add a.dat dir/b.dat
sleep 1
git commit -m "initial commit"
# These are added by git.GetTrackedFiles
git lfs track "/a.dat" | tee track.log
grep "Tracking \"/a.dat\"" track.log
git lfs track "/dir/b.dat" | tee track.log
grep "Tracking \"/dir/b.dat\"" track.log
# These are added by Git's `clean` filter
git lfs track "/c.dat" | tee track.log
grep "Tracking \"/c.dat\"" track.log
git lfs track "/dir/d.dat" | tee track.log
grep "Tracking \"/dir/d.dat\"" track.log
cat .gitattributes
git add .gitattributes a.dat dir/b.dat
sleep 1
git commit -m "convert to LFS"
git lfs ls-files | tee files.log
grep "a.dat" files.log
grep "dir/b.dat" files.log
# Add files after being tracked by LFS
printf "contents" > c.dat
printf "contents" > dir/d.dat
git add c.dat dir/d.dat
git commit -m "more lfs files"
git lfs ls-files | tee new_files.log
grep "a.dat" new_files.log
grep "dir/b.dat" new_files.log
grep "c.dat" new_files.log
grep "dir/d.dat" new_files.log
)
end_test
|