[PATCH] New git-apply test cases for scanning forwards and backwards.
[git.git] / git-repack-script
1 #!/bin/sh
2 #
3 # Copyright (c) 2005 Linus Torvalds
4 #
5
6 . git-sh-setup-script || die "Not a git archive"
7         
8 no_update_info=
9 while case "$#" in 0) break ;; esac
10 do
11         case "$1" in
12         -n)     no_update_info=t ;;
13         *)      break ;;
14         esac
15         shift
16 done
17
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
25 fi
26
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