X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/49a6af92db204536f6752583c1c24a34c1070c8c..c2802e6be31b38797a1e8a96a7653adfa5948fc0:/vcsh diff --git a/vcsh b/vcsh index a6d8213..fcb3aa4 100755 --- a/vcsh +++ b/vcsh @@ -77,6 +77,7 @@ fi : ${VCSH_HOOK_D:=$XDH_CONFIG_HOME/vcsh/hooks-enabled} : ${VCSH_BASE:=$HOME} : ${VCSH_GITIGNORE:=exact} +: ${VCSH_GITATTRIBUTES:=none} : ${VCSH_WORKTREE:=absolute} if [ ! "x$VCSH_GITIGNORE" = 'xexact' ] && [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && [ ! "x$VCSH_GITIGNORE" = 'xrecursive' ]; then @@ -175,6 +176,7 @@ commit() { export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" use git commit --untracked-files=no --quiet + VCSH_COMMAND_RETURN_CODE=$? echo done hook post-commit @@ -223,7 +225,7 @@ init() { [ ! -e "$GIT_DIR" ] || fatal "'$GIT_DIR' exists" 10 mkdir -p "$VCSH_BASE" || fatal "could not create '$VCSH_BASE'" 50 cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11 - git init + git init --shared=0600 upgrade hook post-init } @@ -257,6 +259,7 @@ pull() { export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" use git pull + VCSH_COMMAND_RETURN_CODE=$? echo done hook post-pull @@ -269,6 +272,7 @@ push() { export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" use git push + VCSH_COMMAND_RETURN_CODE=$? echo done hook post-push @@ -295,6 +299,7 @@ run() { hook pre-run use "$@" + VCSH_COMMAND_RETURN_CODE=$? hook post-run } @@ -303,12 +308,14 @@ status() { export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" use git status --short --untracked-files='no' + VCSH_COMMAND_RETURN_CODE=$? else for VCSH_REPO_NAME in $(list); do echo "$VCSH_REPO_NAME:" export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" use git status --short --untracked-files='no' + VCSH_COMMAND_RETURN_CODE=$? echo done fi @@ -328,9 +335,11 @@ upgrade() { git config core.worktree "$VCSH_BASE" fi [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && git config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME" + [ ! "x$VCSH_GITATTRIBUTES" = 'xnone' ] && git config core.attributesfile ".gitattributes.d/$VCSH_REPO_NAME" git config vcsh.vcsh 'true' use [ -e "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" ] && git add -f "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" + [ -e "$VCSH_BASE/.gitattributes.d/$VCSH_REPO_NAME" ] && git add -f "$VCSH_BASE/.gitattributes.d/$VCSH_REPO_NAME" hook post-upgrade } @@ -492,6 +501,7 @@ check_dir() { check_dir "$VCSH_REPO_D" [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && check_dir "$VCSH_BASE/.gitignore.d" +[ ! "x$VCSH_GITATTRIBUTES" = 'xnone' ] && check_dir "$VCSH_BASE/.gitattributes.d" verbose "$VCSH_COMMAND begin" export VCSH_COMMAND=$(echo $VCSH_COMMAND | sed 's/-/_/g') @@ -499,3 +509,4 @@ hook pre-command $VCSH_COMMAND "$@" hook post-command verbose "$VCSH_COMMAND end, exiting" +exit $VCSH_COMMAND_RETURN_CODE