commit cb0dff95e8e44908c7837ae00d38efd00fafcbb5
parent 11889ba02bfd736fa6fa28d4561c045d57e4ae0b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Sat, 20 Jun 2026 14:34:13 +0200
git-barepo: check for Incompatible Options
The options for making the repository public or private are mutually
exclusive. The same applies to the options for enabling or disabling
dumb transport. From now on, an error is returned if these options are
used at the same time.
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/git-barepo b/git-barepo
@@ -161,6 +161,16 @@ done
[ "${OPTIND}" -gt "$#" ] && { synopsis; die; }
+if [ -n "${group}" ] && [ "${privatise}" -ne 0 ]; then
+ >&2 printf 'The -s and -p options are mutually exclusive.\n'
+ die
+fi
+
+if [ "${nodumb}" -ne 0 ] && [ "${dumb}" -ne 0 ]; then
+ >&2 printf 'The -D and -d options are mutually exclusive.\n'
+ die
+fi
+
# Skip parsed arguments
shift $((OPTIND - 1))
diff --git a/test_barepo.sh b/test_barepo.sh
@@ -137,6 +137,12 @@ check_shared_repo "${git}" "${group}"
git barepo -p "${git}"
check_private_repo "${git}"
+# Sharing and privatization are mutually exclusive
+! git barepo -s "${group}" -p "${git}" || die 1
+
+# Dumb transport cannot be enabled and disabled...
+! git barepo -Dd "${git}" || die
+
# Update repository sharing via a symoblic link
git barepo -s "${group}" "${link}"
check_shared_repo "${git}" "${group}"