Browse Source

add script to verify that the ls-remote files matches the branches/tags

in the tree..
remotes/origin/main
John-Mark Gurney 2 years ago
parent
commit
4a4d9860ad
1 changed files with 53 additions and 0 deletions
  1. +53
    -0
      verify.sh

+ 53
- 0
verify.sh View File

@@ -0,0 +1,53 @@
#!/bin/sh

verifylsremote()
{
fname="$1"

# $ git show-ref gm/2021-09-23T00Z/github.com--lark-parser-lark/0.6.6
# 2b3fabd01cec3f6803ec7d255bf0436476c2b812 refs/tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.6.6
# $ grep '0.6.6$' gm/github.com--lark-parser-lark/2021-09-23T00Z.refs.txt
# 2b3fabd01cec3f6803ec7d255bf0436476c2b812 refs/tags/0.6.6

projname="${fname#gm/}"
projname="${projname%/*}"
date="${fname##*/}"
date="${date%.refs.txt}"

while read hash refname; do
part="${refname##*/}"
header="${refname%/*}"

if [ x"$refname" = x"HEAD" ]; then
continue
fi

if [ x"$header" != x"refs/head" -a x"$header" != x"refs/tags" ]; then
# skipping non-branch, non-tags
continue
fi

read outphash outrefname << INNEREOF
$(git show-ref "gm/$date/$projname/$part")
INNEREOF
if [ x"$outphash" != x"$hash" ]; then
echo "Hash does not match for $refname in $fname:"
echo "$hash != $outphash"
fi
if [ x"${outrefname%/gm/*}" != x"$header" ]; then
echo "Type does not match for $refname in $fname:"
echo "${outrefname%/gm/*} != $header"
fi
if [ x"${outrefname##*/}" != x"$part" ]; then
echo "Name does not match for $refname in $fname:"
echo "${outrefname##*/} != $part"
fi

done <<EOF
$(cat "$fname")
EOF
}

for i in gm/*/*; do
verifylsremote "$i"
done

Loading…
Cancel
Save