]> git.madduck.net Git - code/vcsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Cleanup use() exit scenarios
authorDieter Plaetinck <dieter@plaetinck.be>
Thu, 24 Nov 2011 20:58:31 +0000 (21:58 +0100)
committerDieter Plaetinck <dieter@plaetinck.be>
Fri, 25 Nov 2011 16:47:56 +0000 (17:47 +0100)
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

diff --git a/vcsh b/vcsh
index 50c1c31c7e63487a28ecb54b1cbaa8085b046527..ee3514167317bbf9abfe682c089e93d37cc9f7a5 100755 (executable)
--- a/vcsh
+++ b/vcsh
@@ -68,7 +68,7 @@ clone () {
 delete () {
        old_dir="$PWD"
        cd "$HOME"
 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:
        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 () {
 }
 
 enter () {
-       use || exit $?
+       use
        $SHELL
 }
 
        $SHELL
 }
 
@@ -108,12 +108,12 @@ list () {
 }
 
 run () {
 }
 
 run () {
-       use || exit $?
+       use
        $VCSH_EXTERNAL_COMMAND
 }
 
 seed_gitignore () {
        $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"
        # 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
 
 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"
        fi
        export GIT_WORK_TREE="$(git config --get core.worktree)"
        export VCSH_DIRECTORY="$VCSH_REPO_NAME"