t8400: export tests for all three modes with remotes
[topgit/pro.git] / tg-files.sh
blob37e219972626c8dd2d6e8e517bc0a683a9f64122
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: ${tgname:-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 -q HEAD)" || :
29 head="${head#refs/heads/}"
31 [ -n "$name" ] ||
32 name="${head:-HEAD}"
33 name="$(verify_topgit_branch "$name")"
34 base_rev="$(git rev-parse --short --verify "refs/$topbases/$name^0" -- 2>/dev/null)" ||
35 die "not a TopGit-controlled branch"
37 if [ -n "$head_from" ] && [ "$name" != "$head" ]; then
38 die "$head_from makes only sense for the current branch"
41 [ -z "$head_from" ] || ensure_work_tree
43 b_tree=$(pretty_tree -t "$name" -b)
44 t_tree=$(pretty_tree -t "$name" $head_from)
46 git diff-tree --name-only -r $b_tree $t_tree
48 # vim:noet