summaryrefslogtreecommitdiff
path: root/include/pkglist
blob: 2182f4b7a58446b09c997ea322c580f45d0c8215 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env zsh
## on the PKG_HOST: list available packages
## used by ct remote-update
# the PKG_PATH (package root path) is given as first argument ($1)

if [[ ! -d $1 ]] {
	echo "$0: package root directory '$1' does not exist!" >&2
	exit 1
}

setopt err_exit

# change into package root directory (first argument)
cd $1
shift

for i in *(-/); {
	if [[ -d $i/.git ]] {
		echo -n "$i git "
		echo -n ${$(git --git-dir=$i/.git log -n 1)[2]}
		echo " $*"
	} elif [[ -d $i/objects && -d $i/refs ]] {
		echo -n "$i git "
		echo -n ${$(git --git-dir=$i log -n 1)[2]}
		echo " $*"
	} else {
		echo "$i: Unsupported or no repository" >&2
	}
}