Define cd_to_toplevel shell function in git-sh-setup
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
b60daf0515
commit
9fde9401a9
@ -36,6 +36,17 @@ is_bare_repository () {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cd_to_toplevel () {
|
||||||
|
cdup=$(git-rev-parse --show-cdup)
|
||||||
|
if test ! -z "$cdup"
|
||||||
|
then
|
||||||
|
cd "$cdup" || {
|
||||||
|
echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
require_work_tree () {
|
require_work_tree () {
|
||||||
test $(is_bare_repository) = false ||
|
test $(is_bare_repository) = false ||
|
||||||
die "fatal: $0 cannot be used without a working tree."
|
die "fatal: $0 cannot be used without a working tree."
|
||||||
|
Loading…
Reference in New Issue
Block a user