summaryrefslogtreecommitdiff
path: root/git-sh-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-sh-setup.sh')
-rw-r--r--git-sh-setup.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index aa16b83..8e427da 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -39,9 +39,15 @@ git_broken_path_fix () {
# @@BROKEN_PATH_FIX@@
-die() {
- echo >&2 "$@"
- exit 1
+die () {
+ die_with_status 1 "$@"
+}
+
+die_with_status () {
+ status=$1
+ shift
+ echo >&2 "$*"
+ exit "$status"
}
GIT_QUIET=
@@ -140,6 +146,13 @@ cd_to_toplevel () {
}
}
+require_work_tree_exists () {
+ if test "z$(git rev-parse --is-bare-repository)" != zfalse
+ then
+ die "fatal: $0 cannot be used without a working tree."
+ fi
+}
+
require_work_tree () {
test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true ||
die "fatal: $0 cannot be used without a working tree."