]>
git.madduck.net Git - code/vcsh.git/blobdiff - vcsh
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:
fatal() {
echo "$SELF: fatal: $1" >&2
fatal() {
echo "$SELF: fatal: $1" >&2
list-tracked List all files tracked by vcsh
list-tracked-by \\
<repo> List files tracked by a repository
list-tracked List all files tracked by vcsh
list-tracked-by \\
<repo> List files tracked by a repository
+ pull Pull from all vcsh remotes
+ push Push to vcsh remotes
rename <repo> \\
<newname> Rename repository
run <repo> \\
rename <repo> \\
<newname> Rename repository
run <repo> \\
init
git remote add origin "$GIT_REMOTE"
git config branch.master.remote origin
init
git remote add origin "$GIT_REMOTE"
git config branch.master.remote origin
fatal "will stop after fetching and not try to merge!
Once this situation has been resolved, run 'vcsh run $VCSH_REPO_NAME git pull' to finish cloning.\n" 17
git merge origin/master
fatal "will stop after fetching and not try to merge!
Once this situation has been resolved, run 'vcsh run $VCSH_REPO_NAME git pull' to finish cloning.\n" 17
git merge origin/master
+pull() {
+ hook pre-pull
+ for VCSH_REPO_NAME in $(list); do
+ echo -n "$VCSH_REPO_NAME: "
+ export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
+ use
+ git pull
+ done
+ hook post-pull
+}
+
+push() {
+ hook pre-push
+ for VCSH_REPO_NAME in $(list); do
+ echo -n "$VCSH_REPO_NAME: "
+ export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
+ use
+ git push
+ done
+ hook post-push
+}
+
rename() {
git_dir_exists
[ -d "$GIT_DIR_NEW" ] && fatal "'$GIT_DIR_NEW' exists" 54
rename() {
git_dir_exists
[ -d "$GIT_DIR_NEW" ] && fatal "'$GIT_DIR_NEW' exists" 54
[ "$1" = 'write-gitignore' ]; then
[ -z $2 ] && fatal "$1: please specify repository to work on" 1
[ "$1" = 'rename' -a -z "$3" ] && fatal "$1: please specify a target name" 1
[ "$1" = 'write-gitignore' ]; then
[ -z $2 ] && fatal "$1: please specify repository to work on" 1
[ "$1" = 'rename' -a -z "$3" ] && fatal "$1: please specify a target name" 1
- [ "$1" = 'run' -a -z "$3" ] && fatal "$1: please specify a command" 1
+ [ "$1" = 'run' -a -z "$3" ] && fatal "$1: please specify a command" 1
export VCSH_COMMAND="$1"
export VCSH_REPO_NAME="$2"
export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
export VCSH_COMMAND="$1"
export VCSH_REPO_NAME="$2"
export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
- [ "$VCSH_COMMAND" = 'rename' ] && export GIT_DIR_NEW="$VCSH_REPO_D/$3.git"
- [ "$VCSH_COMMAND" = 'run' ] && shift 2
+ [ "$VCSH_COMMAND" = 'rename' ] && export GIT_DIR_NEW="$VCSH_REPO_D/$3.git"
+ [ "$VCSH_COMMAND" = 'run' ] && shift 2
[ "$VCSH_COMMAND" = 'write-gitignore' ]
elif [ "$1" = 'list' ] ||
[ "$VCSH_COMMAND" = 'write-gitignore' ]
elif [ "$1" = 'list' ] ||
- [ "$1" = 'list-tracked' ]; then
+ [ "$1" = 'list-tracked' ] ||
+ [ "$1" = 'pull' ] ||
+ [ "$1" = 'push' ]; then
export VCSH_COMMAND="$1"
elif [ -n "$2" ]; then
export VCSH_COMMAND='run'
export VCSH_COMMAND="$1"
elif [ -n "$2" ]; then
export VCSH_COMMAND='run'
export VCSH_REPO_NAME=$(basename "$VCSH_REPO_NAME" .git)
fi
export VCSH_REPO_NAME=$(basename "$VCSH_REPO_NAME" .git)
fi
-
-for check_directory in "$VCSH_REPO_D" "$VCSH_BASE/.gitignore.d"
-do
+check_dir() {
+ check_directory="$1"
if [ ! -d "$check_directory" ]; then
if [ -e "$check_directory" ]; then
fatal "'$check_directory' exists but is not a directory" 13
if [ ! -d "$check_directory" ]; then
if [ -e "$check_directory" ]; then
fatal "'$check_directory' exists but is not a directory" 13
mkdir -p "$check_directory" || fatal "could not create '$check_directory'" 50
fi
fi
mkdir -p "$check_directory" || fatal "could not create '$check_directory'" 50
fi
fi
+}
+
+check_dir "$VCSH_REPO_D"
+[ ! "x$VCSH_GITIGNORE" = 'xnone' ] && check_dir "$VCSH_BASE/.gitignore.d"
verbose "$VCSH_COMMAND begin"
export VCSH_COMMAND=$(echo $VCSH_COMMAND | sed 's/-/_/g')
verbose "$VCSH_COMMAND begin"
export VCSH_COMMAND=$(echo $VCSH_COMMAND | sed 's/-/_/g')