5 # A convenient way to display the gitweb URL of a commit-ish, as well as the
6 # base URL and tree. Also for each argument, the tree or blob URL is printed.
8 # Copyright © 2010 martin f. krafft <madduck@madduck.net>
9 # Released under the terms of the Artistic Licence 2.0
11 # Source repository: git://git.madduck.net/etc/zsh.git
15 GITWEB_BASE=http://git.madduck.net/v
18 REMOTE=$(git config --get remote.origin.url)
22 madduck:pub/*|ssh://git.madduck.net/madduck/pub/*)
23 part="${REMOTE#madduck:pub/}"
24 part="${part#ssh://git.madduck.net/madduck/pub/}"
25 part="${part%.git}.git"
28 echo >&2 "E: I do not know how to translate $REMOTE into a gitweb URL."
33 echo $GITWEB_BASE/$part
34 HASH=$(git rev-parse HEAD)
35 echo $GITWEB_BASE/$part/commitdiff/$HASH
37 echo $GITWEB_BASE/$part/tree/HEAD
39 [ -f "$i" ] && echo "$GITWEB_BASE/$part/blob/HEAD:/$i"
40 [ -d "$i" ] && echo "$GITWEB_BASE/$part/tree/HEAD:/$i"