forked from git-lfs/git-lfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-commit-delete-push.sh
More file actions
executable file
·51 lines (38 loc) · 1.5 KB
/
test-commit-delete-push.sh
File metadata and controls
executable file
·51 lines (38 loc) · 1.5 KB
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
#!/usr/bin/env bash
. "test/testlib.sh"
begin_test "commit, delete, then push"
(
set -e
reponame="$(basename "$0" ".sh")"
setup_remote_repo "$reponame"
clone_repo "$reponame" repo
git lfs track "*.dat"
deleted_oid=$(calc_oid "deleted\n")
echo "deleted" > deleted.dat
git add deleted.dat .gitattributes
git commit -m "add deleted file"
git lfs push origin master --dry-run | grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat"
assert_pointer "master" "deleted.dat" "$deleted_oid" 8
added_oid=$(calc_oid "added\n")
echo "added" > added.dat
git add added.dat
git commit -m "add file"
git lfs push origin master --dry-run | tee dryrun.log
grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat" dryrun.log
grep "push 3428719b7688c78a0cc8ba4b9e80b4e464c815fbccfd4b20695a15ffcefc22af => added.dat" dryrun.log
git rm deleted.dat
git commit -m "did not need deleted.dat after all"
git lfs push origin master --dry-run 2>&1 | tee dryrun.log
grep "push ee31ef227442936872744b50d3297385c08b40ffc7baeaf34a39e6d81d6cd9ee => deleted.dat" dryrun.log
grep "push 3428719b7688c78a0cc8ba4b9e80b4e464c815fbccfd4b20695a15ffcefc22af => added.dat" dryrun.log
git log
git push origin master 2>&1 > push.log || {
cat push.log
git lfs logs last
exit 1
}
grep "(2 of 2 files)" push.log | cat push.log
assert_server_object "$reponame" "$deleted_oid"
assert_server_object "$reponame" "$added_oid"
)
end_test