]> git.donarmstrong.com Git - zsh.git/blob - .zsh/func/gitpub
add ~/.local/bin to PATH
[zsh.git] / .zsh / func / gitpub
1 #!/bin/sh
2 #
3 # func/gitpub
4 #
5 # a convenient way to publicise a Git repository
6 #
7 # Copyright © 2008–2009 martin f. krafft <madduck@madduck.net>
8 # Released under the terms of the Artistic Licence 2.0
9 #
10 # Source repository: git://git.madduck.net/etc/zsh.git
11 #
12
13 local oldpwd gitdir dest description tmpdir
14 oldpwd="$PWD"
15 gitdir="$(git rev-parse --git-dir)"
16 dest="$1"; shift
17 description="$@"
18 tmpdir="$(mktemp -d ${0##*/}.XXXXXX)"
19 trap "rm -rf $PWD/$tmpdir" EXIT
20
21 cp -lr "$gitdir" "$tmpdir/gitdir"
22
23 builtin cd "$tmpdir/gitdir"
24
25 chmod -R a+rX .
26
27 git config core.bare true
28 git config core.sharedrepository 2
29 git config receive.denyNonFastforwards true
30
31 echo "$description" >| description
32
33 cd "$oldpwd"
34
35 scp -r "$tmpdir/gitdir" "$dest"