Skip to content

Commit fa16ab3

Browse files
committed
test.sh: make sure no commit changes more than one file at a time.
1 parent 49cf822 commit fa16ab3

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,39 @@ check_equal "$(git log --pretty=format:'%s' HEAD^2 | grep -i split)" ""
169169
# meaningless to subproj since one side of the merge refers to the mainline)
170170
check_equal "$(git log --pretty=format:'%s%n%b' HEAD^2 | grep 'git-subtree.*:')" ""
171171

172+
# make sure no patch changes more than one file. The original set of commits
173+
# changed only one file each. A multi-file change would imply that we pruned
174+
# commits too aggressively.
175+
joincommits()
176+
{
177+
echo "hello world"
178+
commit=
179+
all=
180+
while read x y; do
181+
echo "{$x}" >&2
182+
if [ -z "$x" ]; then
183+
continue
184+
elif [ "$x" = "commit:" ]; then
185+
if [ -n "$commit" ]; then
186+
echo "$commit $all"
187+
all=
188+
fi
189+
commit="$y"
190+
else
191+
all="$all $y"
192+
fi
193+
done
194+
echo "$commit $all"
195+
}
196+
x=0
197+
git log --pretty=format:'commit: %H' | joincommits |
198+
( while read commit a b; do
199+
echo "Verifying commit $commit"
200+
check_equal "$b" ""
201+
x=$(($x + 1))
202+
done
203+
check_equal $x 23
204+
) || exit 1
205+
172206
echo
173207
echo 'ok'

0 commit comments

Comments
 (0)