#!/bin/sh -e
#
# q - print the current paths vcs root or home

while
  [ -n "${d:="${PWD}"}" ] \
    && [ ! -d "${d}/.git" ] \
    && [ ! -d "${d}/CVSROOT" ] \
    && [ "${d}" != "${HOME}" ]
do
  d="${d%/*}"
done && printf "%s\n" "${d}"
