Automatically fall back to listing all projects for edge cases

When in a directory under projects that is not indexes with git,
listprojects would throw an error - it now falls back to
listprojects --all
This commit is contained in:
xerus 2020-03-31 22:33:07 +02:00
parent 1e5bfc5eae
commit e00aa68640
1 changed files with 2 additions and 2 deletions

View File

@ -16,8 +16,8 @@ listprojects() {
if test "$1" = "--all"
then find $projects_dir -mindepth 2 -maxdepth $projects_subfolder_level -type d -name ".git" | xargs dirname
else
if test "$(echo $PWD | grep $projects_dir/)" -a ! -d ".git" && ! git rev-parse --git-dir > /dev/null 2>&1
then find $PWD -mindepth 2 -maxdepth $projects_subfolder_level -type d -name ".git" | xargs dirname
if test "$(echo $PWD | grep $projects_dir/)" && ! git rev-parse --git-dir > /dev/null 2>&1
then find $PWD -mindepth 2 -maxdepth $projects_subfolder_level -type d -name ".git" | xargs dirname 2> /dev/null || listprojects --all
else find $projects_dir -mindepth 2 -maxdepth $projects_subfolder_level -type d -not -path "*_*" -name ".git" | xargs dirname
fi
fi