diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2025-01-02 07:26:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2025-01-02 07:26:50 +0000 |
commit | cecb7202b6060695319949d792b1981c5c52d845 (patch) | |
tree | d5b0e2e4dd3238bb18678db1ec7b2c59d8b2401f | |
parent | Reformating services list in dehydrated service-reload hook for better readab... (diff) | |
download | service-tools-cecb7202b6060695319949d792b1981c5c52d845.tar.xz service-tools-cecb7202b6060695319949d792b1981c5c52d845.zip |
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-x | git/bin/git-repo-repack | 27 |
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} |