Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use shallow clones for backups #212

Merged
merged 3 commits into from
Oct 16, 2023
Merged

Conversation

amolenaar
Copy link
Contributor

@amolenaar amolenaar commented Oct 3, 2023

Checkout only the latest commit for a branch, just enough to create a new commit upon.

Fixes #209.

t4c/backup.py Show resolved Hide resolved
@amolenaar
Copy link
Contributor Author

Here's the output of some more thorough testing of the backup process.

Preparation

Created a bare repository:

git init --bare myrepo

First backup on fresh branch

[master (root-commit) 2369e91] Backup
 6 files changed, 833 insertions(+)
 create mode 100644 .project
 create mode 100644 CommitHistory.activitymetadata
 create mode 100644 CommitHistory.json
 create mode 100644 Test.afm
 create mode 100644 Test.aird
 create mode 100644 Test.capella
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 9.04 KiB | 9.04 MiB/s, done.
Total 8 (delta 1), reused 0 (delta 0), pack-reused 0
To /tmp/myrepo
 * [new branch]      HEAD -> my-branch
INFO:Importer:Backup of model finished

Second backup on existin gbranch

[my-branch 4d5ab1f] Backup
 2 files changed, 176 insertions(+), 176 deletions(-)
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 721 bytes | 721.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
To /tmp/myrepo
   2369e91..4d5ab1f  HEAD -> my-branch
INFO:Importer:Backup of model finished

Check the repo

root@fedora:~# git clone --branch=my-branch /tmp/myrepo
Cloning into 'myrepo'...
done.
root@fedora:~# cd myrepo/
root@fedora:~/myrepo# ls
CommitHistory.activitymetadata  CommitHistory.json  Test.afm  Test.aird  Test.capella
root@fedora:~/myrepo# git log
commit 4d5ab1fb9bc865d957ef853bc68d2c2775d06ffd (HEAD -> my-branch, origin/my-branch)
Author: user <[email protected]>
Date:   Fri Oct 13 16:41:39 2023 +0000

    Backup

commit 2369e91ccfd5c388fa12c35c0d998c85ede0ea8f
Author: user <[email protected]>
Date:   Fri Oct 13 16:39:02 2023 +0000

    Backup

root@fedora:~/myrepo#

Copy link
Member

@MoritzWeber0 MoritzWeber0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement and thanks for testing it 🥳

@MoritzWeber0 MoritzWeber0 changed the title fix: use shallow clones for backups feat: use shallow clones for backups Oct 16, 2023
@MoritzWeber0 MoritzWeber0 merged commit b2a8239 into main Oct 16, 2023
18 checks passed
@MoritzWeber0 MoritzWeber0 deleted the backup-shallow-clone branch October 16, 2023 14:12
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.

Shallow clone Git repository during backup
2 participants