summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}