+# checks that the directory provided is a valid git repository.
+function is_valid_git_repo()
+{
+ local complete_path="$1"; shift
+
+ # see if the directory even exists.
+ if [ ! -d "$complete_path" ]; then
+ # nope, that's not a git repo since it's not even there.
+ false
+ return
+ fi
+
+ # directory exists, so let's test it out.
+ pushd "$complete_path" &>/dev/null
+ exit_on_error "Switching to directory for check out: $complete_path"
+
+ # ask for repository name (without .git).
+ if git rev-parse --git-dir > /dev/null 2>&1; then
+ # this is a valid git repo.
+ true
+ return
+ fi
+
+ # no, this is not a valid git repository.
+ popd &>/dev/null
+ false
+}
+