commit d89944bc4262750d2c40bf46a11639dbfea231c8
parent 639e61bf1380fdf4b21ddc28b7da11722d8a15bf
Author: Fred Großkopf <fred@kuandu.systems>
Date: Fri, 18 Sep 2026 12:56:30 +0200
Removes gitpages mirror
the mirror functionality is only used internally.
Diffstat:
2 files changed, 0 insertions(+), 156 deletions(-)
diff --git a/gitpages.sh b/gitpages.sh
@@ -40,9 +40,6 @@ Commands:
process_queue
Process queued repository updates.
- mirror SRC DST
- Mirror bare repositories from SRC to DST.
-
generate [REPO]
Generate stagit HTML pages.
If REPO is omitted, generate pages for all repositories.
@@ -459,17 +456,6 @@ cmd_process_queue() {
fi
}
-cmd_mirror() {
- case "$#" in
- 2)
- mirror "$1" "$2"
- ;;
- *)
- error "usage: gitpages mirror SRC DST_DIR"
- ;;
- esac
-}
-
cmd_generate() {
repo=""
config=""
diff --git a/test-gitpages-mirror.sh b/test-gitpages-mirror.sh
@@ -1,142 +0,0 @@
-#!/bin/sh
-
-set -eu
-
-SCRIPT_NAME="./gitpages.sh"
-
-check_script() {
- if [ ! -x "$SCRIPT_NAME" ]; then
- printf 'ERROR: %s not found or not executable\n' "$SCRIPT_NAME" >&2
- printf 'Please run:\n chmod +x git-sync.sh\n ./test-git-sync.sh\n' >&2
- exit 1
- fi
-}
-
-TEST_BASE=""
-cleanup() {
- [ -n "$TEST_BASE" ] && rm -rf "$TEST_BASE"
-}
-trap cleanup EXIT INT TERM
-
-error() {
- printf 'FAIL: %s\n' "$1" >&2
- exit 1
-}
-
-success() {
- printf 'PASS: %s\n' "$1"
-}
-
-setup() {
- TEST_BASE=$(mktemp -d) || error "Failed to create temp dir"
- SRC_DIR="$TEST_BASE/src"
- DST_DIR="$TEST_BASE/dst"
- mkdir -p "$SRC_DIR" "$DST_DIR"
-}
-
-assert_fails() {
- test_num="$1"
- test_desc="$2"
- shift 2
- printf '=== Test %s: %s ===\n' "$test_num" "$test_desc"
- "$@" && error "Should fail" || success "Rejects $test_desc"
-}
-
-assert_repo_copied() {
- repo="$1"
- test_name="$2"
- [ -d "$repo" ] && success "$test_name" || error "$test_name"
-}
-
-assert_repo_skipped() {
- repo="$1"
- test_name="$2"
- [ ! -d "$repo" ] && success "$test_name" || error "$test_name"
-}
-
-assert_bare_repo() {
- repo="$1"
- test_name="$2"
- git --git-dir="$repo" rev-parse --is-bare-repository >/dev/null 2>&1 || error "$test_name"
-}
-
-assert_server_info() {
- repo="$1"
- test_name="$2"
- [ -f "$repo/info/refs" ] && success "$test_name" || error "$test_name"
-}
-
-test_args() {
- assert_fails 1 "Wrong number of arguments" "$SCRIPT_NAME" "mirror" "$SRC_DIR" "$DST_DIR" extra_arg
-}
-
-test_bad_src_file() {
- bad_src="$TEST_BASE/bad_src"
- touch "$bad_src"
- assert_fails 2 "Source is file" "$SCRIPT_NAME" "mirror" "$bad_src" "$DST_DIR"
-}
-
-test_bad_dst() {
- bad_dst="$TEST_BASE/bad_dst"
- touch "$bad_dst" && chmod 444 "$bad_dst"
- assert_fails 3 "Destination not writable" "$SCRIPT_NAME" "mirror" "$SRC_DIR" "$bad_dst"
-}
-
-test_empty_src() {
- rm -rf "$SRC_DIR"/*
- assert_fails 4 "Empty source directory" "$SCRIPT_NAME" "mirror" "$SRC_DIR" "$DST_DIR"
-}
-
-test_full_sync() {
- printf '=== Test 5: Full sync ===\n'
- mkdir -p "$SRC_DIR/myrepo.git" "$SRC_DIR/otherrepo"
- (cd "$SRC_DIR/myrepo.git" && git init --bare . >/dev/null 2>&1)
- (cd "$SRC_DIR/otherrepo" && git init >/dev/null 2>&1)
-
- "$SCRIPT_NAME" mirror "$SRC_DIR" "$DST_DIR"
-
- assert_repo_copied "$DST_DIR/myrepo.git" "Bare repo copied"
- assert_repo_skipped "$DST_DIR/otherrepo" "Skipped non-bare"
- assert_bare_repo "$DST_DIR/myrepo.git" "Destination is bare"
- assert_server_info "$DST_DIR/myrepo.git" "update-server-info ran"
-}
-
-test_single_repo() {
- printf '=== Test 6: Single repo ===\n'
- mkdir -p "$SRC_DIR/myrepo.git"
- (cd "$SRC_DIR/myrepo.git" && git init --bare . >/dev/null 2>&1)
-
- "$SCRIPT_NAME" mirror "$SRC_DIR/myrepo.git" "$DST_DIR"
-
- assert_repo_copied "$DST_DIR/myrepo.git" "Single repo copied"
- assert_bare_repo "$DST_DIR/myrepo.git" "Single mode: bare repo"
- assert_server_info "$DST_DIR/myrepo.git" "Single mode: update-server-info ran"
-}
-
-test_root_protection() {
- assert_fails 7 "Root protection" "$SCRIPT_NAME" "mirror" "$SRC_DIR" "/"
-}
-
-test_non_repo_dir() {
- assert_fails 8 "Non-repo directory" "$SCRIPT_NAME" "mirror" "$TEST_BASE" "$DST_DIR"
-}
-
-main() {
- printf 'Testing %s\n' "$SCRIPT_NAME mirror"
- check_script
- setup
-
- test_args
- test_bad_src_file
- test_bad_dst
- test_empty_src
- test_full_sync
- test_single_repo
- test_root_protection
- test_non_repo_dir
-
- printf '\nALL TESTS PASSED!\n'
- printf 'Test environment cleaned up.\n'
-}
-
-[ "${0##*/}" = "test-gitpages-mirror.sh" ] && main "$@"