From b67f39a96f50708015c0986e741cfe621f255593 Mon Sep 17 00:00:00 2001
From: Dieter Plaetinck <dieter@plaetinck.be>
Date: Thu, 24 Nov 2011 21:58:31 +0100
Subject: [PATCH] Cleanup use() exit scenarios

Instead of having use() report a normal error (which is actually fatal)
and returning >0, and calling use || exit $? everytime; just report the
fatal error and quit already
---
 vcsh | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/vcsh b/vcsh
index 50c1c31..ee35141 100755
--- a/vcsh
+++ b/vcsh
@@ -68,7 +68,7 @@ clone () {
 delete () {
 	old_dir="$PWD"
 	cd "$HOME"
-	use || exit $?
+	use
 	info "This operation WILL DETROY DATA!"
 	files=$(git ls-files)
 	echo "These files will be deleted:
@@ -87,7 +87,7 @@ To continue, type \"Yes, do as I say\""
 }
 
 enter () {
-	use || exit $?
+	use
 	$SHELL
 }
 
@@ -108,12 +108,12 @@ list () {
 }
 
 run () {
-	use || exit $?
+	use
 	$VCSH_EXTERNAL_COMMAND
 }
 
 seed_gitignore () {
-	use || exit $?
+	use
 	# Switching directory as this has to be executed from $HOME to be of any use.
 	# Going back into old directory at the end in case `vcsh use` is reactivated.
 	old_dir="$PWD"
@@ -155,8 +155,7 @@ setup() {
 
 use() {
 	if [ ! -d "$GIT_DIR" ]; then
-		error "no repository found for '$VCSH_REPO_NAME'"
-		return 12
+		fatal "no repository found for '$VCSH_REPO_NAME'" 12
 	fi
 	export GIT_WORK_TREE="$(git config --get core.worktree)"
 	export VCSH_DIRECTORY="$VCSH_REPO_NAME"
-- 
GitLab