From 250102fa954a17e9399f6aa7edf8c8186ca6b3ef Mon Sep 17 00:00:00 2001 From: Stuart Prescott Date: Mon, 10 Oct 2011 13:01:07 +0100 Subject: [PATCH] Add an "exec" sub-command --- movein | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/movein b/movein index c6c5137..f236b14 100755 --- a/movein +++ b/movein @@ -39,6 +39,7 @@ SYNOPSIS $bn add repository_name $bn new repository_name file1 [file2 file3...] $bn login repository_name + $bn exec repository_name command [arg1 arg2...] COMMANDS init @@ -64,6 +65,11 @@ COMMANDS login repository_name start a subshell in repository_name + exec repository_name command [arg1 arg2...] + execute a command in the context of repository_name, for example: + $bn exec myrepo git status + $bn exec myrepo git ls-files + EOF exit 1 @@ -140,6 +146,20 @@ login() { GIT_PS1_SHOWUNTRACKEDFILES= PSMOVEIN="movein:${1}" $SHELL -i || : } +execin() { + local REPO + if [ $# -lt 1 ]; then + usage + fi + + REPO=$1;shift + + export GIT_DIR="$LOCAL_REPOS/${REPO}.git" + export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)" + + "$@" +} + add() { if [ $# -ne 1 ]; then usage @@ -238,6 +258,9 @@ case "$command" in login) login $@ ;; + exec) + execin "$@" + ;; ls) list ;; -- 2.39.5