check if work directory is repository
This commit is contained in:
parent
81fa3f69bf
commit
edf9ea7cd7
1 changed files with 9 additions and 1 deletions
10
gis
10
gis
|
|
@ -75,7 +75,7 @@ while (( "$#" )); do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Add $GIS_PATH or current work directory to paths if none is given
|
# Add $GIS_PATH, current Git repository or current work directory to paths if none is given
|
||||||
if [ "${paths[*]}" == "" ]; then
|
if [ "${paths[*]}" == "" ]; then
|
||||||
if [ "$GIS_PATH" ]; then
|
if [ "$GIS_PATH" ]; then
|
||||||
OLDIFS=$IFS
|
OLDIFS=$IFS
|
||||||
|
|
@ -90,6 +90,14 @@ fi
|
||||||
git_dirs=()
|
git_dirs=()
|
||||||
for path in "${paths[@]}"; do
|
for path in "${paths[@]}"; do
|
||||||
readarray -t found_git_dirs < <(find "$path" -type d -name ".git" -exec dirname {} \; | sort)
|
readarray -t found_git_dirs < <(find "$path" -type d -name ".git" -exec dirname {} \; | sort)
|
||||||
|
|
||||||
|
# Check if inside of a repository if none found
|
||||||
|
if [ "${#found_git_dirs[@]}" -eq 0 ]; then
|
||||||
|
if git rev-parse > /dev/null 2>&1; then
|
||||||
|
found_git_dirs+=("$(git rev-parse --show-toplevel)")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
git_dirs+=("${found_git_dirs[@]}")
|
git_dirs+=("${found_git_dirs[@]}")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue