]> 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:

add Gentoo installation in README
[code/vcsh.git] / vcsh
diff --git a/vcsh b/vcsh
index 3cea66646dc3ec60a87881b03ca1d94c4a9605cb..58b574485aed84677e80ab5c224362a130c9e757 100755 (executable)
--- a/vcsh
+++ b/vcsh
 # This should always be the first line of code to facilitate debugging
 [ -n "$VCSH_DEBUG" ] && set -vx
 
-basename() {
-       # Implemented in shell to avoid spawning another process
-       local file
-       file="${1##*/}"
-       [ -z "$2" ] || file="${file%$2}"
-       echo "$file"
-}
-
 SELF=$(basename $0)
-VERSION='1.20130909'
+VERSION='1.20131214.git-HEAD'
 
 fatal() {
        echo "$SELF: fatal: $1" >&2
@@ -159,11 +151,11 @@ clone() {
        for object in $(git ls-tree -r origin/master | awk '{print $4}'); do
                [ -e "$object" ] &&
                        error "'$object' exists." &&
-                       VCSH_CONFLICT=1;
+                       VCSH_CONFLICT=1
        done
        [ "$VCSH_CONFLICT" = '1' ] &&
                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
+  Once this situation has been resolved, run 'vcsh run $VCSH_REPO_NAME git pull' to finish cloning." 17
        git merge origin/master
        hook post-clone
        retire
@@ -255,7 +247,7 @@ list_tracked_by() {
 pull() {
        hook pre-pull
        for VCSH_REPO_NAME in $(list); do
-               echo -n "$VCSH_REPO_NAME: "
+               printf "$VCSH_REPO_NAME: "
                export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
                use
                git pull
@@ -267,7 +259,7 @@ pull() {
 push() {
        hook pre-push
        for VCSH_REPO_NAME in $(list); do
-               echo -n "$VCSH_REPO_NAME: "
+               printf "$VCSH_REPO_NAME: "
                export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
                use
                git push
@@ -288,7 +280,7 @@ rename() {
        # Now that the repository has been renamed, we need to fix up its configuration
        # Overwrite old name..
        GIT_DIR="$GIT_DIR_NEW"
-       $VCSH_REPO_NAME="$VCSH_REPO_NAME_NEW"
+       VCSH_REPO_NAME="$VCSH_REPO_NAME_NEW"
        # ..and clobber all old configuration
        upgrade
 }
@@ -419,6 +411,7 @@ if [ "$VCSH_COMMAND" = 'clone' ]; then
        [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a remote" 1
        GIT_REMOTE="$2"
        [ -n "$3" ] && VCSH_REPO_NAME="$3" || VCSH_REPO_NAME=$(basename "$GIT_REMOTE" .git)
+       [ -z "$VCSH_REPO_NAME" ] && fatal "$VCSH_COMMAND: could not determine repository name" 1
        export VCSH_REPO_NAME
        export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
 elif [ "$VCSH_COMMAND" = 'version' ]; then