Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions scripts/diffcheck.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
#!/bin/bash

scripts/buildtable.pl >/tmp/table.mediawiki 2> /dev/null
diff README.mediawiki /tmp/table.mediawiki | grep '^[<>] |' >/tmp/after.diff || true
if git checkout HEAD^ && scripts/buildtable.pl >/tmp/table.mediawiki 2>/dev/null; then
diff README.mediawiki /tmp/table.mediawiki | grep '^[<>] |' >/tmp/before.diff || true
newdiff=$(diff -s /tmp/before.diff /tmp/after.diff -u | grep '^+')
# Create secure temporary directories and ensure cleanup
tmp_dir="$(mktemp -d)"; prev_dir="$(mktemp -d)"; trap 'rm -rf "$tmp_dir" "$prev_dir"' EXIT

# Paths for current commit artifacts
table_file="$tmp_dir/table.mediawiki"
after_diff="$tmp_dir/after.diff"
before_diff="$tmp_dir/before.diff"
table_prev_file="$tmp_dir/table_prev.mediawiki"

# Build table from current working tree and compute diff
scripts/buildtable.pl >"$table_file" 2>/dev/null
diff README.mediawiki "$table_file" | grep '^[<>] |' >"$after_diff" || true

# Build table from previous commit without altering the working tree
if git archive --format=tar HEAD^ | tar -x -C "$prev_dir" && perl "$prev_dir/scripts/buildtable.pl" >"$table_prev_file" 2>/dev/null; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this run the previous rev script with the current rev contents?

diff "$prev_dir/README.mediawiki" "$table_prev_file" | grep '^[<>] |' >"$before_diff" || true
newdiff=$(diff -s "$before_diff" "$after_diff" -u | grep '^+')
if [ -n "$newdiff" ]; then
echo "$newdiff"
exit 1
Expand Down