Browse Source

Initialise git-annex-backup

Peter Colberg 2 years ago
commit
deee7954e5
5 changed files with 938 additions and 0 deletions
  1. 19
    0
      LICENSE
  2. 8
    0
      dar-backup.sh
  3. 244
    0
      git-annex-backup.sh
  4. 620
    0
      test.log
  5. 47
    0
      test.sh

+ 19
- 0
LICENSE View File

@@ -0,0 +1,19 @@
1
+Copyright © 2016 Peter Colberg.
2
+
3
+Permission is hereby granted, free of charge, to any person obtaining a copy
4
+of this software and associated documentation files (the "Software"), to deal
5
+in the Software without restriction, including without limitation the rights
6
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+copies of the Software, and to permit persons to whom the Software is
8
+furnished to do so, subject to the following conditions:
9
+
10
+The above copyright notice and this permission notice shall be included in
11
+all copies or substantial portions of the Software.
12
+
13
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
16
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+THE SOFTWARE.

+ 8
- 0
dar-backup.sh View File

@@ -0,0 +1,8 @@
1
+#!/usr/bin/env bash
2
+set -e
3
+btrfs subvolume snapshot -r / "/snapshot/$1" >/dev/null
4
+dar -Q -q -c "$HOSTNAME.$1" ${2:+-A "$HOSTNAME.$2"} -R "/snapshot/$1" -z5 --nodump --empty-dir --no-warn --alter=secu --sparse-file-min-size=0
5
+btrfs subvolume delete "/snapshot/$1" >/dev/null
6
+dar -Q -q -t "$HOSTNAME.$1"
7
+par2 create -n1 "$HOSTNAME.$1.1.dar" >/dev/null
8
+par2 verify "$HOSTNAME.$1.1.dar" >/dev/null

+ 244
- 0
git-annex-backup.sh View File

@@ -0,0 +1,244 @@
1
+#!/usr/bin/env bash
2
+#
3
+# git-annex-backup - Create incremental backups in a git-annex repository.
4
+# Copyright © 2016 Peter Colberg.
5
+# Distributed under the MIT license. (See accompanying file LICENSE.)
6
+#
7
+
8
+set -e -o pipefail
9
+
10
+# Current time in seconds since epoch
11
+NOW=$(date ${GIT_ANNEX_BACKUP_DATE:+--date="${GIT_ANNEX_BACKUP_DATE}"} +%s)
12
+
13
+die() {
14
+	echo >&2 "$1"
15
+	exit 1
16
+}
17
+
18
+# Converts time duration to number of seconds.
19
+parse_duration() {
20
+	local t=0
21
+
22
+	if [[ "$1" =~ ^([0-9]+w)?([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?$ ]]; then
23
+		if [[ "${BASH_REMATCH[1]}" ]]; then t=$(( $t + ${BASH_REMATCH[1]%w}*604800 )); fi
24
+		if [[ "${BASH_REMATCH[2]}" ]]; then t=$(( $t + ${BASH_REMATCH[2]%d}*86400 )); fi
25
+		if [[ "${BASH_REMATCH[3]}" ]]; then t=$(( $t + ${BASH_REMATCH[3]%h}*3600 )); fi
26
+		if [[ "${BASH_REMATCH[4]}" ]]; then t=$(( $t + ${BASH_REMATCH[4]%m}*60 )); fi
27
+		if [[ "${BASH_REMATCH[5]}" ]]; then t=$(( $t + ${BASH_REMATCH[5]%s} )); fi
28
+	fi
29
+
30
+	[[ "$t" -gt 0 ]] || return 1
31
+
32
+	echo "$t"
33
+}
34
+
35
+# Converts seconds since the epoch to UTC timestamp in RFC-3339 format.
36
+format_timestamp() {
37
+	date --date=@"$1" --utc +%FT%TZ
38
+}
39
+
40
+# Converts UTC timestamp in RFC-3339 format to seconds since the epoch.
41
+parse_timestamp() {
42
+	[[ "$1" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$ ]] || return 1
43
+
44
+	date --date="${BASH_REMATCH[0]}" +%s
45
+}
46
+
47
+parse_filename() {
48
+	local token
49
+	local -a tokens
50
+
51
+	IFS='.' read -r -a tokens <<<"$1"
52
+
53
+	for token in "${tokens[@]}"; do
54
+		if parse_timestamp "$token"; then
55
+			return 0
56
+		fi
57
+	done
58
+
59
+	return 1
60
+}
61
+
62
+parse_filenames() {
63
+	local file
64
+
65
+	while IFS= read -r file; do
66
+		parse_filename "$file" || die "$PROGRAM $COMMAND: invalid timestamp -- $file"
67
+	done
68
+}
69
+
70
+filter_times() {
71
+	local count ref=0 time
72
+
73
+	while IFS= read -r time; do
74
+		count=$#
75
+
76
+		while [[ "$#" -gt 0 ]]; do
77
+			if [[ "$(( $time + $1 ))" -le "$NOW" ]]; then
78
+				break
79
+			fi
80
+			if [[ "$ref" -gt 0 ]] && [[ "$time" -lt "$(( $ref + $1 ))" ]]; then
81
+				break
82
+			fi
83
+			echo "$time"
84
+			shift
85
+		done
86
+
87
+		if [[ "$#" -eq "$count" ]]; then
88
+			shift "$#"
89
+		fi
90
+
91
+		ref=$time
92
+	done
93
+}
94
+
95
+filter_tree() {
96
+	local file line mode object time type
97
+
98
+	while IFS= read -r line; do
99
+		read -r mode type object file <<<"$line"
100
+
101
+		time=$(parse_filename "$file") || die "$PROGRAM $COMMAND: invalid timestamp -- $file"
102
+
103
+		if [[ "$time" -le "$1" ]]; then
104
+			echo "$line"
105
+		fi
106
+	done
107
+}
108
+
109
+expire_dirnames() {
110
+	local dir time
111
+
112
+	while IFS= read -r dir; do
113
+		time=$(parse_timestamp "$dir") || die "$PROGRAM $COMMAND: invalid timestamp -- $dir"
114
+
115
+		if [[ "$(( $time + $1 ))" -lt "$NOW" ]]; then
116
+			echo "$dir"
117
+		fi
118
+	done
119
+}
120
+
121
+cmd_backup() {
122
+	local commit dir opts tempdir time
123
+	local -a intervals times timestamps
124
+
125
+	opts=$(getopt -o hi: -l help,interval: -n "$PROGRAM $COMMAND" -- "$@")
126
+	eval set -- "$opts"
127
+
128
+	while true; do case "$1" in
129
+		-h|--help)
130
+			cat <<-EOF
131
+			usage: $PROGRAM $COMMAND [-i|--interval=DURATION]... COMMAND
132
+			EOF
133
+			exit 0
134
+			;;
135
+
136
+		-i|--interval)
137
+			intervals+=("$(parse_duration "$2")") || die "$PROGRAM $COMMAND: invalid duration -- $2"
138
+			shift 2
139
+			;;
140
+
141
+		--)	shift; break ;;
142
+	esac done
143
+
144
+	intervals=( $(printf '%s\n' "${intervals[@]}" | sort -n -r) )
145
+
146
+	[[ "$#" -gt 0 ]] || die "$PROGRAM $COMMAND: missing backup command"
147
+
148
+	commit=$(git rev-parse -q --verify HEAD) || true
149
+
150
+	if [[ -n "$commit" ]]; then
151
+		dir=$(git ls-tree -d --name-only "$commit" | tail -n 1)
152
+	fi
153
+
154
+	if [[ -n "$dir" ]] && [[ "${#intervals[@]}" -gt 0 ]]; then
155
+		times=( $(git ls-tree --name-only "$commit:$dir" | parse_filenames | sort -n -u | filter_times "${intervals[@]}") )
156
+
157
+		[[ "${#times[@]}" -lt "${#intervals[@]}" ]] || exit 0
158
+
159
+		times=( $(printf '%s\n' "${times[@]}" | sort -n -u -r) )
160
+	fi
161
+
162
+	timestamps=("$(format_timestamp "$NOW")")
163
+
164
+	for time in "${times[@]}"; do
165
+		timestamps+=("$(format_timestamp "$time")")
166
+	done
167
+
168
+	tempdir=$(mktemp -d ".${timestamps[0]}.XXXXXXXXXX")
169
+
170
+	git reset
171
+
172
+	if [[ "${#times[@]}" -gt 0 ]]; then
173
+		git ls-tree "$commit:$dir" | filter_tree "${times[0]}" | git mktree | xargs git read-tree -u --prefix="$tempdir/"
174
+	fi
175
+
176
+	(cd "$tempdir" && "$1" "${timestamps[@]}")
177
+
178
+	git-annex add -q "$tempdir"/*."${timestamps[0]}".*
179
+	git mv "$tempdir" "${timestamps[0]}"
180
+	git commit -q -m "$COMMAND"
181
+}
182
+
183
+cmd_prune() {
184
+	local commit expire=0 opts
185
+
186
+	opts=$(getopt -o h -l help,expire: -n "$PROGRAM $COMMAND" -- "$@")
187
+	eval set -- "$opts"
188
+
189
+	while true; do case "$1" in
190
+		-h|--help)
191
+			cat <<-EOF
192
+			usage: $PROGRAM $COMMAND [--expire=DURATION]
193
+			EOF
194
+			exit 0
195
+			;;
196
+
197
+		--expire)
198
+			expire=$(parse_duration "$2") || die "$PROGRAM $COMMAND: invalid duration -- $2"
199
+			shift 2
200
+			;;
201
+
202
+		--)	shift; break ;;
203
+	esac done
204
+
205
+	[[ "$expire" -gt 0 ]] || die "$PROGRAM $COMMAND: missing duration"
206
+
207
+	commit=$(git rev-parse -q --verify HEAD) || exit 0
208
+
209
+	git reset
210
+	git ls-tree -d --name-only "$commit" | expire_dirnames "$expire" | xargs -r git rm -q -r -f --
211
+	git diff --cached --quiet || git commit -q -m "$COMMAND"
212
+}
213
+
214
+usage() {
215
+	cat <<-EOF
216
+	usage: $PROGRAM COMMAND
217
+
218
+	available commands:
219
+	  backup    create a new backup
220
+	  prune     remove backups older than expiry time
221
+	EOF
222
+	exit 0
223
+}
224
+
225
+PROGRAM=${0##*/}
226
+
227
+OPTS=$(getopt -o +h -l help -n "$PROGRAM" -- "$@")
228
+eval set -- "$OPTS"
229
+
230
+while true; do case "$1" in
231
+	-h|--help)	usage ;;
232
+	--)		shift; break ;;
233
+esac done
234
+
235
+[[ "$#" -ge 1 ]] || usage
236
+
237
+COMMAND=$1
238
+shift
239
+case "$COMMAND" in
240
+	backup)		cmd_backup "$@" ;;
241
+	prune)		cmd_prune "$@" ;;
242
+	*)		die "$PROGRAM: invalid command -- $COMMAND" ;;
243
+esac
244
+exit 0

+ 620
- 0
test.log View File

@@ -0,0 +1,620 @@
1
+commit b4171bd3461e18383956e0cc84fc4edf8dd16053
2
+Author:     root <root@localhost>
3
+AuthorDate: Fri Jan 2 08:00:00 1970 +0800
4
+Commit:     root <root@localhost>
5
+CommitDate: Fri Jan 2 08:00:00 1970 +0800
6
+
7
+    backup
8
+
9
+A	1970-01-02T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
10
+
11
+commit 932775c46e7bd01442a77a3edf86f3f594d1741b
12
+Author:     root <root@localhost>
13
+AuthorDate: Sat Jan 3 08:00:00 1970 +0800
14
+Commit:     root <root@localhost>
15
+CommitDate: Sat Jan 3 08:00:00 1970 +0800
16
+
17
+    backup
18
+
19
+A	1970-01-03T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
20
+A	1970-01-03T00:00:00Z/test.1970-01-03T00:00:00Z.1.txt
21
+A	1970-01-03T00:00:00Z/test.1970-01-03T00:00:00Z.2.txt
22
+
23
+commit d17b9660dd81e29349d42932aa53b4e26e358f88
24
+Author:     root <root@localhost>
25
+AuthorDate: Sun Jan 4 08:00:00 1970 +0800
26
+Commit:     root <root@localhost>
27
+CommitDate: Sun Jan 4 08:00:00 1970 +0800
28
+
29
+    backup
30
+
31
+A	1970-01-04T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
32
+A	1970-01-04T00:00:00Z/test.1970-01-04T00:00:00Z.1.txt
33
+A	1970-01-04T00:00:00Z/test.1970-01-04T00:00:00Z.2.txt
34
+
35
+commit 3f4fb3cbc96fd89a7c73b33927781d35b78cfa02
36
+Author:     root <root@localhost>
37
+AuthorDate: Mon Jan 5 08:00:00 1970 +0800
38
+Commit:     root <root@localhost>
39
+CommitDate: Mon Jan 5 08:00:00 1970 +0800
40
+
41
+    backup
42
+
43
+A	1970-01-05T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
44
+A	1970-01-05T00:00:00Z/test.1970-01-05T00:00:00Z.1.txt
45
+A	1970-01-05T00:00:00Z/test.1970-01-05T00:00:00Z.2.txt
46
+
47
+commit 05813e190503909c3e3a41ed40f080b2f6e6cbfc
48
+Author:     root <root@localhost>
49
+AuthorDate: Tue Jan 6 08:00:00 1970 +0800
50
+Commit:     root <root@localhost>
51
+CommitDate: Tue Jan 6 08:00:00 1970 +0800
52
+
53
+    backup
54
+
55
+A	1970-01-06T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
56
+A	1970-01-06T00:00:00Z/test.1970-01-06T00:00:00Z.1.txt
57
+A	1970-01-06T00:00:00Z/test.1970-01-06T00:00:00Z.2.txt
58
+
59
+commit 30b6315531006edc18431eb1c3eb91f754e5be7b
60
+Author:     root <root@localhost>
61
+AuthorDate: Wed Jan 7 08:00:00 1970 +0800
62
+Commit:     root <root@localhost>
63
+CommitDate: Wed Jan 7 08:00:00 1970 +0800
64
+
65
+    backup
66
+
67
+A	1970-01-07T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
68
+A	1970-01-07T00:00:00Z/test.1970-01-07T00:00:00Z.1.txt
69
+A	1970-01-07T00:00:00Z/test.1970-01-07T00:00:00Z.2.txt
70
+
71
+commit f93a9c195b9caf3b78dac37f7516750b89dbead5
72
+Author:     root <root@localhost>
73
+AuthorDate: Thu Jan 8 08:00:00 1970 +0800
74
+Commit:     root <root@localhost>
75
+CommitDate: Thu Jan 8 08:00:00 1970 +0800
76
+
77
+    backup
78
+
79
+A	1970-01-08T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
80
+A	1970-01-08T00:00:00Z/test.1970-01-08T00:00:00Z.1.txt
81
+A	1970-01-08T00:00:00Z/test.1970-01-08T00:00:00Z.2.txt
82
+
83
+commit 21ca1828544fbea05c576c96e267f0d7f8baea92
84
+Author:     root <root@localhost>
85
+AuthorDate: Fri Jan 9 08:00:00 1970 +0800
86
+Commit:     root <root@localhost>
87
+CommitDate: Fri Jan 9 08:00:00 1970 +0800
88
+
89
+    backup
90
+
91
+A	1970-01-09T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
92
+A	1970-01-09T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
93
+A	1970-01-09T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
94
+
95
+commit 6ee44f9073fec173bd70176f794b29aa9cb80809
96
+Author:     root <root@localhost>
97
+AuthorDate: Sat Jan 10 08:00:00 1970 +0800
98
+Commit:     root <root@localhost>
99
+CommitDate: Sat Jan 10 08:00:00 1970 +0800
100
+
101
+    backup
102
+
103
+A	1970-01-10T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
104
+A	1970-01-10T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
105
+A	1970-01-10T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
106
+A	1970-01-10T00:00:00Z/test.1970-01-10T00:00:00Z.1.txt
107
+A	1970-01-10T00:00:00Z/test.1970-01-10T00:00:00Z.2.txt
108
+A	1970-01-10T00:00:00Z/test.1970-01-10T00:00:00Z.3.txt
109
+
110
+commit cd461f0cd9d44c6719150d0977b18f1d26d715a0
111
+Author:     root <root@localhost>
112
+AuthorDate: Sun Jan 11 08:00:00 1970 +0800
113
+Commit:     root <root@localhost>
114
+CommitDate: Sun Jan 11 08:00:00 1970 +0800
115
+
116
+    backup
117
+
118
+A	1970-01-11T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
119
+A	1970-01-11T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
120
+A	1970-01-11T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
121
+A	1970-01-11T00:00:00Z/test.1970-01-11T00:00:00Z.1.txt
122
+A	1970-01-11T00:00:00Z/test.1970-01-11T00:00:00Z.2.txt
123
+A	1970-01-11T00:00:00Z/test.1970-01-11T00:00:00Z.3.txt
124
+
125
+commit ab842b7319748b86fbb1258e412b41243deac1f7
126
+Author:     root <root@localhost>
127
+AuthorDate: Mon Jan 12 08:00:00 1970 +0800
128
+Commit:     root <root@localhost>
129
+CommitDate: Mon Jan 12 08:00:00 1970 +0800
130
+
131
+    backup
132
+
133
+A	1970-01-12T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
134
+A	1970-01-12T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
135
+A	1970-01-12T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
136
+A	1970-01-12T00:00:00Z/test.1970-01-12T00:00:00Z.1.txt
137
+A	1970-01-12T00:00:00Z/test.1970-01-12T00:00:00Z.2.txt
138
+A	1970-01-12T00:00:00Z/test.1970-01-12T00:00:00Z.3.txt
139
+
140
+commit c1abd1f3224a4eba1705a7e67e592b33e6953c8a
141
+Author:     root <root@localhost>
142
+AuthorDate: Tue Jan 13 08:00:00 1970 +0800
143
+Commit:     root <root@localhost>
144
+CommitDate: Tue Jan 13 08:00:00 1970 +0800
145
+
146
+    backup
147
+
148
+A	1970-01-13T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
149
+A	1970-01-13T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
150
+A	1970-01-13T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
151
+A	1970-01-13T00:00:00Z/test.1970-01-13T00:00:00Z.1.txt
152
+A	1970-01-13T00:00:00Z/test.1970-01-13T00:00:00Z.2.txt
153
+A	1970-01-13T00:00:00Z/test.1970-01-13T00:00:00Z.3.txt
154
+
155
+commit a993df316f0b3647c5d96a010a269d2ba0802abd
156
+Author:     root <root@localhost>
157
+AuthorDate: Wed Jan 14 08:00:00 1970 +0800
158
+Commit:     root <root@localhost>
159
+CommitDate: Wed Jan 14 08:00:00 1970 +0800
160
+
161
+    backup
162
+
163
+A	1970-01-14T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
164
+A	1970-01-14T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
165
+A	1970-01-14T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
166
+A	1970-01-14T00:00:00Z/test.1970-01-14T00:00:00Z.1.txt
167
+A	1970-01-14T00:00:00Z/test.1970-01-14T00:00:00Z.2.txt
168
+A	1970-01-14T00:00:00Z/test.1970-01-14T00:00:00Z.3.txt
169
+
170
+commit c4040141f8871b25b5f314fd24549c9351336673
171
+Author:     root <root@localhost>
172
+AuthorDate: Thu Jan 15 08:00:00 1970 +0800
173
+Commit:     root <root@localhost>
174
+CommitDate: Thu Jan 15 08:00:00 1970 +0800
175
+
176
+    backup
177
+
178
+A	1970-01-15T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
179
+A	1970-01-15T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
180
+A	1970-01-15T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
181
+A	1970-01-15T00:00:00Z/test.1970-01-15T00:00:00Z.1.txt
182
+A	1970-01-15T00:00:00Z/test.1970-01-15T00:00:00Z.2.txt
183
+A	1970-01-15T00:00:00Z/test.1970-01-15T00:00:00Z.3.txt
184
+
185
+commit b4ddcfa1aa0c6f588498876c5672bd2b9368379e
186
+Author:     root <root@localhost>
187
+AuthorDate: Fri Jan 16 08:00:00 1970 +0800
188
+Commit:     root <root@localhost>
189
+CommitDate: Fri Jan 16 08:00:00 1970 +0800
190
+
191
+    backup
192
+
193
+A	1970-01-16T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
194
+A	1970-01-16T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
195
+A	1970-01-16T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
196
+
197
+commit 61d5a46aea94eee3956901d2ec547006c7af58c0
198
+Author:     root <root@localhost>
199
+AuthorDate: Fri Jan 16 08:00:01 1970 +0800
200
+Commit:     root <root@localhost>
201
+CommitDate: Fri Jan 16 08:00:01 1970 +0800
202
+
203
+    prune
204
+
205
+D	1970-01-02T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
206
+
207
+commit f5fefcb2b0cd0568d8ad5977b5c010b6ea39fd54
208
+Author:     root <root@localhost>
209
+AuthorDate: Sat Jan 17 08:00:00 1970 +0800
210
+Commit:     root <root@localhost>
211
+CommitDate: Sat Jan 17 08:00:00 1970 +0800
212
+
213
+    backup
214
+
215
+A	1970-01-17T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
216
+A	1970-01-17T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
217
+A	1970-01-17T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
218
+A	1970-01-17T00:00:00Z/test.1970-01-17T00:00:00Z.1.txt
219
+A	1970-01-17T00:00:00Z/test.1970-01-17T00:00:00Z.2.txt
220
+A	1970-01-17T00:00:00Z/test.1970-01-17T00:00:00Z.3.txt
221
+
222
+commit 00fc9d302fd1d3cdf194178df71bd18d10ad6a3b
223
+Author:     root <root@localhost>
224
+AuthorDate: Sat Jan 17 08:00:01 1970 +0800
225
+Commit:     root <root@localhost>
226
+CommitDate: Sat Jan 17 08:00:01 1970 +0800
227
+
228
+    prune
229
+
230
+D	1970-01-03T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
231
+D	1970-01-03T00:00:00Z/test.1970-01-03T00:00:00Z.1.txt
232
+D	1970-01-03T00:00:00Z/test.1970-01-03T00:00:00Z.2.txt
233
+
234
+commit 89ac4cab4bf8aba488141565c027b3ac1260f58b
235
+Author:     root <root@localhost>
236
+AuthorDate: Sun Jan 18 08:00:00 1970 +0800
237
+Commit:     root <root@localhost>
238
+CommitDate: Sun Jan 18 08:00:00 1970 +0800
239
+
240
+    backup
241
+
242
+A	1970-01-18T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
243
+A	1970-01-18T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
244
+A	1970-01-18T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
245
+A	1970-01-18T00:00:00Z/test.1970-01-18T00:00:00Z.1.txt
246
+A	1970-01-18T00:00:00Z/test.1970-01-18T00:00:00Z.2.txt
247
+A	1970-01-18T00:00:00Z/test.1970-01-18T00:00:00Z.3.txt
248
+
249
+commit 03f3599b957a7580edee077901c682732ef43afb
250
+Author:     root <root@localhost>
251
+AuthorDate: Sun Jan 18 08:00:01 1970 +0800
252
+Commit:     root <root@localhost>
253
+CommitDate: Sun Jan 18 08:00:01 1970 +0800
254
+
255
+    prune
256
+
257
+D	1970-01-04T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
258
+D	1970-01-04T00:00:00Z/test.1970-01-04T00:00:00Z.1.txt
259
+D	1970-01-04T00:00:00Z/test.1970-01-04T00:00:00Z.2.txt
260
+
261
+commit 1660ddd3b9bbe99aa2b967349dcc2293d775683e
262
+Author:     root <root@localhost>
263
+AuthorDate: Mon Jan 19 08:00:00 1970 +0800
264
+Commit:     root <root@localhost>
265
+CommitDate: Mon Jan 19 08:00:00 1970 +0800
266
+
267
+    backup
268
+
269
+A	1970-01-19T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
270
+A	1970-01-19T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
271
+A	1970-01-19T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
272
+A	1970-01-19T00:00:00Z/test.1970-01-19T00:00:00Z.1.txt
273
+A	1970-01-19T00:00:00Z/test.1970-01-19T00:00:00Z.2.txt
274
+A	1970-01-19T00:00:00Z/test.1970-01-19T00:00:00Z.3.txt
275
+
276
+commit 49b4ad3d1480301a73c1ba05d19bb2318ba90230
277
+Author:     root <root@localhost>
278
+AuthorDate: Mon Jan 19 08:00:01 1970 +0800
279
+Commit:     root <root@localhost>
280
+CommitDate: Mon Jan 19 08:00:01 1970 +0800
281
+
282
+    prune
283
+
284
+D	1970-01-05T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
285
+D	1970-01-05T00:00:00Z/test.1970-01-05T00:00:00Z.1.txt
286
+D	1970-01-05T00:00:00Z/test.1970-01-05T00:00:00Z.2.txt
287
+
288
+commit 7bc0fcd8895ff101003cab05b23b63a1de714f43
289
+Author:     root <root@localhost>
290
+AuthorDate: Tue Jan 20 08:00:00 1970 +0800
291
+Commit:     root <root@localhost>
292
+CommitDate: Tue Jan 20 08:00:00 1970 +0800
293
+
294
+    backup
295
+
296
+A	1970-01-20T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
297
+A	1970-01-20T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
298
+A	1970-01-20T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
299
+A	1970-01-20T00:00:00Z/test.1970-01-20T00:00:00Z.1.txt
300
+A	1970-01-20T00:00:00Z/test.1970-01-20T00:00:00Z.2.txt
301
+A	1970-01-20T00:00:00Z/test.1970-01-20T00:00:00Z.3.txt
302
+
303
+commit 5bcb9d0acd6d3b0843c5d7d15b8bd86674d6e0d6
304
+Author:     root <root@localhost>
305
+AuthorDate: Tue Jan 20 08:00:01 1970 +0800
306
+Commit:     root <root@localhost>
307
+CommitDate: Tue Jan 20 08:00:01 1970 +0800
308
+
309
+    prune
310
+
311
+D	1970-01-06T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
312
+D	1970-01-06T00:00:00Z/test.1970-01-06T00:00:00Z.1.txt
313
+D	1970-01-06T00:00:00Z/test.1970-01-06T00:00:00Z.2.txt
314
+
315
+commit 3ca0eac319422aca60ad559a9e8f8789f3a0dd86
316
+Author:     root <root@localhost>
317
+AuthorDate: Wed Jan 21 08:00:00 1970 +0800
318
+Commit:     root <root@localhost>
319
+CommitDate: Wed Jan 21 08:00:00 1970 +0800
320
+
321
+    backup
322
+
323
+A	1970-01-21T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
324
+A	1970-01-21T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
325
+A	1970-01-21T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
326
+A	1970-01-21T00:00:00Z/test.1970-01-21T00:00:00Z.1.txt
327
+A	1970-01-21T00:00:00Z/test.1970-01-21T00:00:00Z.2.txt
328
+A	1970-01-21T00:00:00Z/test.1970-01-21T00:00:00Z.3.txt
329
+
330
+commit f2703ff2726c28a8409b6aa41c50aa2582390111
331
+Author:     root <root@localhost>
332
+AuthorDate: Wed Jan 21 08:00:01 1970 +0800
333
+Commit:     root <root@localhost>
334
+CommitDate: Wed Jan 21 08:00:01 1970 +0800
335
+
336
+    prune
337
+
338
+D	1970-01-07T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
339
+D	1970-01-07T00:00:00Z/test.1970-01-07T00:00:00Z.1.txt
340
+D	1970-01-07T00:00:00Z/test.1970-01-07T00:00:00Z.2.txt
341
+
342
+commit eb5de1a01c1dc03f32cf260d9de71b2b46e8a5b6
343
+Author:     root <root@localhost>
344
+AuthorDate: Thu Jan 22 08:00:00 1970 +0800
345
+Commit:     root <root@localhost>
346
+CommitDate: Thu Jan 22 08:00:00 1970 +0800
347
+
348
+    backup
349
+
350
+A	1970-01-22T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
351
+A	1970-01-22T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
352
+A	1970-01-22T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
353
+A	1970-01-22T00:00:00Z/test.1970-01-22T00:00:00Z.1.txt
354
+A	1970-01-22T00:00:00Z/test.1970-01-22T00:00:00Z.2.txt
355
+A	1970-01-22T00:00:00Z/test.1970-01-22T00:00:00Z.3.txt
356
+
357
+commit 8611d5fb2ec2a911503cd0ee907e2335decf417e
358
+Author:     root <root@localhost>
359
+AuthorDate: Thu Jan 22 08:00:01 1970 +0800
360
+Commit:     root <root@localhost>
361
+CommitDate: Thu Jan 22 08:00:01 1970 +0800
362
+
363
+    prune
364
+
365
+D	1970-01-08T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
366
+D	1970-01-08T00:00:00Z/test.1970-01-08T00:00:00Z.1.txt
367
+D	1970-01-08T00:00:00Z/test.1970-01-08T00:00:00Z.2.txt
368
+
369
+commit ef87caedc660af0612c257d3abef18f5cd8da0b6
370
+Author:     root <root@localhost>
371
+AuthorDate: Fri Jan 23 08:00:00 1970 +0800
372
+Commit:     root <root@localhost>
373
+CommitDate: Fri Jan 23 08:00:00 1970 +0800
374
+
375
+    backup
376
+
377
+A	1970-01-23T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
378
+A	1970-01-23T00:00:00Z/test.1970-01-23T00:00:00Z.1.txt
379
+A	1970-01-23T00:00:00Z/test.1970-01-23T00:00:00Z.2.txt
380
+
381
+commit 65ae0bca04e85eb31e4964cf606ca2d425a36ad0
382
+Author:     root <root@localhost>
383
+AuthorDate: Fri Jan 23 08:00:01 1970 +0800
384
+Commit:     root <root@localhost>
385
+CommitDate: Fri Jan 23 08:00:01 1970 +0800
386
+
387
+    prune
388
+
389
+D	1970-01-09T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
390
+D	1970-01-09T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
391
+D	1970-01-09T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
392
+
393
+commit 7b848a914f81216ec171fddf26f9e4fc0ae10f8d
394
+Author:     root <root@localhost>
395
+AuthorDate: Sat Jan 24 08:00:00 1970 +0800
396
+Commit:     root <root@localhost>
397
+CommitDate: Sat Jan 24 08:00:00 1970 +0800
398
+
399
+    backup
400
+
401
+A	1970-01-24T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
402
+A	1970-01-24T00:00:00Z/test.1970-01-23T00:00:00Z.1.txt
403
+A	1970-01-24T00:00:00Z/test.1970-01-23T00:00:00Z.2.txt
404
+A	1970-01-24T00:00:00Z/test.1970-01-24T00:00:00Z.1.txt
405
+A	1970-01-24T00:00:00Z/test.1970-01-24T00:00:00Z.2.txt
406
+A	1970-01-24T00:00:00Z/test.1970-01-24T00:00:00Z.3.txt
407
+
408
+commit 50308bfb5fc4dac37a3ad1490462ca1f134792e8
409
+Author:     root <root@localhost>
410
+AuthorDate: Sat Jan 24 08:00:01 1970 +0800
411
+Commit:     root <root@localhost>
412
+CommitDate: Sat Jan 24 08:00:01 1970 +0800
413
+
414
+    prune
415
+
416
+D	1970-01-10T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
417
+D	1970-01-10T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
418
+D	1970-01-10T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
419
+D	1970-01-10T00:00:00Z/test.1970-01-10T00:00:00Z.1.txt
420
+D	1970-01-10T00:00:00Z/test.1970-01-10T00:00:00Z.2.txt
421
+D	1970-01-10T00:00:00Z/test.1970-01-10T00:00:00Z.3.txt
422
+
423
+commit a35d1b170f686045714ceb4667e0083a351a33df
424
+Author:     root <root@localhost>
425
+AuthorDate: Sun Jan 25 08:00:00 1970 +0800
426
+Commit:     root <root@localhost>
427
+CommitDate: Sun Jan 25 08:00:00 1970 +0800
428
+
429
+    backup
430
+
431
+A	1970-01-25T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
432
+A	1970-01-25T00:00:00Z/test.1970-01-23T00:00:00Z.1.txt
433
+A	1970-01-25T00:00:00Z/test.1970-01-23T00:00:00Z.2.txt
434
+A	1970-01-25T00:00:00Z/test.1970-01-25T00:00:00Z.1.txt
435
+A	1970-01-25T00:00:00Z/test.1970-01-25T00:00:00Z.2.txt
436
+A	1970-01-25T00:00:00Z/test.1970-01-25T00:00:00Z.3.txt
437
+
438
+commit cbb224f2b74827cd7086105ce55d939901e9364a
439
+Author:     root <root@localhost>
440
+AuthorDate: Sun Jan 25 08:00:01 1970 +0800
441
+Commit:     root <root@localhost>
442
+CommitDate: Sun Jan 25 08:00:01 1970 +0800
443
+
444
+    prune
445
+
446
+D	1970-01-11T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
447
+D	1970-01-11T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
448
+D	1970-01-11T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
449
+D	1970-01-11T00:00:00Z/test.1970-01-11T00:00:00Z.1.txt
450
+D	1970-01-11T00:00:00Z/test.1970-01-11T00:00:00Z.2.txt
451
+D	1970-01-11T00:00:00Z/test.1970-01-11T00:00:00Z.3.txt
452
+
453
+commit fe65a6b30b32dcb7c194a415f79c13c05b647ede
454
+Author:     root <root@localhost>
455
+AuthorDate: Mon Jan 26 08:00:00 1970 +0800
456
+Commit:     root <root@localhost>
457
+CommitDate: Mon Jan 26 08:00:00 1970 +0800
458
+
459
+    backup
460
+
461
+A	1970-01-26T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
462
+A	1970-01-26T00:00:00Z/test.1970-01-23T00:00:00Z.1.txt
463
+A	1970-01-26T00:00:00Z/test.1970-01-23T00:00:00Z.2.txt
464
+A	1970-01-26T00:00:00Z/test.1970-01-26T00:00:00Z.1.txt
465
+A	1970-01-26T00:00:00Z/test.1970-01-26T00:00:00Z.2.txt
466
+A	1970-01-26T00:00:00Z/test.1970-01-26T00:00:00Z.3.txt
467
+
468
+commit 8d406a9e97dbb8bef39c879a73cf465207eb4e6b
469
+Author:     root <root@localhost>
470
+AuthorDate: Mon Jan 26 08:00:01 1970 +0800
471
+Commit:     root <root@localhost>
472
+CommitDate: Mon Jan 26 08:00:01 1970 +0800
473
+
474
+    prune
475
+
476
+D	1970-01-12T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
477
+D	1970-01-12T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
478
+D	1970-01-12T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
479
+D	1970-01-12T00:00:00Z/test.1970-01-12T00:00:00Z.1.txt
480
+D	1970-01-12T00:00:00Z/test.1970-01-12T00:00:00Z.2.txt
481
+D	1970-01-12T00:00:00Z/test.1970-01-12T00:00:00Z.3.txt
482
+
483
+commit f9b9fa8641e324ec79513781deac1bd33fcf7c32
484
+Author:     root <root@localhost>
485
+AuthorDate: Tue Jan 27 08:00:00 1970 +0800
486
+Commit:     root <root@localhost>
487
+CommitDate: Tue Jan 27 08:00:00 1970 +0800
488
+
489
+    backup
490
+
491
+A	1970-01-27T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
492
+A	1970-01-27T00:00:00Z/test.1970-01-23T00:00:00Z.1.txt
493
+A	1970-01-27T00:00:00Z/test.1970-01-23T00:00:00Z.2.txt
494
+A	1970-01-27T00:00:00Z/test.1970-01-27T00:00:00Z.1.txt
495
+A	1970-01-27T00:00:00Z/test.1970-01-27T00:00:00Z.2.txt
496
+A	1970-01-27T00:00:00Z/test.1970-01-27T00:00:00Z.3.txt
497
+
498
+commit 41fdfc8ae298c19d5a324d2d446006cd8a8e84bc
499
+Author:     root <root@localhost>
500
+AuthorDate: Tue Jan 27 08:00:01 1970 +0800
501
+Commit:     root <root@localhost>
502
+CommitDate: Tue Jan 27 08:00:01 1970 +0800
503
+
504
+    prune
505
+
506
+D	1970-01-13T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
507
+D	1970-01-13T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
508
+D	1970-01-13T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
509
+D	1970-01-13T00:00:00Z/test.1970-01-13T00:00:00Z.1.txt
510
+D	1970-01-13T00:00:00Z/test.1970-01-13T00:00:00Z.2.txt
511
+D	1970-01-13T00:00:00Z/test.1970-01-13T00:00:00Z.3.txt
512
+
513
+commit acbda066d2ec571e34f609d885aa645f386ba92e
514
+Author:     root <root@localhost>
515
+AuthorDate: Wed Jan 28 08:00:00 1970 +0800
516
+Commit:     root <root@localhost>
517
+CommitDate: Wed Jan 28 08:00:00 1970 +0800
518
+
519
+    backup
520
+
521
+A	1970-01-28T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
522
+A	1970-01-28T00:00:00Z/test.1970-01-23T00:00:00Z.1.txt
523
+A	1970-01-28T00:00:00Z/test.1970-01-23T00:00:00Z.2.txt
524
+A	1970-01-28T00:00:00Z/test.1970-01-28T00:00:00Z.1.txt
525
+A	1970-01-28T00:00:00Z/test.1970-01-28T00:00:00Z.2.txt
526
+A	1970-01-28T00:00:00Z/test.1970-01-28T00:00:00Z.3.txt
527
+
528
+commit d9a665b229071899d031b1d1b23b01856ab3bdbd
529
+Author:     root <root@localhost>
530
+AuthorDate: Wed Jan 28 08:00:01 1970 +0800
531
+Commit:     root <root@localhost>
532
+CommitDate: Wed Jan 28 08:00:01 1970 +0800
533
+
534
+    prune
535
+
536
+D	1970-01-14T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
537
+D	1970-01-14T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
538
+D	1970-01-14T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
539
+D	1970-01-14T00:00:00Z/test.1970-01-14T00:00:00Z.1.txt
540
+D	1970-01-14T00:00:00Z/test.1970-01-14T00:00:00Z.2.txt
541
+D	1970-01-14T00:00:00Z/test.1970-01-14T00:00:00Z.3.txt
542
+
543
+commit 5cec11793f5a76fc12ccce2e6e0e8c82621fa309
544
+Author:     root <root@localhost>
545
+AuthorDate: Thu Jan 29 08:00:00 1970 +0800
546
+Commit:     root <root@localhost>
547
+CommitDate: Thu Jan 29 08:00:00 1970 +0800
548
+
549
+    backup
550
+
551
+A	1970-01-29T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
552
+A	1970-01-29T00:00:00Z/test.1970-01-23T00:00:00Z.1.txt
553
+A	1970-01-29T00:00:00Z/test.1970-01-23T00:00:00Z.2.txt
554
+A	1970-01-29T00:00:00Z/test.1970-01-29T00:00:00Z.1.txt
555
+A	1970-01-29T00:00:00Z/test.1970-01-29T00:00:00Z.2.txt
556
+A	1970-01-29T00:00:00Z/test.1970-01-29T00:00:00Z.3.txt
557
+
558
+commit 79739e4d36986451d8d1a09bd2bdf8504ca1c682
559
+Author:     root <root@localhost>
560
+AuthorDate: Thu Jan 29 08:00:01 1970 +0800
561
+Commit:     root <root@localhost>
562
+CommitDate: Thu Jan 29 08:00:01 1970 +0800
563
+
564
+    prune
565
+
566
+D	1970-01-15T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
567
+D	1970-01-15T00:00:00Z/test.1970-01-09T00:00:00Z.1.txt
568
+D	1970-01-15T00:00:00Z/test.1970-01-09T00:00:00Z.2.txt
569
+D	1970-01-15T00:00:00Z/test.1970-01-15T00:00:00Z.1.txt
570
+D	1970-01-15T00:00:00Z/test.1970-01-15T00:00:00Z.2.txt
571
+D	1970-01-15T00:00:00Z/test.1970-01-15T00:00:00Z.3.txt
572
+
573
+commit 6cb73dabb8b58ac9179742452aab357d025d343b
574
+Author:     root <root@localhost>
575
+AuthorDate: Fri Jan 30 08:00:00 1970 +0800
576
+Commit:     root <root@localhost>
577
+CommitDate: Fri Jan 30 08:00:00 1970 +0800
578
+
579
+    backup
580
+
581
+A	1970-01-30T00:00:00Z/test.1970-01-30T00:00:00Z.1.txt
582
+
583
+commit e776b3eaed2c2f0bc8d1e79e2a3cfdcc63e6ef9a
584
+Author:     root <root@localhost>
585
+AuthorDate: Fri Jan 30 08:00:01 1970 +0800
586
+Commit:     root <root@localhost>
587
+CommitDate: Fri Jan 30 08:00:01 1970 +0800
588
+
589
+    prune
590
+
591
+D	1970-01-16T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
592
+D	1970-01-16T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
593
+D	1970-01-16T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
594
+
595
+commit b8388b3cd24e588501b25a034fb24f20300f9b00
596
+Author:     root <root@localhost>
597
+AuthorDate: Sat Jan 31 08:00:00 1970 +0800
598
+Commit:     root <root@localhost>
599
+CommitDate: Sat Jan 31 08:00:00 1970 +0800
600
+
601
+    backup
602
+
603
+A	1970-01-31T00:00:00Z/test.1970-01-30T00:00:00Z.1.txt
604
+A	1970-01-31T00:00:00Z/test.1970-01-31T00:00:00Z.1.txt
605
+A	1970-01-31T00:00:00Z/test.1970-01-31T00:00:00Z.2.txt
606
+
607
+commit d030adfac9231333035ee454b59ff4c353ea15a8
608
+Author:     root <root@localhost>
609
+AuthorDate: Sat Jan 31 08:00:01 1970 +0800
610
+Commit:     root <root@localhost>
611
+CommitDate: Sat Jan 31 08:00:01 1970 +0800
612
+
613
+    prune
614
+
615
+D	1970-01-17T00:00:00Z/test.1970-01-02T00:00:00Z.1.txt
616
+D	1970-01-17T00:00:00Z/test.1970-01-16T00:00:00Z.1.txt
617
+D	1970-01-17T00:00:00Z/test.1970-01-16T00:00:00Z.2.txt
618
+D	1970-01-17T00:00:00Z/test.1970-01-17T00:00:00Z.1.txt
619
+D	1970-01-17T00:00:00Z/test.1970-01-17T00:00:00Z.2.txt
620
+D	1970-01-17T00:00:00Z/test.1970-01-17T00:00:00Z.3.txt

+ 47
- 0
test.sh View File

@@ -0,0 +1,47 @@
1
+#!/usr/bin/env bash
2
+#
3
+# git-annex-backup - Create incremental backups in a git-annex repository.
4
+# Copyright © 2016 Peter Colberg.
5
+# Distributed under the MIT license. (See accompanying file LICENSE.)
6
+#
7
+
8
+export PATH="$PWD:$PATH"
9
+
10
+test_date() {
11
+	export GIT_ANNEX_BACKUP_DATE=$1
12
+	export GIT_AUTHOR_DATE=$1
13
+	export GIT_AUTHOR_NAME=root
14
+	export GIT_AUTHOR_EMAIL=root@localhost
15
+	export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE
16
+	export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
17
+	export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
18
+}
19
+
20
+test_backup() {
21
+	local i=1
22
+
23
+	while [[ "$i" -le "$#" ]]; do
24
+		printf '%s' "${!i}" > "test.$1.$i.txt"
25
+		i=$(( $i + 1 ))
26
+	done
27
+}
28
+
29
+export -f test_backup
30
+
31
+if [[ -d test ]]; then
32
+	chmod -R u+w test
33
+	rm -rf test
34
+fi
35
+
36
+mkdir test
37
+(cd test && git init -q && echo "* annex.backend=SHA256" > .git/info/attributes && git annex init -q)
38
+
39
+for d in {02..31}; do
40
+	(cd test && test_date "1970-01-${d}T08:00:00+08:00" && git-annex-backup.sh backup -i 1d -i 1w -i 4w test_backup)
41
+	(cd test && test_date "1970-01-${d}T08:00:01+08:00" && git-annex-backup.sh prune --expire=2w)
42
+done
43
+
44
+diff "test.log" <(git -C test log --reverse --pretty=fuller --name-status HEAD) || exit 1
45
+
46
+chmod -R u+w test
47
+rm -rf test

Loading…
Cancel
Save