legacy-dotfiles/zsh/.zsh/functions/cdp

13 lines
213 B
Bash

# -*- mode: sh; -*-
local _pwd=$(pwd)
while; do
cd ..
[[ ! -d '.git' && "$(pwd)" != "/" ]] || break
done
if [[ "$(pwd)" == "/" ]]; then
cd $_pwd
echo 'Project root not found' >&2
return 1
fi