From 9277c74522f302f5307961e157a8014d263a8286 Mon Sep 17 00:00:00 2001 From: Rachel Dowavic Date: Thu, 26 Feb 2026 15:43:45 +1100 Subject: [PATCH 1/2] Add ignore-fork tests to integration test script Test 5 verifies forked hello-world repo is present without the flag. Test 6 verifies -ignore-fork skips the fork while keeping non-fork repos. Also updates setup docs to mention forking a hello-world repo. --- test/INTEGRATION_TESTING.md | 4 +++ test/integration-test.sh | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/test/INTEGRATION_TESTING.md b/test/INTEGRATION_TESTING.md index 7520a0d..3105fa0 100644 --- a/test/INTEGRATION_TESTING.md +++ b/test/INTEGRATION_TESTING.md @@ -18,6 +18,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) +3. Fork any public `hello-world` repo (for testing `-ignore-fork`) ### GitLab @@ -25,6 +26,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two projects: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) +3. Fork any public `hello-world` project (for testing `-ignore-fork`) ### Bitbucket @@ -32,6 +34,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create a workspace and two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) +3. Fork any public `hello-world` repo into your workspace (for testing `-ignore-fork`) ### Forgejo (Codeberg) @@ -39,6 +42,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) +3. Fork any public `hello-world` repo (for testing `-ignore-fork`) ## Environment Setup diff --git a/test/integration-test.sh b/test/integration-test.sh index b95a351..70fe860 100755 --- a/test/integration-test.sh +++ b/test/integration-test.sh @@ -192,6 +192,56 @@ run_service_tests() { fail "$service ($label): ignore-private — gitbackup exited with error" fi + rm -rf "$tmpdir" + + # Test 5: Ignore fork + tmpdir=$(mktemp -d) + + echo " Running clone without -ignore-fork (fork should be present)..." + if run_gitbackup -service "$service" -backupdir "$tmpdir" $extra_flags; then + if check_repo_exists "$tmpdir" "hello-world"; then + echo " Found hello-world (forked repo)" + pass "$service ($label): fork present without -ignore-fork" + else + echo " Missing hello-world (forked repo)" + fail "$service ($label): fork present without -ignore-fork — hello-world not found" + fi + else + fail "$service ($label): fork present without -ignore-fork — gitbackup exited with error" + fi + + rm -rf "$tmpdir" + + # Test 6: Ignore fork (with flag) + tmpdir=$(mktemp -d) + + echo " Running clone with -ignore-fork..." + if run_gitbackup -service "$service" -backupdir "$tmpdir" -ignore-fork $extra_flags; then + if check_repo_exists "$tmpdir" "hello-world"; then + echo " Found hello-world (unexpected — should be skipped)" + fail "$service ($label): ignore-fork — forked repo should have been skipped" + else + echo " Correctly skipped hello-world" + # Verify non-fork repos are still present + all_found=true + for repo_name in $EXPECTED_REPOS; do + if check_repo_exists "$tmpdir" "$repo_name"; then + echo " Found $repo_name" + else + echo " Missing $repo_name" + all_found=false + fi + done + if $all_found; then + pass "$service ($label): ignore-fork" + else + fail "$service ($label): ignore-fork — non-fork repos missing" + fi + fi + else + fail "$service ($label): ignore-fork — gitbackup exited with error" + fi + rm -rf "$tmpdir" trap - RETURN } From 3ac18b2d11a8726a133a1e95d10b771bd3f7bbd7 Mon Sep 17 00:00:00 2001 From: Rachel Dowavic Date: Thu, 26 Feb 2026 16:57:27 +1100 Subject: [PATCH 2/2] Rename fork test repo from hello-world to gitbackup-test-ignore-fork --- test/INTEGRATION_TESTING.md | 8 ++++---- test/integration-test.sh | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/INTEGRATION_TESTING.md b/test/INTEGRATION_TESTING.md index 3105fa0..922624e 100644 --- a/test/INTEGRATION_TESTING.md +++ b/test/INTEGRATION_TESTING.md @@ -18,7 +18,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) -3. Fork any public `hello-world` repo (for testing `-ignore-fork`) +3. Fork any public repo and rename it to `gitbackup-test-ignore-fork` (for testing `-ignore-fork`) ### GitLab @@ -26,7 +26,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two projects: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) -3. Fork any public `hello-world` project (for testing `-ignore-fork`) +3. Fork any public project and rename it to `gitbackup-test-ignore-fork` (for testing `-ignore-fork`) ### Bitbucket @@ -34,7 +34,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create a workspace and two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) -3. Fork any public `hello-world` repo into your workspace (for testing `-ignore-fork`) +3. Fork any public repo into your workspace and rename it to `gitbackup-test-ignore-fork` (for testing `-ignore-fork`) ### Forgejo (Codeberg) @@ -42,7 +42,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) -3. Fork any public `hello-world` repo (for testing `-ignore-fork`) +3. Fork any public repo and rename it to `gitbackup-test-ignore-fork` (for testing `-ignore-fork`) ## Environment Setup diff --git a/test/integration-test.sh b/test/integration-test.sh index 70fe860..f263280 100755 --- a/test/integration-test.sh +++ b/test/integration-test.sh @@ -199,12 +199,12 @@ run_service_tests() { echo " Running clone without -ignore-fork (fork should be present)..." if run_gitbackup -service "$service" -backupdir "$tmpdir" $extra_flags; then - if check_repo_exists "$tmpdir" "hello-world"; then - echo " Found hello-world (forked repo)" + if check_repo_exists "$tmpdir" "gitbackup-test-ignore-fork"; then + echo " Found gitbackup-test-ignore-fork (forked repo)" pass "$service ($label): fork present without -ignore-fork" else - echo " Missing hello-world (forked repo)" - fail "$service ($label): fork present without -ignore-fork — hello-world not found" + echo " Missing gitbackup-test-ignore-fork (forked repo)" + fail "$service ($label): fork present without -ignore-fork — gitbackup-test-ignore-fork not found" fi else fail "$service ($label): fork present without -ignore-fork — gitbackup exited with error" @@ -217,11 +217,11 @@ run_service_tests() { echo " Running clone with -ignore-fork..." if run_gitbackup -service "$service" -backupdir "$tmpdir" -ignore-fork $extra_flags; then - if check_repo_exists "$tmpdir" "hello-world"; then - echo " Found hello-world (unexpected — should be skipped)" + if check_repo_exists "$tmpdir" "gitbackup-test-ignore-fork"; then + echo " Found gitbackup-test-ignore-fork (unexpected — should be skipped)" fail "$service ($label): ignore-fork — forked repo should have been skipped" else - echo " Correctly skipped hello-world" + echo " Correctly skipped gitbackup-test-ignore-fork" # Verify non-fork repos are still present all_found=true for repo_name in $EXPECTED_REPOS; do