2 # TopGit - A different patch queue manager
3 # Copyright (C) Petr Baudis <pasky@suse.cz> 2008
4 # Copyright (C) 2021 Kyle J. McKay <mackyle@gmail.com>
9 Usage: ${tgname:-tg} [...] files [-i | -w] [<name>]
11 -i use TopGit metadata from index instead of HEAD branch
12 -w use metadata from working directory instead of branch"
16 if [ "${1:-0}" != 0 ]; then
17 printf '%s\n' "$USAGE" >&2
19 printf '%s\n' "$USAGE"
35 [ -z "$head_from" ] || die
"-i and -w are mutually exclusive"
40 [ -z "$name" ] || die
"name already specified ($name)"
45 head="$(git symbolic-ref -q HEAD)" ||
:
46 head="${head#refs/heads/}"
50 v_verify_topgit_branch name
"$name"
51 base_rev
="$(git rev-parse --short --verify "refs
/$topbases/$name^
0" -- 2>/dev/null)" ||
52 die
"not a TopGit-controlled branch"
54 if [ -n "$head_from" ] && [ "$name" != "$head" ]; then
55 die
"$head_from makes only sense for the current branch"
58 [ -z "$head_from" ] || ensure_work_tree
60 v_pretty_tree b_tree
-t "$name" -b
61 v_pretty_tree t_tree
-t "$name" $head_from
63 git diff-tree
--name-only -r $b_tree $t_tree