Simplify packing public repositories
PATCH 1/1 Simplify packing public repositories
Support "git repack project.git" syntax which is more intuitive than using the GIT_DIR environment variable.
Signed-off-by Timo Hirvonen <[email protected]>
---
git-repack.sh | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-)
c09c41750023e5b502312ddaa21bf5a2371e66ac
git-repack.sh +24 -3
@@ -3,8 +3,8 @@ # # Copyright (c) 2005 Linus Torvalds # -USAGE='[-a] [-d] [-f] [-l] [-n] [-q]' -. git-sh-setup +unset CDPATH +USAGE='[-a] [-d] [-f] [-l] [-n] [-q] [GIT_DIR]' no_update_info= all_into_one= remove_redundant= local= quiet= no_reuse_delta= extra=
@@ -19,11 +19,32 @@ do -l) local=--local ;; --window=*) extra="$extra $1" ;; --depth=*) extra="$extra $1" ;; - *) usage ;; + -h|--h|--he|--hel|--help) + echo "Usage: $0 $USAGE" + exit + ;; + *) + if test "$#" -gt 1 + then + echo >&2 "Usage: $0 $USAGE" + exit 1 + fi + export GIT_DIR="$1" + ;; esac shift done +: ${GIT_DIR=.git} +: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"} + +# Make sure we are in a valid repository of a vintage we understand. +GIT_DIR="$GIT_DIR" git repo-config --get core.nosuch >/dev/null +if test $? = 128 +then + exit +fi + rm -f .tmp-pack-* PACKDIR="$GIT_OBJECT_DIRECTORY/pack"
Signature · 1 line
1.3.3.g8701-dirty
Quoted 3 lines · On Tue, 16 May 2006 14:46:35 +0300 Timo Hirvonen <[email protected]> wrote:
Support "git repack project.git" syntax which is more intuitive than using the
GIT_DIRenvironment variable.
There are a few commands that would benefit from being easier to run in a bare repository. If this option was added to the "git" wrapper rather than git-repack, it would work for all of them. But maybe git could just automatically recognize when it's in a bare repository.
Sean