Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions README.mkd → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

18 changes: 12 additions & 6 deletions gitpod
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"

Expand All @@ -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
)

Expand Down