5 # a convenient way to display the gitweb URL of a commit-ish
7 # Copyright © 2010 martin f. krafft <madduck@madduck.net>
8 # Released under the terms of the Artistic Licence 2.0
10 # Source repository: git://git.madduck.net/etc/zsh.git
14 GITWEB_BASE=http://git.madduck.net/v
17 REMOTE=$(git config --get remote.origin.url)
22 part="${REMOTE#madduck:pub/}"
23 part="${part%.git}.git"
26 echo >&2 "E: I do not know how to translate $REMOTE into a gitweb URL."
31 echo $GITWEB_BASE/$part
32 HASH=$(git rev-parse HEAD)
33 echo $GITWEB_BASE/$part/commitdiff/$HASH
35 echo $GITWEB_BASE/$part/tree/HEAD
37 [ -f "$i" ] && echo "$GITWEB_BASE/$part/blob/HEAD:/$i"
38 [ -d "$i" ] && echo "$GITWEB_BASE/$part/tree/HEAD:/$i"