git-repo

Tools for sharing git bare repositories
git clone git://git.meso-star.fr/git-repo.git
Log | Files | Refs | README | LICENSE

commit d767460e9a1fda2eadcf9639e567221af714df23
parent d73674c918d3a1a4ed636dd1f13d30326573740e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Sun, 30 Nov 2025 16:39:56 +0100

Use the correct operator during testing

Do not test the negation of a comparison, but directly test the operator
that reverses the comparison. For example, do not test the negation of
equality between two terms, but directly test their inequality.

Diffstat:
Mgit-publish | 4++--
Mgit-repo | 6+++---
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/git-publish b/git-publish @@ -116,7 +116,7 @@ publish_repo() # Create directory publicly served by the WWW daemon repo_www="${dir_www}/${repo_name}" - [ ! "${force}" -eq 0 ] && rm -rf "${repo_www}" + [ "${force}" -ne 0 ] && rm -rf "${repo_www}" mkdir -p "${repo_www}" # Generate HTML pages for the repository to be published @@ -145,7 +145,7 @@ check_post_receive_hook() if [ -e "$1/hooks/post-receive" ]; then header2="$(sed -n '2p' "$1/hooks/post-receive")" - if [ ! "${header}" = "${header2}" ]; then + if [ "${header}" != "${header2}" ]; then return 1 fi fi diff --git a/git-repo b/git-repo @@ -207,14 +207,14 @@ if [ -n "${group}" ]; then share "${repo}" "${group}" fi -if [ ! "${privatise}" -eq 0 ]; then +if [ "${privatise}" -ne 0 ]; then privatise "${repo}" fi -if [ ! "${dumb}" -eq 0 ]; then +if [ "${dumb}" -ne 0 ]; then dumb "${git_dir}" fi -if [ ! "${nodumb}" -eq 0 ]; then +if [ "${nodumb}" -ne 0 ]; then nodumb "${git_dir}" fi