]> ToastFreeware Gitweb - gregoa/movein.git/blobdiff - movein
Call usage() if no command line arguments is given.
[gregoa/movein.git] / movein
diff --git a/movein b/movein
index ccdd709f49bce012f1217c0aacb8e8d70584d807..c6c51370d26ad90d78d30a5a51e91fe00ec0ea01 100755 (executable)
--- a/movein
+++ b/movein
@@ -34,6 +34,8 @@ SYNOPSIS
   $bn init
   $bn ls
   $bn list
+  $bn ls-r
+  $bn list-remote
   $bn add repository_name
   $bn new repository_name file1 [file2 file3...]
   $bn login repository_name
@@ -44,7 +46,11 @@ COMMANDS
 
   ls
   list
-      show a list of repositories
+      show a list of local repositories
+
+  ls-r
+  list-remote
+      show a list of remote repositories
 
   add repository_name
       checkout the repository from the remote host and add it to
@@ -63,6 +69,7 @@ EOF
     exit 1
 }
 
+[ $# -ge 1 ] || usage
 
 GIT_HOST=git.vireo.org
 REMOTE_REPOS=~/git
@@ -130,7 +137,7 @@ login() {
     export GIT_DIR="$LOCAL_REPOS/${1}.git"
     export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)"
 
-    $SHELL -i || :
+    GIT_PS1_SHOWUNTRACKEDFILES= PSMOVEIN="movein:${1}" $SHELL -i || :
 }
 
 add() {
@@ -152,9 +159,10 @@ add() {
        git remote add origin $REPO_URL
        git config branch.master.remote origin
        git config branch.master.merge refs/heads/master
-       git config core.worktree ../../
        git config core.bare false
-       GIT_WORK_TREE="$PWD" git pull
+       git config core.worktree ../../
+       git config status.showUntrackedFiles no
+       GIT_WORK_TREE="$LOCAL_REPO/../../" git pull
        trap - 0
 
        mr -c "$MRCONFIG" config "$LOCAL_REPO" checkout="git_fake_bare_checkout '$REPO_URL' 'REPO_NAME' '../../'"
@@ -165,6 +173,12 @@ list() {
     find "${LOCAL_REPOS}" -mindepth 1 -maxdepth 1 -type d | sed 's,^.*/\([^/]*\).git$,\1,'
 }
 
+listremote() {
+    ssh $GIT_HOST "
+        find '${REMOTE_REPOS}' -mindepth 1 -maxdepth 1 -type d | sed 's,^.*/\([^/]*\).git$,\1,'
+    " </dev/null
+}
+
 new() {
     if [ $# -lt 2 ]; then 
        usage
@@ -194,9 +208,10 @@ new() {
        git remote add origin $REPO_URL
        git config branch.master.remote origin
        git config branch.master.merge refs/heads/master
-       git config core.worktree ../../
        git config core.bare false
-       export GIT_WORK_TREE="$PWD"
+       git config core.worktree ../../
+       git config status.showUntrackedFiles no
+       export GIT_WORK_TREE="$LOCAL_REPO/../../"
        git add "$@"
        git commit -m "initial checkin"
        git push --all
@@ -215,19 +230,25 @@ case "$command" in
        init $@
        ;;
     add)
-        add $@
+       add $@
        ;;
     new)
-        new $@
+       new $@
        ;;
     login)
-        login $@
+       login $@
        ;;
     ls)
-        list
+       list
        ;;
     list)
-        list
+       list
+       ;;
+    ls-r)
+       listremote
+       ;;
+    list-remote)
+       listremote
        ;;
 
     *)