mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-06-14 10:51:41 +00:00
Make sure that the current directory is a Git repository
This commit is contained in:
@ -5,7 +5,13 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if ! git rev-parse 2> /dev/null; then
|
||||
print "$0: not a repository: $PWD" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ref="$(git symbolic-ref HEAD 2> /dev/null)"
|
||||
|
||||
if [[ -n "$ref" ]]; then
|
||||
print "${ref#refs/heads/}"
|
||||
return 0
|
||||
|
Reference in New Issue
Block a user