diff options
| Commit | 709a50ab8fc61395182500b6815dccf9aba40b47 (patch) | |
|---|---|---|
| Author | 2026-11-02 20:30:33 +0200 | |
| Committer | 2026-11-02 20:30:33 +0200 | |
| Files | b28b244c584ab70453dd1e2070e5c0954578cf87 /scripts | |
| cli-main.tar cli-main.tar.gz cli-main.zip | ||
| Parent | e52ee8a3f702e82df6a686c03cdc0b2366d0770a (diff) | |
2 files changed, 50 insertions, 0 deletions
| -rwxr-xr-x | scripts/protect | 25 | ||||
| -rwxr-xr-x | scripts/unprotect | 25 |
diff --git a/scripts/protect b/scripts/protect new file mode 100755 index 0000000..b656b84 --- /dev/null +++ b/scripts/protect @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ -z "$1" ] +then + printf 'Repository : ' + read + set "$REPLY" +fi + +if [ ! -f "$1/HEAD" ] +then + echo 'Not a repository!' + exit 1 +fi + +if [ ! -w "$1/HEAD" ] +then + echo 'Read-only repository!' + exit 2 +fi + +if cd "$1" +then + git config set --file ./config receive.denyNonFastForwards true +fi diff --git a/scripts/unprotect b/scripts/unprotect new file mode 100755 index 0000000..d1b47ca --- /dev/null +++ b/scripts/unprotect @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ -z "$1" ] +then + printf 'Repository : ' + read + set "$REPLY" +fi + +if [ ! -f "$1/HEAD" ] +then + echo 'Not a repository!' + exit 1 +fi + +if [ ! -w "$1/HEAD" ] +then + echo 'Read-only repository!' + exit 2 +fi + +if cd "$1" +then + git config unset --file ./config receive.denyNonFastForwards +fi |
