X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=tg-files.sh;fp=tg-files.sh;h=b88940a0ba8f2a294514f7a8f4b31444e41f2a21;hp=0000000000000000000000000000000000000000;hb=49b02b3a83f5f17c973b11111a48f8fde1df50b5;hpb=8b0f1f9d215d767488542a7853320d1789838d92 diff --git a/tg-files.sh b/tg-files.sh new file mode 100644 index 0000000..b88940a --- /dev/null +++ b/tg-files.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# TopGit - A different patch queue manager +# (c) Petr Baudis 2008 +# GPLv2 + +name= +topic= + + +## Parse options + +while [ -n "$1" ]; do + arg="$1"; shift + case "$arg" in + -i) + [ -z "$topic" ] || die "-i and -w are mutually exclusive" + topic=-i;; + -w) + [ -z "$topic" ] || die "-i and -w are mutually exclusive" + topic=-w;; + -*) + echo "Usage: tg [...] files [-i | -w] [NAME]" >&2 + exit 1;; + *) + [ -z "$name" ] || die "name already specified ($name)" + name="$arg";; + esac +done + + +[ -n "$name" -a -n "$topic" ] && + die "-i/-w are mutually exclusive with NAME" + +[ -n "$name" ] || name="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')" +base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" || + die "not a TopGit-controlled branch" + +b_tree=$(pretty_tree "$name" -b) +t_tree=$(pretty_tree "$name" $topic) + +git diff-tree --name-only -r $b_tree $t_tree + +# vim:noet