3 # Copyright © 2008 Mike O'Connor <stew@vireo.org>
10 $0: manage home directory using mr
13 $bn - a command to manage detached git repositories using mr
19 $bn add repository_name
20 $bn new repository_name file1 [file2 file3...]
27 checkout the repository from the remote host and add it to
30 new repository_name file1 [file2 file3...]
31 create a new repository on the remote host, and checkin the
32 listed files to the new repository. Add the new repository
40 GIT_HOST=flounder.vireo.org
52 if [ -e $MRCONFIG ]; then
53 echo $MRCONFIG already exists
60 include = cat /usr/share/mr/git-fake-bare
69 REPO_NAME=$1.git ; shift
70 LOCAL_REPO=$LOCAL_REPOS/$REPO_NAME
71 REPO_URL=ssh://$GIT_HOST/$REMOTE_REPOS/$REPO_NAME
73 if [ -e "$LOCAL_REPO" ]; then
74 echo $LOCAL_REPO already exists
77 trap "rm -rf $LOCAL_REPO" 0
79 export GIT_DIR="$LOCAL_REPO"
81 git remote add origin $REPO_URL
82 git config branch.master.remote origin
83 git config branch.master.merge refs/heads/master
84 git config core.worktree ../../
85 git config core.bare false
86 GIT_WORK_TREE="$PWD" git pull
88 cat <<END >> $MRCONFIG
91 checkout = git_fake_bare_checkout '$REPO_URL' '$REPO_NAME' '../../'
101 REPO_NAME=$1.git ; shift
102 LOCAL_REPO="$LOCAL_REPOS/$REPO_NAME"
103 REPO_URL="ssh://$GIT_HOST/$REMOTE_REPOS/$REPO_NAME"
105 if [ ! -e "$1" ]; then
110 if [ -e "$LOCAL_REPO" ]; then
111 echo $LOCAL_REPO already exists
114 trap "rm -rf $LOCAL_REPO" 0
115 mkdir -p "$LOCAL_REPO"
118 GIT_DIR=$REMOTE_REPOS/$REPO_NAME git --bare init
121 export GIT_DIR="$LOCAL_REPO"
123 git remote add origin $REPO_URL
124 git config branch.master.remote origin
125 git config branch.master.merge refs/heads/master
126 git config core.worktree ../../
127 git config core.bare false
129 export GIT_WORK_TREE="$PWD"
132 git commit -m "initial checkin"
136 cat <<END >> $MRCONFIG
139 checkout = git_fake_bare_checkout '$REPO_URL' '$REPO_NAME' '../../'