3 # Copyright © 2008 Mike O'Connor <stew@vireo.org>
14 $bn - a command to manage detached git repositories using mr
20 $bn add repository_name
21 $bn new repository_name file1 [file2 file3...]
28 checkout the repository from the remote host and add it to
31 new repository_name file1 [file2 file3...]
32 create a new repository on the remote host, and checkin the
33 listed files to the new repository. Add the new repository
41 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' '../../'