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.
6 [ -z $XDG_CONFIG_HOME ] && XDG_CONFIG_HOME="$HOME/.config"
7 VCSH_BASE="$XDG_CONFIG_HOME/vcsh/repo.d"
10 echo "usage: $SELF <args>
12 help Display this help
16 use <repo> Use this repository
18 <command> Use this repository
20 init Initialize a new repository
22 [<repo>] Clone from an existing repository
24 exit Exit vcsh mode" >&2
29 GIT_DIR="$VCSH_BASE/$REPO_NAME.git"
31 if [ ! -d "$GIT_DIR" ]; then
32 echo E: no repository found for "$REPO_NAME" >&2
37 export GIT_WORK_TREE="$(git config --get core.worktree)"
38 export VCSH_DIRECTORY="$REPO_NAME"
43 echo "$SELF: fatal: $GIT_DIR exists" &&
45 export GIT_WORK_TREE="$HOME"
46 mkdir -p $GIT_WORK_TREE
48 (echo "$SELF: fatal: could not enter $GIT_WORK_TREE" &&
52 git config core.worktree $GIT_WORK_TREE
61 if [ "$1" = 'help' ] || [ $# -eq 0 ]; then
66 elif [ "$1" = 'list' ]; then
67 for i in $VCSH_BASE/*.git; do
68 echo $(basename $i .git)
72 elif [ "$1" = 'run' ]; then
79 elif [ "$1" = 'use' ]; then
80 if [[ -o NO_IGNORE_EOF ]]; then
81 export VCSH_NO_IGNORE_EOF=1
83 vcsh_exit() {vcsh exit; zle reset-prompt;}
85 bindkey '^d' 'vcsh_exit'
91 elif [ "$1" = 'clone' ]; then
94 [[ -z $REPO_NAME ]] && REPO_NAME=$(basename $GIT_REMOTE .git)
96 export GIT_DIR="$VCSH_BASE/$REPO_NAME.git"
99 git remote add origin $GIT_REMOTE
100 git config branch.master.remote origin
101 git config branch.master.merge refs/heads/master
103 for i in $(git ls-tree -r origin/master | awk '{print $4}'); do
105 echo "$SELF: error: $i exists." &&
108 [[ -n $CONFLICT ]] &&
109 echo "$SELF: fatal: will stop after fetching and not try to merge!\n" &&
111 git merge origin/master
114 elif [ "$1" = 'init' ]; then
115 export REPO_NAME="$2"
116 export GIT_DIR="$VCSH_BASE/$REPO_NAME.git"
120 elif [ "$1" = 'exit' ]; then
121 if [[ $VCSH_NO_IGNORE_EOF -gt 0 ]]; then
122 unset VCSH_NO_IGNORE_EOF