[PATCH] Make .git directory validation code test HEAD
[git/trast.git] / git-repack-script
blob1c9a6315dd63dd27462aa7ca10880f7d3cb663c2
1 #!/bin/sh
3 # Copyright (c) 2005 Linus Torvalds
6 . git-sh-setup-script || die "Not a git archive"
8 no_update_info=
9 while case "$#" in 0) break ;; esac
11 case "$1" in
12 -n) no_update_info=t ;;
13 *) break ;;
14 esac
15 shift
16 done
18 rm -f .tmp-pack-*
19 packname=$(git-rev-list --unpacked --objects $(git-rev-parse --all) |
20 git-pack-objects --non-empty --incremental .tmp-pack) ||
21 exit 1
22 if [ -z "$packname" ]; then
23 echo Nothing new to pack
24 exit 0
27 mkdir -p "$GIT_OBJECT_DIRECTORY/pack" &&
28 mv .tmp-pack-$packname.pack "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.pack" &&
29 mv .tmp-pack-$packname.idx "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.idx" &&
30 case "$no_update_info" in
31 t) : ;;
32 *) git-update-server-info ;;
33 esac