1#!/bin/sh
2: ${GIT_DIR=.git}
3: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
4rm -f .tmp-pack-*
5packname=$(git-rev-list --unpacked --objects $(git-rev-parse --all) |
6git-pack-objects --non-empty --incremental .tmp-pack) ||
7exit 1
8if [ -z "$packname" ]; then
9echo Nothing new to pack
10exit 0
11fi
12mv .tmp-pack-$packname.pack "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.pack"
13mv .tmp-pack-$packname.idx "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.idx"