diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-10-08 19:45:21 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-10-08 19:45:37 +0200 |
commit | 2df30c27ead445724d066fc7df301be4d22f3c44 (patch) | |
tree | 77280c37de4b670c0cbb30de625e47809f9fa6e9 /exp/exp.sh | |
parent | b3fee746c053990c88c0e067b1a654acbeb1cd1f (diff) | |
download | dna-backup-2df30c27ead445724d066fc7df301be4d22f3c44.tar.gz dna-backup-2df30c27ead445724d066fc7df301be4d22f3c44.zip |
add git nopack to exp
Diffstat (limited to 'exp/exp.sh')
-rwxr-xr-x | exp/exp.sh | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -3,19 +3,32 @@ # This script expects the following variables to be exported: # - DNA_BACKUP: the path to dna-backup binary # - REPO_PATH: the path of the repo the experiment is based on +# - GIT_PATH: the path of the repo git-dir # - MAX_VERSION: the max number for versions for the experiment # - COMMITS: the name of the file that contains the lists of versions # - DNA_4K: the path fo the dna-backup dir with 4K chunksize # - DNA_8K: the path fo the dna-backup dir with 8K chunksize # - DIFFS: the path of the git diff dir +# - GIT_NOPACK: the path of the git nopack dir log() { echo -e "\033[90m$(date +%T.%3N)\033[0m" $* } +set-git-dir() { + echo gitdir: $1 > $REPO_PATH/.git +} + GITC="git -C $REPO_PATH" OUT=/tmp/dna-backup-exp-out +# Init git nopack dir +rm $REPO_PATH/.git +$GITC init --separate-git-dir=$GIT_NOPACK +$GITC --git-dir=$GIT_NOPACK config gc.auto 0 +set-git-dir $GIT_PATH +nopack_prev=0 + # "empty tree" commit prev="4b825dc642cb6eb9a060e54bf8d69288fbee4904" last=$(tail --lines=1 $COMMITS | cut -f1) @@ -38,6 +51,22 @@ do | gzip \ > $diff + # Create git nopack for this version + log "create git nopack for this version" + set-git-dir $GIT_NOPACK + $GITC add . + $GITC commit -m $hash &> $OUT \ + || (log "error commiting to nopack"; cat $OUT; exit 1) + ls $GIT_NOPACK/objects/pack + find $GIT_NOPACK -type f -exec du -ba {} + \ + | grep -v /logs/ \ + | cut -f1 \ + | paste -sd+ \ + | xargs -i echo {} - $nopack_prev \ + | bc \ + > $(printf "%s.versions/%05d" $GIT_NOPACK $i) + set-git-dir $GIT_PATH + # Create 4k dna backup for this version log "create 4k dna backup for this version" $DNA_BACKUP commit -v 2 -c 4096 $REPO_PATH $DNA_4K |