Skip to content

Commit fcc0cb3

Browse files
committed
Adds support for running it from subdirectories of a repo
1 parent c080f97 commit fcc0cb3

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

git-standup

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,25 @@ if [[ ! -d ".git" || -f ".git" ]]; then
198198

199199
## Recursively search for git repositories
200200
PROJECT_DIRS=`find ${INCLUDE_LINKS} ${SEARCH_PATH} -maxdepth ${MAXDEPTH} -mindepth 0 -name .git`
201-
else
201+
elif [[ -f ".git" || -d ".git" ]]; then
202202
PROJECT_DIRS=("`pwd`/.git")
203203
fi
204204

205-
# Foreach of the project directories
205+
## if project directories is still empty
206+
## we might be sitting inside a git repo
207+
if [[ -z ${PROJECT_DIRS} ]]; then
208+
ROOT_DIR_COMMAND="git rev-parse --show-toplevel"
209+
PROJECT_ROOT=$(eval ${ROOT_DIR_COMMAND} 2>/dev/null )
210+
211+
if [[ -z ${PROJECT_ROOT} ]]; then
212+
echo "${YELLOW}You must be inside a git repository!${NORMAL}"
213+
exit 0
214+
fi
215+
216+
PROJECT_DIRS=("${PROJECT_ROOT}/.git")
217+
fi
218+
219+
# Foreach of the project directories, run the standup
206220
for DIR in ${PROJECT_DIRS}; do
207221
cd "`dirname $DIR`"
208222
CUR_DIR=`pwd`

0 commit comments

Comments
 (0)