]> git.madduck.net Git - etc/zsh.git/blob - .zsh/func/gitpub

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

do not glob for mkdir
[etc/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: http://git.madduck.net/v/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"