diff --git a/README.mkd b/README.md similarity index 67% rename from README.mkd rename to README.md index ca7b1c6..cfb8966 100644 --- a/README.mkd +++ b/README.md @@ -24,51 +24,55 @@ cached repos is needed, it's best done using gitolite, and enabling the - best to create a special userid only for this -- put this program in ~/bin in that userid +- put this program in $HOME/bin in that userid + ``` + git clone --depth=1 https://github.com/azhai/gitpod + mkdir $HOME/bin $HOME/pods + cp gitpod/gitpod $HOME/bin/ + chmod +x $HOME/bin/gitpod + ``` - run this command - - git daemon \ - --access-hook=$HOME/bin/gitpod \ - --informative-errors \ - --max-connections=1 \ - --base-path=$HOME \ - --export-all \ - --reuseaddr \ - --verbose \ - --detach + ``` + git daemon --access-hook=$HOME/bin/gitpod --base-path=$HOME/pods \ + --informative-errors --max-connections=2 \ + --export-all --reuseaddr --verbose --detach + ``` The "max-connections" is optional; I am running this on a very low-RAM box, so it helps me. (Sadly, git-daemon produces a cryptic "Connection reset by peer" when the limit is exceeded; be sure to inform your users that if they see that message they should try again after some time!) -- add repos using this command: +- add repos using this command (change the GITHUB_USER/GITHUB_REPO to yourself): - bin/gitpod add GITHUB_USER/GITHUB_REPO + ``` + $HOME/bin/gitpod add GITHUB_USER/GITHUB_REPO + ``` - (OPTIONAL) add the "status" repo - - cd - git init status - cd status - git commit --allow-empty -m empty + ``` + cd $HOME/pods + git init status + cd status + git commit --allow-empty -m empty + ``` # for "users" -Users use this as `git://this.host/GITHUB_USER/GITHUB_REPO` (for example `git -clone git://127.0.0.1/sitaramc/gitolite`) +Users use this as `git://this.host.ip/GITHUB_USER/GITHUB_REPO` (for example `git +clone git://127.0.0.1/azhai/gitpod`) # finding the status There's a very kludgey method to check what repos have recently been "fetched" from github.com: just run an ls-remote on a repo called "status": - - git ls-remote git://this.host.name/status + ``` + git ls-remote git://this.host.ip/status + ``` A list of tags will show up, each of which is a carefully formatted set of date, time, IP address, and repo name. Yes, it's a kludge, as I already said, but if you can think of a better way to show users *something*, I'd be happy to hear it. - diff --git a/gitpod b/gitpod index a64de94..04dcd68 100755 --- a/gitpod +++ b/gitpod @@ -1,11 +1,17 @@ #!/bin/bash +# git daemon --access-hook=/opt/bin/gitpod --base-path=$HOME/pods \ +# --informative-errors --max-connections=2 \ +# --export-all --reuseaddr --verbose --detach + +POD_HOME="$HOME/pods" + # See README for documentation if [ "$1" = "add" ] then # we're being run manually from the command line - cd + cd $POD_HOME git clone --mirror https://github.com/$2 $2.git exit $? fi @@ -18,20 +24,20 @@ fi # get the repo name repo=$2 # this is also $PWD, by the way # it is a full path; let's trim it a bit for our purposes -repo=${repo#$HOME/} +repo=${repo#$POD_HOME/} repo=${repo%.git} # no action needed for status repo [ "$repo" = "status/" ] && exit 0 # about that trailing slash: status is a non-bare repo, so $repo starts out as -# "$HOME/status/.git", and the two transformations above turn it into "status/" +# "$POD_HOME/status/.git", and the two transformations above turn it into "status/" # code to add a tag to an optional "status" repo set_status() ( - [ -d $HOME/status ] || return + [ -d $POD_HOME/status ] || return echo "$*" >> ~/gh.status.log - cd $HOME/status + cd $POD_HOME/status unset GIT_DIR git tag "$1" @@ -41,7 +47,7 @@ set_status() ( git tag | head -n -100 | while read t do git tag -d "$t" - echo $t >> $HOME/deleted.tags + echo $t >> $POD_HOME/deleted.tags done )