Updates: show-branch
[git/git.git] / git-repack-script
CommitLineData
b2d46199 1#!/bin/sh
ccf1ee32
JH
2#
3# Copyright (c) 2005 Linus Torvalds
4#
5
b33e9666
LT
6. git-sh-setup-script || die "Not a git archive"
7
ccf1ee32
JH
8no_update_info=
9while case "$#" in 0) break ;; esac
10do
11 case "$1" in
12 -n) no_update_info=t ;;
13 *) break ;;
14 esac
15 shift
16done
17
5f3de58f
LT
18rm -f .tmp-pack-*
19packname=$(git-rev-list --unpacked --objects $(git-rev-parse --all) |
20 git-pack-objects --non-empty --incremental .tmp-pack) ||
b2d46199 21 exit 1
5f3de58f 22if [ -z "$packname" ]; then
b2d46199
LT
23 echo Nothing new to pack
24 exit 0
25fi
ccf1ee32 26
b33e9666
LT
27mkdir -p "$GIT_OBJECT_DIRECTORY/pack" &&
28mv .tmp-pack-$packname.pack "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.pack" &&
ccf1ee32
JH
29mv .tmp-pack-$packname.idx "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.idx" &&
30case "$no_update_info" in
31t) : ;;
32*) git-update-server-info ;;
33esac