summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2025-01-02 07:26:50 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2025-01-02 07:26:50 +0000
commitcecb7202b6060695319949d792b1981c5c52d845 (patch)
treed5b0e2e4dd3238bb18678db1ec7b2c59d8b2401f
parentReformating services list in dehydrated service-reload hook for better readab... (diff)
downloadservice-tools-cecb7202b6060695319949d792b1981c5c52d845.tar.xz
service-tools-cecb7202b6060695319949d792b1981c5c52d845.zip
Adding support for external git directory for repositories in git-repo-repack.HEADmain
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-xgit/bin/git-repo-repack27
1 files changed, 23 insertions, 4 deletions
diff --git a/git/bin/git-repo-repack b/git/bin/git-repo-repack
index f78f40b..726c6a6 100755
--- a/git/bin/git-repo-repack
+++ b/git/bin/git-repo-repack
@@ -35,12 +35,31 @@ REPOSITORIES="${*}"
if [ -z "${REPOSITORIES}" ]
then
- if [ ! -e HEAD ]
+ # repository with git directory
+ if [ -e .git ] && [ ! -d .git ]
then
- REPOSITORIES="*.git"
- else
- REPOSITORIES="$(pwd)"
+ REPOSITORIES="$(awk -Fgitdir:\ '{ print $2 }' .git)"
fi
+
+ if [ ! -d "${REPOSITORIES}" ]
+ then
+ if [ ! -e HEAD ]
+ then
+ if [ -d .git ]
+ then
+ REPOSITORIES="$(pwd)/.git"
+ fi
+ else
+ # bare repository
+ REPOSITORIES="$(pwd)"
+ fi
+ fi
+fi
+
+if [ -z "${REPOSITORIES}" ]
+then
+ echo "current directory is not a git repository, doing nothing."
+ exit 1
fi
for REPOSITORY in ${REPOSITORIES}