From 5591d99ee239be9116f4879bfea4a538b0b89e9c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Apr 2024 12:17:13 -0400 Subject: release: update-hooks: helper for automatically syncing hooks These hooks are maintained in other projects. Add a script to automate their import so people don't send us changes directly, and we can try to steer them to the correct place. Change-Id: Iac0bdb3aae84dda43a1600e73107555b513ce82b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/422177 Commit-Queue: Mike Frysinger Tested-by: Mike Frysinger Reviewed-by: Josip Sokcevic --- hooks/commit-msg | 8 +++++--- hooks/pre-auto-gc | 47 +++++++++++++++++------------------------------ 2 files changed, 22 insertions(+), 33 deletions(-) (limited to 'hooks') diff --git a/hooks/commit-msg b/hooks/commit-msg index 112df63f..a6721d40 100755 --- a/hooks/commit-msg +++ b/hooks/commit-msg @@ -1,5 +1,8 @@ #!/bin/sh -# From Gerrit Code Review 3.10.0 d5403dbf335ba7d48977fc95170c3f7027c34659 +# DO NOT EDIT THIS FILE +# All updates should be sent upstream: https://gerrit.googlesource.com/gerrit/ +# This is synced from commit: 62f5bbea67f6dafa6e22a601a0c298214c510caf +# DO NOT EDIT THIS FILE # # Part of Gerrit Code Review (https://www.gerritcodereview.com/) # @@ -31,8 +34,7 @@ if test ! -f "$1" ; then fi # Do not create a change id if requested -create_setting=$(git config --get gerrit.createChangeId) -case "$create_setting" in +case "$(git config --get gerrit.createChangeId)" in false) exit 0 ;; diff --git a/hooks/pre-auto-gc b/hooks/pre-auto-gc index ec29be43..fb7b7630 100755 --- a/hooks/pre-auto-gc +++ b/hooks/pre-auto-gc @@ -1,33 +1,25 @@ #!/bin/sh +# DO NOT EDIT THIS FILE +# All updates should be sent upstream: https://github.com/git/git +# This is synced from commit: 00e10ef10e161a913893b8cb33aa080d4ca5baa6 +# DO NOT EDIT THIS FILE # # An example hook script to verify if you are on battery, in case you -# are running Windows, Linux or OS X. Called by git-gc --auto with no -# arguments. The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the auto repacking. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# are running Linux or OS X. Called by git-gc --auto with no arguments. +# The hook should exit with non-zero status after issuing an appropriate +# message if it wants to stop the auto repacking. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This hook is stored in the contrib/hooks directory. Your distribution +# may have put this somewhere else. If you want to use this hook, you +# should make this script executable then link to it in the repository +# you would like to use it in. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -if uname -s | grep -q "_NT-" -then - if test -x $SYSTEMROOT/System32/Wbem/wmic - then - STATUS=$(wmic path win32_battery get batterystatus /format:list | tr -d '\r\n') - [ "$STATUS" = "BatteryStatus=2" ] && exit 0 || exit 1 - fi - exit 0 -fi +# For example, if the hook is stored in +# /usr/share/git-core/contrib/hooks/pre-auto-gc-battery: +# +# cd /path/to/your/repository.git +# ln -sf /usr/share/git-core/contrib/hooks/pre-auto-gc-battery \ +# hooks/pre-auto-gc if test -x /sbin/on_ac_power && (/sbin/on_ac_power;test $? -ne 1) then @@ -48,11 +40,6 @@ elif test -x /usr/bin/pmset && /usr/bin/pmset -g batt | grep -q "drawing from 'AC Power'" then exit 0 -elif test -d /sys/bus/acpi/drivers/battery && test 0 = \ - "$(find /sys/bus/acpi/drivers/battery/ -type l | wc -l)"; -then - # No battery exists. - exit 0 fi echo "Auto packing deferred; not on AC" -- cgit v1.2.3-54-g00ecf