forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcycle-run
More file actions
executable file
·130 lines (116 loc) · 2.62 KB
/
cycle-run
File metadata and controls
executable file
·130 lines (116 loc) · 2.62 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/sh
: ${RANGE:=origin/master..origin/seen} ${J:=j32} ${OKNG:="(OK|NG)"}
test_it () {
type=$1 commit=$2 subject=$3
log=".Cycle/log.$commit"
rm -f "$log"
git ls-files -x Meta -x .Cycle -o -z | xargs -r -0 rm -rf
(
echo "*** log for $subject ***" &&
case "$type" in
C)
# Single parent commit on a topic
Meta/Make -$J &&
Meta/Make -$J -- SPARSE_FLAGS=-Wsparse-error sparse
;;
M)
# Merges on the first-parent chain on seen
Meta/Make -$J -- SPARSE_FLAGS=-Wsparse-error sparse &&
Meta/Make -$J -- test
;;
T)
# Commit at the tip of a topic
Meta/Make -$J SANITIZE=address,undefined -- test &&
Meta/Make -$J -- doc
;;
esac
status=$?
# Does 'distclean' clean them up properly?
Meta/Make -- $D distclean >/dev/null
case $(git ls-files -x Meta -x .Cycle -o | wc -l) in
0) exit "$status" ;;
*) git ls-files -x Meta -x .Cycle -o
exit 1 ;;
esac
) >"$log" 2>&1
case $? in
0) rm -f "$log" ;;
*) return 1 ;;
esac
}
tested () {
# sign=$1 commit=$2
egrep "^$OKNG $1($2|$(git rev-parse "$2^{tree}"))" .Cycle/log >/dev/null
}
test_them () {
while read merge parent sides
do
case "$parent" in
?*)
tested M $merge && continue
echo "TEST M $merge"
for tip in $sides
do
git rev-parse --verify --quiet "$tip" || continue
tested T $tip && continue
echo "TEST $tip $merge"
done
;;
'')
commit=$merge
git rev-parse --verify --quiet "$commit" || continue
tested C $commit && continue
echo "TEST C $commit"
esac
done |
sed -n -e 's/^TEST //p' >.Cycle/plan
count=$(wc -l <.Cycle/plan)
case $count in 0) return ;; esac
total=$count
echo TEST $count ON $(date) >>.Cycle/log
while read tip merge
do
case "$tip" in
M)
type=M
commit=$merge
subject=$(git show -s --format="%s" "$commit") ;;
C)
type=C
commit=$merge
subject=$(git show -s --format="%s" "$commit") ;;
*)
type=T
commit=$tip
subject=$(
git show -s --format="%s" "$merge" |
sed -e 's/^Merge branch '\''\(.*\)'\'' into .*/\1/'
) ;;
esac
echo >&2 -n "$count/$total ?? $subject"
if test_it $type $commit "$subject"
then
OK=OK
else
OK=NG
fi
echo "$OK $type$commit $count" >>.Cycle/log
echo "$OK $type$(git rev-parse $commit^{tree}) $count" >>.Cycle/log
echo >&2 "$count/$total $OK $subject"
count=$(( $count - 1 ))
done <.Cycle/plan
}
: >>.Cycle/log
git reflog expire --expire=now --expire-unreachable=now --all
git gc
for l in .Cycle/log.[0-9a-f]*
do
x=${l##*.}
git rev-parse --verify "$x" >/dev/null 2>&1 || rm -f "$l"
done
git fetch
(
git rev-list --no-merges $RANGE
git rev-list --first-parent --parents $RANGE
) | test_them