]> git.donarmstrong.com Git - zsh.git/blob - .zsh/func/vcsh
disable gpg batch mode for getpw
[zsh.git] / .zsh / func / vcsh
1 #!/bin/zsh
2 #
3 # func/vcsh
4 #
5 # set the context for vcs-home operations
6 #
7 # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
8 # Released under the terms of the Artistic Licence 2.0
9 #
10 # Source repository: git://git.madduck.net/etc/zsh.git
11 #
12
13 ## THIS SCRIPT IS DEPRECATED IN FAVOUR OF
14 ## https://github.com/RichiH/vcsh
15
16 local FGIT_BASE="$HOME/.fgits"
17
18 if [ "${1:---help}" = '--help' ] || [ $# -gt 1 ]; then
19   echo "usage: ${0##*/} reponame" >&2
20   echo "usage: ${0##*/} -l" >&2
21   [ "$1" = '--help' ]
22   return $?
23
24 elif [ "$1" = '-l' ]; then
25   for i in $FGIT_BASE/*.git; do
26     i="${i#$FGIT_BASE/}"
27     echo "${i%.git}"
28   done
29   return 0
30 fi
31
32 if [ ! -d "$FGIT_BASE/${1}.git" ]; then
33   echo E: no repository found for "$1" >&2
34   return 2
35 fi
36
37 old_GIT_DIR="${GIT_DIR:-}"
38 old_GIT_WORK_TREE="${GIT_WORK_TREE:-}"
39
40 export GIT_DIR="$FGIT_BASE/${1}.git"
41 export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)"
42
43 PS1="%S{${0##*/}:$1}%s$PS1" $SHELL -i || :
44
45 GIT_DIR="$old_GIT_DIR"
46 [ -z "$GIT_DIR" ] && unset GIT_DIR
47 GIT_WORK_TREE="$old_GIT_WORK_TREE"
48 [ -z "$GIT_WORK_TREE" ] && unset GIT_WORK_TREE