Make the name of a pack-file depend on the objects packed there-in.
[git/dscho.git] / git-repack-script
blob92281c27fdda5f3b3dd0b0dfc01a4cb3182a686a
1 #!/bin/sh
2 : ${GIT_DIR=.git}
3 : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
4 rm -f .tmp-pack-*
5 packname=$(git-rev-list --unpacked --objects $(git-rev-parse --all) |
6 git-pack-objects --non-empty --incremental .tmp-pack) ||
7 exit 1
8 if [ -z "$packname" ]; then
9 echo Nothing new to pack
10 exit 0
12 mv .tmp-pack-$packname.pack "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.pack"
13 mv .tmp-pack-$packname.idx "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.idx"