]> Sergey Matveev's repositories - dotfiles.git/blobdiff - bin/bin/git-list-gen.sh
Fixed git-list-gen.sh location
[dotfiles.git] / bin / bin / git-list-gen.sh
diff --git a/bin/bin/git-list-gen.sh b/bin/bin/git-list-gen.sh
new file mode 100755 (executable)
index 0000000..e6f8b66
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+# Generate list of available git repositories
+
+cat pre.txt
+cat <<EOF
+-------------------------------+------------------+---------------------------
+Repository name                | Latest change    | Description, upstream URLs
+-------------------------------+------------------+---------------------------
+EOF
+
+find . -name '*.git' -maxdepth 1 -mindepth 1 | sort | while read dir ; do
+    cd $dir
+    for commit in master main trunk ; do
+        mtime=`git cat-file -p $commit 2>/dev/null | perl -lane 'print $F[$#F - 1] if /^author/'`
+        [ -z "$mtime" ] || break
+    done
+    [ -z "$mtime" ] || mtime=`date -u -j -f %s $mtime "+%Y-%m-%d %H:%M"`
+    printf "%-30s | %16s | %s\n" ${dir#./} "$mtime" "`cat description`"
+    git remote | while read remote ; do
+        printf "%-30s | %16s | %s\n" "" "" "`git remote get-url $remote`"
+    done
+    cd ..
+done