forked from datalad/git-remote-rclone
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.bash
executable file
·57 lines (44 loc) · 1.04 KB
/
test.bash
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
#!/usr/bin/bash
set -eo pipefail
set -x
PS4='\n--------------\n${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
REMOTE=grrtest
TESTDIR=~/GIT_REMOTE_RCLONE/TESTDIR
TESTDIR2=~/GIT_REMOTE_RCLONE/TESTDIR2
# test init: clear remote and local
rclone delete -v "${REMOTE}:"
rm -fr $TESTDIR
mkdir -p $TESTDIR
cd $TESTDIR
# create and push a new repo
git init .
date > testfile
git add testfile
git commit -m "Initial commit."
git remote add origin rclone://$REMOTE/
git push --set-upstream origin main
# push, no updates
git push origin main
git push origin main
# push new update
date > secondfile
git add secondfile
git commit -m "Second commit."
git push origin main
# pull update
git reset --hard HEAD~
git log
git pull --rebase
# pull, no updates
git pull --rebase
# push, no updates
git push origin main
# create new branch and push
# push from new branch, no updates
# test checkpoint: cat refs
rclone cat $REMOTE:refs
# test checkpoint: clone fresh from remote
rm -fr $TESTDIR2
mkdir -p $TESTDIR2
cd $TESTDIR2
git clone rclone://$REMOTE/ .