git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Simplify packing public repositories

From
THTimo Hirvonen <tihirvon@gmail.com>
Date
May 16, 2006, 11:46 UTC
Message-ID
<20060516144635.010bb65f.tihirvon@gmail.com>

Support "git repack project.git" syntax which is more intuitive than using the GIT_DIR environment variable.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
---
 git-repack.sh |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
c09c41750023e5b502312ddaa21bf5a2371e66ac
diff --git a/git-repack.sh b/git-repack.sh
index 4fb3f26..b24cd1a 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -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"
 
-- 
1.3.3.g8701-dirty
Next: Sean
Message 1 of 2 in “Simplify packing public repositories”
  1. Simplify packing public repositoriesTimo Hirvonen, May 16, 2006
  2. SeanMay 16, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.