change: Change order of commit validation routine

We currently validate all commits going from latest -> oldest.

It would be nicer to go oldest -> latest so that, in case of errors,
we would indicate which commit "introduced" the problem.

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2023-07-22 10:43:19 +02:00
parent bc03d8b8f2
commit 347c2ce721
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
2 changed files with 7 additions and 2 deletions

View file

@ -356,7 +356,7 @@ def main(): # noqa: C901
die("denying non-fast-forward (you should pull first)")
# Prepare the walker that validates new commits.
walker = repo.walk(sha1_new, pygit2.GIT_SORT_TOPOLOGICAL)
walker = repo.walk(sha1_new, pygit2.GIT_SORT_REVERSE)
if sha1_old != "0" * 40:
walker.hide(sha1_old)

View file

@ -312,11 +312,16 @@ test_expect_success 'Pushing a tree with a large blob.' '
printf "%256001s" x >aur.git/file &&
git -C aur.git add file &&
git -C aur.git commit -q -m "Add large blob" &&
first_error=$(git -C aur.git rev-parse HEAD) &&
touch aur.git/another.file &&
git -C aur.git add another.file &&
git -C aur.git commit -q -m "Add another commit" &&
new=$(git -C aur.git rev-parse HEAD) &&
test_must_fail \
env AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
cover "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
grep -q "^error: maximum blob size (250.00KiB) exceeded$" actual
grep -q "^error: maximum blob size (250.00KiB) exceeded$" actual &&
grep -q "^error: $first_error:$" actual
'
test_expect_success 'Pushing .SRCINFO with a non-matching package base.' '