Skip to content

Honor ignore-private for existing backups - #236

Open
dajiaohuang wants to merge 1 commit into
amitsaha:masterfrom
dajiaohuang:fix/ignore-private-existing-repositories
Open

dajiaohuang wants to merge 1 commit into
amitsaha:masterfrom
dajiaohuang:fix/ignore-private-existing-repositories

Conversation

@dajiaohuang

Copy link
Copy Markdown

Problem

-ignore-private was enforced only while cloning a new repository. When a private repository already existed in the backup directory, backUp selected updateExistingRepo first, so it was still updated despite the exclusion option.

Change

Skip private repositories at the start of backUp, before checking the destination path. This applies the option to both new and existing backups. The regression test uses an in-memory filesystem and a synthetic failing Git command to prove an existing private repository is not updated.

Verification

  • Focused backup tests passed.
  • go test -mod=readonly . -skip 'ArchiveDownloadFail' -count=1 passed on Go 1.26.3 / Windows amd64. The two excluded archive-failure tests redirect to 127.0.0.1:8080; they were not run to avoid contacting a potentially live local service.
  • gofmt -d backup.go backup_test.go and git diff --check passed.

@amitsaha

Copy link
Copy Markdown
Owner

@dajiaohuang thanks for the PR. Can i confirm you verified the fix with a real run with one of the supported git hosts?

@dajiaohuang

Copy link
Copy Markdown
Author

No—I did not verify it with a real supported Git host. I reproduced the existing-backup path with a synthetic in-memory regression and ran the focused tests plus the safe package suite. I did not run an actual backup job or clone against a remote host/account, so real-host behavior remains unverified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants