From a61d7e5b39a4e0e4b9e5c69ad847639d67d07c02 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sun, 1 Mar 2009 18:29:06 +0100 Subject: [PATCH] initial checkin of gitpub script/function Signed-off-by: martin f. krafft --- .zsh/func/gitpub | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 .zsh/func/gitpub diff --git a/.zsh/func/gitpub b/.zsh/func/gitpub new file mode 100755 index 0000000..b047537 --- /dev/null +++ b/.zsh/func/gitpub @@ -0,0 +1,35 @@ +#!/bin/sh +# +# func/gitpub +# +# a convenient way to publicise a Git repository +# +# Copyright © 2008–2009 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: git://git.madduck.net/etc/zsh.git +# + +local oldpwd gitdir dest description tmpdir +oldpwd="$PWD" +gitdir="$(git rev-parse --git-dir)" +dest="$1"; shift +description="$@" +tmpdir="$(mktemp -d ${0##*/}.XXXXXX)" +trap "rm -rf $PWD/$tmpdir" EXIT + +cp -lr "$gitdir" "$tmpdir/gitdir" + +builtin cd "$tmpdir/gitdir" + +chmod -R a+rX . + +git config core.bare true +git config core.sharedrepository 2 +git config receive.denyNonFastforwards true + +echo "$description" >| description + +cd "$oldpwd" + +scp -r "$tmpdir/gitdir" "$dest" -- 2.39.5