1 Commits

Author SHA1 Message Date
99027f71d1 fix: make scripts/pre-push.d/check_for_request.sh executable 2025-05-19 07:35:04 +00:00
6 changed files with 2 additions and 50 deletions

View File

@@ -1,14 +1,7 @@
#!/bin/sh
set -eu
SCRIPT_NAMES="applypatch-msg commit-msg fsmonitor-watchman post-update \
pre-applypatch pre-commit pre-merge-commit prepare-commit-msg pre-push \
pre-rebase pre-receive post-commit post-checkout post-merge push-to-checkout \
sendemail-validate update"
DEVEL=0
GIT_TOPDIR=$(git rev-parse --show-toplevel 2>/dev/null)
GIT_OBS_HOOKS_DEBUG=${GIT_OBS_HOOKS_DEBUG:-${GIT_TRACE:-0}}
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
echo "ERROR: Couldn't determine git top directory"
@@ -22,37 +15,8 @@ debug_msg() {
echo "$@" >&1
}
while getopts "d" flag; do
case "${flag}" in
d)
DEVEL=1
;;
\?)
echo "Invalid option: $OPTARG" && exit 1
;;
esac
done
if [ $DEVEL -eq 1 ] ; then
HOOKS_TOPDIR="$HOME/.local/share/git-obs-hooks"
debug_msg "HOOKS_TOPDIR = $HOOKS_TOPDIR and exists: $(test -d "$HOOKS_TOPDIR")"
if [ ! -d "${HOOKS_TOPDIR}" ] ; then
mkdir -p "$HOOKS_TOPDIR"
( cd "$(dirname "$(readlink -f "$0")")"
for script in ${SCRIPT_NAMES} ; do
ln -srf git-obs-hook-template "$HOOKS_TOPDIR/$script"
install -d "${HOOKS_TOPDIR}/${script}.d"
if [ -d "./scripts/${script}.d" ] ; then
for inscript in ./scripts/"${script}".d/* ; do
ln -srf "${inscript}" "${HOOKS_TOPDIR}/${script}.d/$(basename "${inscript}")"
done
fi
done
)
fi
else
HOOKS_TOPDIR="/usr/share/git-obs-hooks"
fi
HOOKS_TOPDIR="/usr/share/git-obs-hooks"
for hook_path in "${HOOKS_TOPDIR}"/*; do
@@ -63,5 +27,5 @@ for hook_path in "${HOOKS_TOPDIR}"/*; do
hook_name=$(basename "${hook_path}")
git_hook_path="${GIT_TOPDIR}/.git/hooks/${hook_name}"
debug_msg "Installing hook ${hook_path} -> ${git_hook_path}"
ln -sTf "${hook_path}" "${git_hook_path}"
ln -s --no-target-directory "${hook_path}" "${git_hook_path}"
done

View File

@@ -1,3 +0,0 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs post-checkout "$@"

View File

@@ -1,3 +0,0 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs post-commit "$@"

View File

@@ -1,3 +0,0 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs post-merge "$@"

0
scripts/pre-push.d/check_for_request.sh Normal file → Executable file
View File

View File

@@ -1,3 +0,0 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs pre-push "$@"