branch_empty: use pretty_tree and therefore respect -i/-w
[topgit/bertw.git] / tg-files.sh
blob507efcb331aa026f48d76f0c5cd89db31cc38e04
1 #!/bin/sh
2 # TopGit - A different patch queue manager
3 # (c) Petr Baudis <pasky@suse.cz> 2008
4 # GPLv2
6 name=
7 head_from=
10 ## Parse options
12 while [ -n "$1" ]; do
13 arg="$1"; shift
14 case "$arg" in
15 -i|-w)
16 [ -z "$head_from" ] || die "-i and -w are mutually exclusive"
17 head_from="$arg";;
18 -*)
19 echo "Usage: tg [...] files [-i | -w] [NAME]" >&2
20 exit 1;;
22 [ -z "$name" ] || die "name already specified ($name)"
23 name="$arg";;
24 esac
25 done
28 head="$(git symbolic-ref HEAD)"
29 head="${head#refs/heads/}"
31 [ -n "$name" ] ||
32 name="$head"
33 base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
34 die "not a TopGit-controlled branch"
36 if [ -n "$head_from" ] && [ "$name" != "$head" ]; then
37 die "$head_from makes only sense for the current branch"
40 b_tree=$(pretty_tree "$name" -b)
41 t_tree=$(pretty_tree "$name" $head_from)
43 git diff-tree --name-only -r $b_tree $t_tree
45 # vim:noet